Author Topic: Detect if a brick was planted by a Duplicator/Duplorcator  (Read 2862 times)

That is exactly what I just said it does not do.

Just loaded up single player, planted a brick, got its ID, and entered schedule(0, 13315, delete);. The brick was still there. You are wrong.

Woops I mixed stuff up

Would swapping %client for %brick work then?

Or is that not how it works?


I just realized how stupid that sounded.
« Last Edit: October 27, 2012, 07:36:31 PM by Randomness »

Im having a bizzare problem: The anti duplication appears to only work for 1 type of drug and not the others. However I dont see the echo debug lines that tell me the code works.

Post the updated code.

Code: [Select]
package drugDupeCheck
{
function fxDTSBrick::onPlant(%brick)
{
%brick = %client.player.tempBrick;
if(%brick.duplicationBrick)
{
echo("OP 1"); // Debug
if(%brick.getDatablock().isDrug)
{
echo("Is a drug."); // Debug
messageClient(%brick.client, '', "\c0Dont ever try to duplicate your drugs - thats cheating.");
messageAll('', '\c3' @ %brick.client.name @ "\c6attempted to cheat by duplicating drugs!");
%brick.schedule(0,delete);
}
}
else if(%brick.dupStartBrick)
{
echo("OP 2"); // Debug
if(%brick.getDatablock().isDrug)
{
echo("Is a drug."); // Debug
messageClient(%brick.client, '', "\c0Dont ever try to duplicate your drugs - thats cheating.");
messageAll('', '\c3' @ %brick.client.name @ "\c6attempted to cheat by duplicating drugs!");
%brick.schedule(0,delete);
}
}
else
{
echo("OP 3");
parent::onPlant(%client);
//Was not duplicated.
}
}
};
activatePackage(drugDupeCheck);

Only OP 3 is reflected in code for the ones that were planted. The one that was blocked appears to have been detected by the code, but OP 1 nor OP 2 shows up in the console code.

Um.

%client is never defined?

Code: [Select]
%client = %brick.client;
will fix it right?

1. You might have forgotten to put osDrug=1; in the datbloke
2. When the drug is the brick ontop the brick you duped it will be duped too
3. So I can cause massive chat spam by holding down the return key?
4. it's parent::onPlant(%brick); !!!
« Last Edit: October 27, 2012, 08:15:28 PM by Blocki »



1. You might have forgotten to put osDrug=1; in the datbloke
2. When the drug is the brick ontop the brick you duped it will be duped too
3. So I can cause massive chat spam by holding down the return key?


So isDrug refers to it being 1, not true, like it currently is in drug datablocks.

Marijuana:
Code: [Select]
isDrug = true;
Opium:
Code: [Select]
isDrug = true;
Cocaine:
Code: [Select]
isDrug = true;

I'll also delete the ghost brick so the chat cant be spammed that way.

I'll also delete the ghost brick so the chat cant be spammed that way.
Wait does dupe have a selecting timeout.

I have no idea what the hell Im doing wrong.

Code: [Select]
package drugDupeCheck
{
function fxDTSBrick::onPlant(%brick)
{
%client = %brick.client;
%brick = %client.player.tempBrick;
if(%brick.duplicationBrick)
{
echo("OP 1"); // Debug
if(%brick.getDatablock().isDrug)
{
echo("Is a drug."); // Debug
messageClient(%brick.client, '', "\c0Dont ever try to duplicate your drugs - thats cheating.");
messageAll('', '\c3' @ %brick.client.name @ "\c6attempted to cheat by duplicating drugs!");
%brick.schedule(0,delete);
}
}
else if(%brick.dupStartBrick)
{
echo("OP 2"); // Debug
if(%brick.getDatablock().isDrug)
{
echo("Is a drug."); // Debug
messageClient(%brick.client, '', "\c0Dont ever try to duplicate your drugs - thats cheating.");
messageAll('', '\c3' @ %brick.client.name @ "\c6attempted to cheat by duplicating drugs!");
%brick.schedule(0,delete);
}
}
else
{
echo("OP 3");
parent::onPlant(%client);
//Was not duplicated.
}
}
};
activatePackage(drugDupeCheck);

I have no idea what the hell Im doing wrong.

Code: [Select]
package drugDupeCheck
{
function fxDTSBrick::onPlant(%brick)
{
%client = %brick.client;
%brick = %client.player.tempBrick;
if(%brick.duplicationBrick)
{
echo("OP 1"); // Debug
if(%brick.getDatablock().isDrug)
{
echo("Is a drug."); // Debug
messageClient(%brick.client, '', "\c0Dont ever try to duplicate your drugs - thats cheating.");
messageAll('', '\c3' @ %brick.client.name @ "\c6attempted to cheat by duplicating drugs!");
%brick.schedule(0,delete);
}
}
else if(%brick.dupStartBrick)
{
echo("OP 2"); // Debug
if(%brick.getDatablock().isDrug)
{
echo("Is a drug."); // Debug
messageClient(%brick.client, '', "\c0Dont ever try to duplicate your drugs - thats cheating.");
messageAll('', '\c3' @ %brick.client.name @ "\c6attempted to cheat by duplicating drugs!");
%brick.schedule(0,delete);
}
}
else
{
echo("OP 3");
parent::onPlant(%client);
//Was not duplicated.
}
}
};
activatePackage(drugDupeCheck);

Rename your changing of %brick to something else, maybe %tempbrick because your overwriting something you need

%brick.dupStartBrick

and

%brick.duplicationBrick

or, rather, %tempbrick instead of %brick,

I just found out now that these aren't actually duplication methods, because regardless of duplication it returns the OP 3 debug line.

Whats even stranger is that it -still- blocks the Cocaine brick being duplicated but doesn't do the same for the others.

What can I do to fetch the name of the wielded tool? Thats much easier to do than to go on this wild goose chase.
« Last Edit: October 27, 2012, 09:08:38 PM by Randomness »