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

Why don't you just, delete the client with a message saying not to duplicate drugs, so that you don't get spammed messages when a person holds enter while trying to dup drugs.

Also, did the code work or not?

In order from most to least critical: %client is never defined. You're calling the parent with %client instead of %brick. Just realized it would be %brick.schedule(0, delete) You should probably remove the global notice - you're risking message spam. The client notice can be improved with another 0 time schedule stored to a variable on the client, cancelling it before creating a new one so that it will only send the message once per plant attempt.

No. The debug echo lines don't even appear in the console.

Wtf guys it's %brick.schedule(0,delete);

Wtf guys it's %brick.schedule(0,delete);

I'm not a master coder, or anything like that, I'm just going off of my past experience.

I only said it because it worked for me, if what you say works then go ahead lol

I only said it because it worked for me, if what you say works then go ahead lol
Never said it doesn't work lol

I only said it because it worked for me, if what you say works then go ahead lol
How on earth would that work for anyone? Schedule on its own calls a function, not a method. The object reference in the middle is just an object the schedule is tied to; if it's deleted the schedule cancels.

Also, you never got the client's temp brick. You're testing the brick that was actually planted.

How on earth would that work for anyone? Schedule on its own calls a function, not a method. The object reference in the middle is just an object the schedule is tied to; if it's deleted the schedule cancels.

Also, you never got the client's temp brick. You're testing the brick that was actually planted.

Yeaaah.
Just realized that.

Went back to the script I was using it in, found out I was wrong from the beginning, sorry guys.

How on earth would that work for anyone? Schedule on its own calls a function, not a method. The object reference in the middle is just an object the schedule is tied to; if it's deleted the schedule cancels.

Also, you never got the client's temp brick. You're testing the brick that was actually planted.
If you put an object there the schedule will call the method on the object


If you put an object there the schedule will call the method on the object
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.


Also, you never got the client's temp brick. You're testing the brick that was actually planted.

How on earth would that work for anyone? Schedule on its own calls a function, not a method. The object reference in the middle is just an object the schedule is tied to; if it's deleted the schedule cancels.

Also, you never got the client's temp brick. You're testing the brick that was actually planted.

Oh, that line I deleted. I'm an idiot. Why did I think that would solve my problems?

%brick = %client.tempbrick  or something.

Oh, that line I deleted. I'm an idiot. Why did I think that would solve my problems?

%brick = %client.tempbrick  or something.
No, you'd be overwriting the %brick that you're getting as a parameter. You need that to pass on when calling the parent.

The original code was

Code: [Select]
function servercmdPlantBrick(%client)
{
%brick = %client.player.tempBrick;
if(%brick.duplicationBrick)
{
//Duplorcator support
}
else if(%brick.dupStartBrick)
{
//Duplicator support
}
else
{
//Was not duplicated.
}
}

Of course, it was modified from this state because it doesn't just work like that when popped into the script.

Code: [Select]
%brick = %client.player.tempBrick; was what I was referencing, but that overwrites %brick.

The original code was

Code: [Select]
function servercmdPlantBrick(%client)
{
%brick = %client.player.tempBrick;
if(%brick.duplicationBrick)
{
//Duplorcator support
}
else if(%brick.dupStartBrick)
{
//Duplicator support
}
else
{
//Was not duplicated.
}
}

Of course, it was modified from this state because it doesn't just work like that when popped into the script.

Code: [Select]
%brick = %client.player.tempBrick; was what I was referencing, but that overwrites %brick.
That one has %client passed in as a parameter. Also you still need to define %client in yours.