Author Topic: Halloween mod jail.  (Read 1431 times)

My halloween mod is going well, (some of you may have been on my server and seen it) but I have recently tried to add an admin command to jail people.  I copied the dm code and changed it to fit a jail theme, but it has syntax errors.
No matter what I do, I cant seem to get it to work.
Quote from: base.cs
function ServerCmdJail(%client,%target)
{
   if(!%client.isadmin) return;
   if(%target $= "")
   {
      messageClient(%client, "", "Please enter all or part of a player's name (or BL_ID)");
      return;
   }
      %target = findClientByName(%target);
      if(!isObject(%target))
      {
         messageClient(%client, "", "Player not found!");
         return;
      }
      %targetName = %target.netName;
      %targetID = %target.BL_ID;
  else It has errors here.  I have tried every combination of brackets I could think of, even without them as shown here, but it hasn't fixed the errors.

        %targetName = "BL_ID: "@%target@"";
      %targetID = %target;
      }
      {
      %client.recentlyJoined = schedule(30000, 0, "clearrecentlyJoined");

      $JMini.removeMember(%client);
      if(isobject(%client.player)) %client.player.kill();
      $DediMini.addMember(%client);
      }
      if(isFile("Add-Ons/Event_Variables/server.cs"))
      {
         %client.blockVCE[%client.BL_ID] = %client.oldblockVCE[%client.BL_ID];
         %client.oldblockVCE[%client.BL_ID] = "";
      }

      messageAll("","\c6" @ %client.netName SPC "\c4" @ "has been freed!");
      return;
   }
   
   if(!$Pref::blockCity::enableJail)
   {
      messageClient(%Client, "","Sorry, you cannot sen people to jail at this time!");
      return;
   }
   if(isEventPending(%client.recentlyJoined) &&  (!%client.isAdmin || %client.blastdownMode))
   {
      messageClient(%client, "","You must wait 30 seconds until you can rejoin the minigame.");
      return;
   }

   $DediMini.removeMember(%client);
   if(isobject(%client.player)) %client.player.kill();
   $JMini.addMember(%client);

   if(isFile("Add-Ons/Event_Variables/server.cs"))
   {
      %client.oldblockVCE[%client.BL_ID] = %client.blockVCE[%client.BL_ID];
      %client.blockVCE[%client.BL_ID] = true;
   }

   messageAll("", "\c6" @ "--------------------");
   messageAll("", "\c6" @ %client.netName SPC "\c4" @ "has put in jail by" @ %admin ".");
   messageAll("", "\c6" @ "--------------------");

   messageClient(%Client, "","\c4" @ "You were put in jail by" @ %admin ".");
}

I got permission to edit block city to make this.

with else you need something like
Code: (Example of else) [Select]
package adminClan
{
 function gameConnection::autoAdminCheck(%client)
 {
  if(%client.isAdmin == 1)
  {
   if(%client.isSuperAdmin == 1)
   {
     %client.clanPrefix=("SAdmin");
   }
   else
   {
    %client.clanPrefix=("Admin");
   }
  }
 }
};
Or something like what.


I got permission to edit block city to make this.

I dont think you need permission if you do not plan on releasing it.

I dont think you need permission if you do not plan on releasing it.
You don't need permission at all.

