Blockland Forums > Modification Help
Messing with baseplate rules...
<< < (2/3) > >>
Red_Guy:

--- Quote from: tyler0 on June 11, 2011, 01:57:18 PM ---   function serverCmdPlantBrick(%client)
   {
      parent::serverCmdPlantBrick(%client);
      if($Pref::Server::BREnable == 2)
      {
         if(%client.bl_id == getNumKeyID())
            return;
         if($Pref::Server::BRAppliesToAdmin == 1 && %client.isSuperAdmin)
            return;
         if($Pref::Server::BRAppliesToAdmin == 2 && %client.isAdmin)
            return;
         if(%client.BRException)
            return;
         %plantedBrick = %client.brickGroup.getObject(%client.brickGroup.getCount() - 1);
         if(%plantedBrick.getDistanceFromGround() == 0 && %plantedBrick.getDatablock().category !$= "Baseplates")
         {
            %plantedBrick.delete();
            commandToClient(%client,'MessageBoxOK',"Invalid Brick","You must start with a Baseplate.<bitmap:base/client/ui/brickIcons/16x16 Base>");
         }
      }
   }


--- End quote ---
That doesnt match what you originally posted.

Also - this is slightly easier use:

--- Code: ---function serverCmdPlantBrick(%client)
  {
   %plantedBrick = parent::serverCmdPlantBrick(%client);
   if (!isObject(%plantedBrick) )
     return;

   if ($Pref::Server::BREnable == 2)
     {
      if(%client.bl_id == getNumKeyID())
        return;
      if($Pref::Server::BRAppliesToAdmin == 1 && %client.isSuperAdmin)
        return;
      if($Pref::Server::BRAppliesToAdmin == 2 && %client.isAdmin)
        return;
      if(%client.BRException)
        return;

      if (%plantedBrick.getDistanceFromGround() == 0 && %plantedBrick.getDatablock().category !$= "Baseplates")
        {
         %plantedBrick.delete();
         commandToClient(%client,'MessageBoxOK',"Invalid Brick","You must start with a Baseplate.<bitmap:base/client/ui/brickIcons/16x16 Base>");
        }
     }
  }

--- End code ---

but what do you mean "it doesnt work" ?

what happens when you plant a baseplate on the ground?
what happens when you plant a non-baseplate on the ground?
what happens when you plant a non-baseplate on a baseplate?
tyler0:

--- Code: --- function serverCmdPlantBrick(%client) {
%plantedBrick = parent::serverCmdPlantBrick(%client);

if(%plantedBrick.getDistanceFromGround() == 0 && %plantedBrick.getDatablock().category !$= "Baseplates") {
%plantBrick.delete();
commandToClient(%client,'MessageBoxOK',"Invalid Brick","You must start with a Baseplate.<bitmap:base/client/ui/brickIcons/16x16 Base>");
}
}
--- End code ---

It works.. just is doesn't cancel the parent::serverCmdPlantBrick?


--- Code: ---Entering [mrBrickSystem]serverCmdPlantBrick(7369)
   Entering serverCmdPlantBrick(7369)
      Entering fxDTSBrick::onAdd(10895)
--- End code ---
YoshiDude:

--- Quote from: tyler0 on June 11, 2011, 01:13:42 PM ---2147483647 Bricks

--- End quote ---
That's the highest number that binary can get.
[nope.avi]
Destiny/Zack0Wack0:

--- Quote from: YoshiDude on June 14, 2011, 11:16:59 PM ---That's the highest number that binary can get.
[/nerd]

--- End quote ---
Yeah, no. It's the highest number a 32 bit integer can reach.
Xalos:

--- Quote from: Destiny/Zack0Wack0 on June 15, 2011, 01:49:31 AM ---Yeah, no. It's the highest number a 32 bit integer can reach.

--- End quote ---
A signed 32 bit integer, if I remember correctly.
Navigation
Message Index
Next page
Previous page

Go to full version