Hello. Currently I am working on an addon that lets only admins build.
Here is my code:
package BuildingBlocker
{
function gameConnection::OnClientEnterGame(%this,%obj,%a,%b,%c,%d,%e)
{
%this.buildallow = 0;
Parent::OnClientEnterGame(%this,%obj,%a,%b,%c,%d,%e);
}
function fxDTSbrick::Plant(%brick, %client, %obj)
{
%e = Parent::Plant(%brick);
if(!%e)
{
%c = getBrickGroupFromObject(%brick).client;
if(isObject(%c) && isObject(%c.player) && isObject(%c.player.tempbrick))
{
if(%c.isAdmin)
{
Parent::Plant(%brick);
}
else if(%c.buildallow == 1)
{
Parent::Plant(%brick);
}
else
{
commandToClient(%c,'centerprint',"\c7Building is not enabled for players.",2);
%brick.schedule(0,"delete");
%c.player.tempbrick.delete();
}
}
}
}
};
activatePackage("BuildingBlocker");
It removes the ghost brick once they plant the brick, but they are still able to plant their bricks.
I am wondering how to make it so it instantly removes the ghost brick once it is placed.