Quote from: base.cs
function ServerCmdJail(%client,%target)
{   
 if(!$DediMini.isMember(%client) || !%client.isSuperAdmin) {
      messageClient(%client, "", "Sorry, you are not a Super admin.");
   }
         if(!BCDB.ExistUser(%target)) //If the key exists (well it's most likley a BL_ID unless your not using BL_ID keys)
   {
      %target = findClientByName(%target);
      if(!isObject(%target))
      {
         messageClient(%client, "", "Player not found!");
         return;
      }
      %targetName = %target.netName;
      %targetID = %target.BL_ID;
   } else {
      %targetName = "BL_ID: "@%target@"";
      %targetID = %target;
   }
      
      %client.recentlyJoined = schedule(30000, 0, "clearrecentlyJoined");

      $JMini.removeMember(%client);
      if(isobject(%client.player)) %client.player.kill();
      $DediMini.addMember(%client);
   
      if(isFile("Add-Ons/Event_Variables/server.cs"))
      {
         %client.blockVCE[%client.BL_ID] = %client.oldblockVCE[%client.BL_ID];
         %client.oldblockVCE[%client.BL_ID] = "";
      }

      messageAll("","\c6" @ %client.netName SPC "\c4" @ "has been freed.");
      return;
   }
   if(!$Pref::blockCity::enableDM)
   {
      messageClient(%Client, "","Sorry, you cannot send people to jail at this time!");
      return;
   }
   if(isEventPending(%client.recentlyJoined) &&  (!%client.isAdmin || %client.blastdownMode))
   {
      messageClient(%client, "","You must wait 30 seconds until you can rejoin the minigame.");
      return;
   }

   $DediMini.removeMember(%client);
   if(isobject(%client.player)) %client.player.kill();
   $JMini.addMember(%client);

   if(isFile("Add-Ons/Event_Variables/server.cs"))
   {
      %client.oldblockVCE[%client.BL_ID] = %client.blockVCE[%client.BL_ID];
      %client.blockVCE[%client.BL_ID] = true;
   }

   messageAll("", "\c6" @ "--------------------");
   messageAll("", "\c6" @ %client.netName SPC "\c4" @ "has been put in jail.");
   messageAll("", "\c6" @ "--------------------");

   messageClient(%Client, "","\c4" @ "You have been put in jail.");

function ServerCmdFree(%client,%target)
{
   if(!%client.isadmin) return;
   if(%target $= "")
   if(%target $= %client)
   {
      messageClient(%client, "", "Please enter all or part of a player's name (or BL_ID)");
      return;
   }
      $JMini.removeMember(%client);
}
Redid it and it works!  I'm testing it on my server now.

It looks it's going to jail the person who uses the command instead of who they use it on. That doesn't seem like a particularly good justice system.  It also doesn't seem to put the person back in $DediMini upon freeing them.

It looks it's going to jail the person who uses the command instead of who they use it on. That doesn't seem like a particularly good justice system.  It also doesn't seem to put the person back in $DediMini upon freeing them.
In Soviet Russia, victim jails admin


It also doesn't seem to put the person back in $DediMini upon freeing them.
That's why they were cursed to not being in the minigame until they rejoined the server!  Thank you, I never noticed that.
That would be why I respawned when I jailed people...
Code: [Select]
$JMini.removeMember(%target);
if(isobject(%target.player)) %target.player.kill();
$DediMini.addMember(%client);
I changed it to %target.

I redid the script with %target instead of %client.  It still has the problem.
« Last Edit: October 17, 2009, 01:03:54 PM by LaCuckooRacha »

Post the current ersion. It makes it easier to pinpoint problems when we don't hae to sift through the ones we've supposedly soled.

Quote from: base.cs
function ServerCmdJail(%client,%target)
{   
 if(!%client.isSuperAdmin) {
      messageClient(%client, "", "Sorry, you are not a Super admin.");
   }
   if(!BCDB.ExistUser(%target)) //If the key exists (well it's most likley a BL_ID unless your not using BL_ID keys)
   {
      %target = findClientByName(%target);
      if(!isObject(%target))
      {
         messageClient(%client, "", "Player not found!");
         return;
      }
      %targetName = %target.netName;
      %targetID = %target.BL_ID;
   } else {
      %targetName = "BL_ID: "@%target@"";
      %targetID = %target;
         }
      
      %target.recentlyJoined = schedule(30000, 0, "clearrecentlyJoined");

      $JMini.removeMember(%target);
      if(isobject(%target.player)) %target.player.kill();
      $DediMini.addMember(%target);
   
      if(isFile("Add-Ons/Event_Variables/server.cs"))
      {
         %client.blockVCE[%target.BL_ID] = %client.oldblockVCE[%target.BL_ID];
         %client.oldblockVCE[%target.BL_ID] = "";
      }

      messageAll("","\c6" @ %target.netName SPC "\c4" @ "has been freed.");
      return;
   }
   if(!$Pref::blockCity::enableDM)
   {
      messageClient(%Client, "","Sorry, you cannot send people to jail at this time!");
      return;
   }
   if(isEventPending(%target.recentlyJoined) &&  (!%client.isAdmin || %client.blastdownMode))
   {
      messageClient(%client, "","You must wait 30 seconds until you can rejoin the minigame.");
      return;
   }

   $DediMini.removeMember(%target);
   if(isobject(%target.player)) %target.player.kill();
   $JMini.addMember(%target);

   if(isFile("Add-Ons/Event_Variables/server.cs"))
   {
      %client.oldblockVCE[%target.BL_ID] = %client.blockVCE[%target.BL_ID];
      %client.blockVCE[%target.BL_ID] = true;
   }

   messageAll("", "\c6" @ "--------------------");
   messageAll("", "\c6" @ %target.netName SPC "\c4" @ "has been put in jail.");
   messageAll("", "\c6" @ "--------------------");

   messageClient(%target, "","\c4" @ "You have been put in jail.");


