Author Topic: A random syntax error appeared!  (Read 2084 times)

So, I'm coding a sort of RP Jailing thing (don't hate me) and I get syntax errors that are extremely weird, it'd be nice if the people of Blockland took a look.
Quote
function serverCmdJail(%client,%target,%crime)
{
        if(%client.isAdmin || %client.isModerator)
        {
                %pl = findclientbyname(%target);
                if(%crime $= "Cannabis")
                {
                    %pl.player.setTransform($CannabisLocation);
                    %pl.isJailed = "1";
                }
                else if(%crime $= "Assault")
                {
                      %pl.player.setTransform($AssaultLoc);
                      %pl.isJailed = "1";
                }
                else if(%crime $= "Weaponary")
                {
                   %pl.player.setTransform($HeavyWeaponsLocation);
                   %pl.isJailed = "1";
                }
                else if(%crime $= "Driving")
                {
                    %pl.player.setTransform($VroomVroomJail);
                    %pl.isJailed = "1";
                }
        }
}
 
function serverCmdForceUnjail(%client,%target)
{
if(%client.isAdmin)
{
                %pl = findclientbyname(%target); 
                %pl.isJailed = 0;
                %pl.player.instantRespawn();
                %pl.chatMessage('MsgAdminForce',"\c2You have been unjailed by" SPC %client.name);
                }
}
function freePerson(%client)
{
                %client.isJailed = 0;
                %client.player.instantRespawn();
                %client.chatMessage("\c2You have been unjailed automatically.");
                                       
}
 
function serverCmdSetJailPosition(%client,%category)
  {
      %pos = %client.player.getPosition();
if(%client.isAdmin)
{
         if(%category $= "Cannabis")
         {
          $CannabisLocation = %pos;
         }
          else if(%category $= "Assault")
          {
          $AssaultLoc = %pos;
          }
           else if(%category $= "Weaponary")
          {
          $HeavyWeaponsLocation = %pos;
          }
           else if(%category $= "Driving")
          {
          $VroomVroomJail = %pos;
          }
}
 
 
 
 
package respawns
{
        function gameConnection::spawnPlayer(%client)
        {
                if(%client.isJailed)
                {
                        return;
                }
                parent::spawnPlayer(%client);
        }
};
activatePackage(respawns);
I'm getting a syntax error @ package Respawns, and I can't figure out how to fix :V

function serverCmdSetJailPosition(%client,%category)
  {
      %pos = %client.player.getPosition();

No closing brackets.

In addition, making it like that is not going to work out at all. As a general rule of thumb, you should NEVER return any gameConnection:: or other core functions.

Make spawn player spawn them at jail position, instead of not letting them spawn at all


You should check for isSuperAdmin as well.
Any default game functions that set super admin will also set regular admin, but there's nothing to stop a badly made mod from setting only super admin
« Last Edit: May 09, 2015, 02:35:02 PM by Headcrab Zombie »