Blockland Forums > Modification Help

Syntax Error [EDIT: CONSOLE ERROR]

Pages: (1/3) > >>

Miles Barlow:

Every time I try to run this script I keep on getting (the same) syntax errors. I would greatly appreciate it if you could help. Console.log Snip:

Syntax solved, see second post.

Here is the whole code.


--- Quote ---package BrickPlant {
   function serverCmdPlantBrick(%this)
   {
      $CodeNextBrick=1;
      parent::serverCmdPlantBrick(%this);
   }
   function fxDTSbrick::onPlant(%brick)
   {
      %ret = parent::onPlant(%brick);
      %client = %brick.client;
      if(!$codeNextBrick)
      return %ret;
            if(isObject(%brick.getDownBrick(0)))
          {
         if(%brick.getDownBrick.getDatablock() $= nametoid("Admin32x32x1Data"))
             {
          if(getTrustLevel(%client,%brick.getDownBrick(0) == 0) || getTrustLevel(%client,%brick.getDownBrick(0) == 1) || getTrustLevel(%client,%brick.getDownBrick(0) == 2))
           {
                if(%client.isSuperAdmin || %client.isAdmin)
                 {
         
                  %brick = %client.player.tempBrick;
                  %pos = %brick.getPosition();

                  %newBrick = new fxDtsBrick()
                  {
                     position  = %pos;
                     rotation  = %brick.rotation;
                     dataBlock = %brick.getDataBlock();
                     angleId   = %brick.angleId;
                     colorId   = %brick.colorId;
                     colorFxId = %brick.colorFxId;
                     shapeFxId = %brick.colorFxId;
                     client    = %client;
                  };

                  %newBrick.plant();
                  %newBrick.setTrusted(1);
                  %client.brickGroup.add(%newBrick);
                        }
             }
         }
   return %ret;
      }
    }
 };
activatepackage(brickplant);

package PlatePlant {
   function serverCmdPlantBrick(%this)
   {
      $CodeNextBrick=1;
      parent::serverCmdPlantBrick(%this);
   }
   function fxDTSbrick::onPlant(%brick)
   {
      %ret = parent::onPlant(%brick);
      %client = %brick.client;
      if(!$codeNextBrick)
      return %ret;
         
      if(!isObject(%client.player.tempBrick))
       {
         if(%client.player.tempBrick.GetDataBlock() $=Nametoid ("Admin32x32x1Data"))
           {
              if(%client.isSuperAdmin || %client.isAdmin)
              {
                  %brick = %client.player.tempBrick;
                  %pos = %brick.getPosition();

                  %newBrick = new fxDtsBrick()
                  {
                     position  = %pos;
                     rotation  = %brick.rotation;
                     dataBlock = %brick.getDataBlock();
                     angleId   = %brick.angleId;
                     colorId   = %brick.colorId;
                     colorFxId = %brick.colorFxId;
                     shapeFxId = %brick.colorFxId;
                     client    = %client;
                  };
                  %newBrick.plant();
              %newbrick.setTrusted(1);
              %client.brickGroup.add(%newBrick);
                        }
                 }
   return %ret;
      }
    }
  };
Activatepackage(plateplant);


--- End quote ---


Space Guy:


--- Quote ---      else
        {
          parent::servercmdplantbrick(%client, %brick);
        }
--- End quote ---
Needs a semicolon there.

Specifically you need one if you're calling a function (as you have there), setting a variable (%vec = "10 10 10";) or creating an object. (new fxDTSBrick(){...};)

Miles Barlow:


--- Quote from: Space Guy on July 21, 2010, 04:46:18 AM ---Needs a semicolon there.

--- End quote ---
Oh, thanks for the quick reply :D! I'll test it out now.

EDIT2: I changed the script (updated OP), but it still checks for trust. I think this has something to do with this console error every time I plant a brick.


--- Quote ---Add-Ons/Brick_AdminPlates/server.cs (14): Unable to find object: '' attempting to call function 'getDownBrick'
BackTrace: ->[adminbrick]ServerCmdPlantBrick->[adminplates]ServerCmdPlantBrick


Add-Ons/Brick_AdminPlates/server.cs (15): Unable to find object: '' attempting to call function 'getDataBlock'
BackTrace: ->[adminbrick]ServerCmdPlantBrick->[adminplates]ServerCmdPlantBrick
--- End quote ---


MegaScientifical:

Your script thinks the person sends them the brick. The server makes the brick. If the client could make brick data, then tell the server "Okay, my brick is this", then it might as well be able to tell it's in someone else's build and laugh.

Edit: I'm saying that, when you plant a brick, the server handles creation of the brick on the ghost brick information. All that's sent is %client.

otto-san:

maybe mess around with brickgroups to get this to work

Pages: (1/3) > >>

Go to full version