It still "frees" them, but they join the mini I believe, since they can't pick up weapons from the dedimini.
« Last Edit: October 21, 2009, 02:26:25 AM by LaCuckooRacha »

It looks like it will let non-admins use it. It will tell them they aren't an admin, then will do it anyway.

It also looks like part of the free function was thrown into the jail function, and at the same time, parts of the free function are missing.

It looks like it will let non-admins use it. It will tell them they aren't an admin, then will do it anyway.

It also looks like part of the free function was thrown into the jail function, and at the same time, parts of the free function are missing.
It turned out I didn't need the free function, just to say "jail -------" a second time.
Code: [Select]
if(!%client.isSuperAdmin) {
messageClient(%client, "", "Sorry, you are not a Super admin.");
}
It seems fine to me...


It turned out I didn't need the free function, just to say "jail -------" a second time.
Code: [Select]
if(!%client.isSuperAdmin) {
messageClient(%client, "", "Sorry, you are not a Super admin.");
}
It seems fine to me...
First of all, you aren't checking to see if they are jiled or not jailed before deciding what to do with them. It basically frees them, then quietly puts them back in jail.

Second of all, no, that if statement doesn't halt the function. It will send them a message, then continue with the function normally. If you think it is fine, feel free to leave it that way and see what happens.

First of all, you aren't checking to see if they are jiled or not jailed before deciding what to do with them. It basically frees them, then quietly puts them back in jail.

Second of all, no, that if statement doesn't halt the function. It will send them a message, then continue with the function normally. If you think it is fine, feel free to leave it that way and see what happens.
Quote from: base.cs
function ServerCmdJail(%client,%target)
{   
      if(!BCDB.ExistUser(%target)) //If the key exists (well it's most likley a BL_ID unless your not using BL_ID keys)
   {
      %target = findClientByName(%target);
      if(!isObject(%target))
      {
         messageClient(%client, "", "Player not found!");
         return;
      }
      %targetName = %target.netName;
      %targetID = %target.BL_ID;
   } else {
      %targetName = "BL_ID: "@%target@"";
      %targetID = %target;
         }
   
   if($JMini.isMember(%target))
   {
         %client.recentlyJoined = schedule(30000, 0, "clearrecentlyJoined");

      $JMini.removeMember(%target);
      if(isobject(%target.player)) %target.player.kill();
      $DediMini.addMember(%target);
   
      if(isFile("Add-Ons/Event_Variables/server.cs"))
      {
         %target.blockVCE[%target.BL_ID] = %target.oldblockVCE[%target.BL_ID];
         %target.oldblockVCE[%target.BL_ID] = "";
      }

      messageAll("","\c6" @ %target.netName SPC "\c4" @ "has been freed.");
      return;
   }
}
   if(!$Pref::blockCity::enableDM)
   {
      messageClient(%Client, "","Sorry, you cannot send people to jail at this time!");
      return;
   }
   if(isEventPending(%target.recentlyJoined) &&  (!%client.isAdmin || %client.blastdownMode))
   {
      messageClient(%client, "","You must wait 30 seconds until you can jail people.");
      return;
   }

   $DediMini.removeMember(%target);
   if(isobject(%target.player)) %target.player.kill();
   $JMini.addMember(%target);

   if(isFile("Add-Ons/Event_Variables/server.cs"))
   {
      %target.oldblockVCE[%target.BL_ID] = %target.blockVCE[%target.BL_ID];
      %target.blockVCE[%target.BL_ID] = true;
   }

   messageAll("", "\c6" @ "--------------------");
   messageAll("", "\c6" @ %target.netName SPC "\c4" @ "has been put in jail.");
   messageAll("", "\c6" @ "--------------------");

   messageClient(%target, "","\c4" @ "You have been put in jail.");

It still wont work.  Also, Jetz, if you would just tell me how to fix it instead of just pointing out my mistakes, I could fix it faster.