Blockland Forums > Help
Scripting Help
Medieval:
Hello. Currently I am working on an addon that lets only admins build.
Here is my code:
--- 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");
--- End code ---
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.
jes00:
Return 6 instead of deleting the brick and it'll prevent the brick from being planted. You'll also want to return the parent when you parent the function.
Kyuande:
You may use serverCmdPlantBrick(%client) and use the parent if they are an admin.
Medieval:
Sorry, I wasn't descriptive enough.
In my code I already had it to make sure they weren't able to plant bricks.
What I am looking for is the function or how to make it so they are unable to place their ghost bricks.
Thanks in advance, Medieval.
Medieval:
All I need to know is the function of placing a ghost brick.
I already have the one for planting bricks.
Navigation
[0] Message Index
[#] Next page
Go to full version