Blockland Forums > Modification Help
Messing with baseplate rules...
(1/3) > >>
tyler0:
Ok i need the codes from baseplates so people can't plant with out a lot. I skimmed through the server.cs and found this:


--- Code: --- %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 code ---

So i went ahead and pasted it into my own server.cs and it didn't work. So i put it some callbacks so it now looks like this:


--- Code: --- %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>");
return;
} else {
messageClient(%client,'',%plantedBrick.getDistanceFromGround() @ %plantedBrick.getDatablock().category);
}
--- End code ---

The result will message the client the "distance from the ground" SPC "category". The result: 2147483647 Bricks
Daenth:
Post your whole function for your version. Some variables may not have been mentioned, which is why it's not a smart idea to copy-paste code.
tyler0:

   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>");
         }
      }
   }
tyler0:
bump
Placid:
are you setting $Pref::Server::BrAppliesToAdmin and $Pref::Server::BREnable to a boolean or a value? If it's a boolean, that's not the problem, but if it's not you'd have to use $="#" instead of == #.
Navigation
Message Index
Next page

Go to full version