So this add-on is supposed to make it so you can only build within a certain range of the spawn point.
I have 2 versions of the script. One that doesn't work. And another one that works perfectly while in debug mode, and half-works while out of debug mode(just because it has the capability to go into debug mode).
I'm sure I'm just missing some syntax somewhere, but I can't seem to figure it out.
This is the one with debuggingness.
package BrickRangePackage
{
function fxDTSbrick::Plant(%brick)
{
%e = Parent::Plant(%brick);
if(!%e)
{
%c = getbrickgroupfromobject(%brick).client;
if(isObject(%c) && isObject(%c.player) && isObject(%c.player.tempbrick))
{
%pos1x = getWord(%c.player.tempbrick.getWorldBox(), 0);
%pos1y = getWord(%c.player.tempbrick.getWorldBox(), 1);
%pos2x = getWord(%c.player.tempbrick.getWorldBox(), 3);
%pos2y = getWord(%c.player.tempbrick.getWorldBox(), 4);
if(%pos1x > 124 || %pos1x < -124 || %pos1y > 124 || %pos1y < -124 || %pos2x > 124 || %pos2x < -124 || %pos2y > 124 || %pos2y < -124)
{
commandtoclient(%c,'centerprint',"\c6Too far - Build closer to the center.",2);
%brick.schedule(0, "delete");
if($debug)
{
echo("Return is true.");
}
}
if($debug)
{
echo(%c SPC %brick SPC %pos1x SPC %pos1y SPC %pos2x SPC %pos2y);
}
}
}
}
};
ActivatePackage(BrickRangePackage);
This is the one without.
package BrickRangePackage
{
function fxDTSbrick::Plant(%brick)
{
%e = Parent::Plant(%brick);
if(!%e)
{
%c = getbrickgroupfromobject(%brick).client;
if(isObject(%c) && isObject(%c.player) && isObject(%c.player.tempbrick))
{
%pos1x = getWord(%c.player.tempbrick.getWorldBox(), 0);
%pos1y = getWord(%c.player.tempbrick.getWorldBox(), 1);
%pos2x = getWord(%c.player.tempbrick.getWorldBox(), 3);
%pos2y = getWord(%c.player.tempbrick.getWorldBox(), 4);
if(%pos1x > 124 || %pos1x < -124 || %pos1y > 124 || %pos1y < -124 || %pos2x > 124 || %pos2x < -124 || %pos2y > 124 || %pos2y < -124)
{
commandtoclient(%c,'centerprint',"\c6Too far - Build closer to the center.",2);
%brick.schedule(0, "delete");
}
}
}
}
};
ActivatePackage(BrickRangePackage);