Author Topic: jail cmd need help  (Read 3753 times)

0 Members and 1 Guest are viewing this topic.

Offline SaFeeR

  • Street Thug
  • *
  • Posts: 37
  • Pawno Scripter
    • View Profile
    • PaK-ServeR Website
jail cmd need help
« on: December 26, 2011, 04:34:38 pm »
help
this cmd can use anyone
help

[pawn]else if (strcmp(cmd, "jail", true) == 0) {
 IsPlayerAdmin( playerid );
     {
     new time[256],reason[256],plr;
   tmp = strtok(cmdtext, idx),plr = FindPlayerIDFromString(tmp),time = strtok(cmdtext, idx),reason = strtok(cmdtext, idx);

       if(Jail[plr] == 1) {
       SendClientMessage(playerid,NOTACCES,"This Player Is In Jail !");
       }
       if(Jail[plr] == 0) {
      if (!strlen(tmp) || !strlen(time) || !strlen(reason)) SendClientMessage(playerid,COLOR_RED, "USAGE: /c jail [Nick] [Min] [Reason]");
      else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
      else {
            new string[256];
            SetPlayerRandomJailSpawns(plr);
            SetPlayerWeapon(plr,0,0);
            SetPlayerWeapon(plr,0,0);
            SetPlayerWeapon(plr,0,0);
            format(string,sizeof(string),"Admin %s has jailed %s for %d minutes.",gPlayers[playerid],gPlayers[plr],strval(time));
            SendClientMessageToAll(COLOR_YELLOW, string);
            format(string,sizeof(string),"Reason:[ %s ].",cmdtext[strlen(tmp)+7]);
            SendClientMessageToAll(COLOR_YELLOW, string);
            SendClientMessage(plr,COLOR_YELLOW,"You have been jailed !");
            SetTimer("unjail",(strval(time)*60000),false);
            Jail[plr] = 1;
            TogglePlayerControllable(plr,0);
      }
        }
      }
      return 1;
   }
   else if(strcmp(cmd, "unjail", true) == 0) {
   IsPlayerAdmin( playerid );
       {
       tmp = strtok(cmdtext, idx); new plr = FindPlayerIDFromString(tmp);
       if(Jail[plr] == 0) {
       SendClientMessage(playerid,NOTACCES,"This Player Is Not In Jail !");
       }
       if(Jail[plr] == 1) {
       if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED, "USAGE: /c unjail [Nick]");
       else{
           if (plr != INACTIVE_PLAYER_ID) {
               new string[256];
              format(string,sizeof(string),"Admin %s has unjailed %s!",gPlayers[playerid],gPlayers[plr]);
            SendClientMessageToAll(COLOR_YELLOW, string);
            SetPlayerPos(plr,397.688, -471.821, 11.5172,0,0);
            SendClientMessage(plr,COLOR_YELLOW,"You have been unjailed !");
            Jail[plr] = 0;
            TogglePlayerControllable(plr,1);
         }
         else SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
      }
      }
      }
      return 1;
   }[/pawn]
« Last Edit: December 26, 2011, 04:38:46 pm by SaFeeR »
If You Like My Scripting Like My Page


Offline MaDKiLLeR

  • Wiseguy
  • **
  • Posts: 51
  • Pawn / Squirrel / PHP / HTML
    • View Profile
    • Humza Khan
Re: jail cmd need help
« Reply #1 on: December 26, 2011, 04:46:57 pm »
I Don't have time to see it line by Line but here's something i made when i used Pawn ( Warchiefs, This Works Fine for me ):

[pawn]
else if (strcmp(cmd, "jail", true) == 0) {

      tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
      if (IsPlayerInfo(playerid,cmd)) return 0;
     else if (!strlen(tmp)) MessagePM(playerid, GREEN,"[Syntax]: /c jail <Nick/id> <Reason>");
      else if (plr == INACTIVE_PLAYER_ID) MessagePM(playerid, GREEN,"[Error] - Unknown player");
      else {
         MessageAllFormat(BLUE, "Admin %s jailed: [ %s ]  Reason: [ %s ]",gPlayers[ playerid ], gPlayers[ plr ], cmdtext[ strlen( tmp ) +7 ]);
         SetPlayerPos(plr,387.873, -509.743, 8.98706,0,0);
            TogglePlayerControllable(plr,0);
            SetPlayerWeapon(plr,0,0);
      }
      return 1;
[/pawn]
- [VU_R]MaDKiLLeR

~ Site | Projects | IRC ~


Offline Saif

  • Street Thug
  • *
  • Posts: 13
    • View Profile
Re: jail cmd need help
« Reply #2 on: December 26, 2011, 05:44:49 pm »
nice madkiller  :)
mere pas hy ye jail

Offline SaFeeR

  • Street Thug
  • *
  • Posts: 37
  • Pawno Scripter
    • View Profile
    • PaK-ServeR Website
Re: jail cmd need help
« Reply #3 on: December 26, 2011, 08:16:30 pm »
ok thanks
If You Like My Scripting Like My Page


Offline GANGSTER

  • Street Thug
  • *
  • Posts: 19
  • Pawno Scripter
    • View Profile
    • Gangster Warz Clan
Re: jail cmd need help
« Reply #4 on: December 27, 2011, 08:01:05 am »
Where is unjail command  ???

Offline Fuzzy168

  • VC:MP Veteran
  • *****
  • Posts: 729
  • Programming since 2011
    • View Profile
Re: jail cmd need help
« Reply #5 on: December 27, 2011, 08:16:48 am »
First, he only asked for Jail not Unjail command. Second, the script Mad gave, I was wondering how is player going to be released and why an admin not a cop???
I'm beginning to feel like a Lag God, Lag God

Offline SaFeeR

  • Street Thug
  • *
  • Posts: 37
  • Pawno Scripter
    • View Profile
    • PaK-ServeR Website
Re: jail cmd need help
« Reply #6 on: December 27, 2011, 08:56:55 am »
Where is unjail command  ???
yes where is ?
If You Like My Scripting Like My Page


Offline Fuzzy168

  • VC:MP Veteran
  • *****
  • Posts: 729
  • Programming since 2011
    • View Profile
Re: jail cmd need help
« Reply #7 on: December 27, 2011, 10:24:24 am »
Just spotted a mistake..  ;D
[pawn]SetTimer("unjail",(strval(time)*60000),false);[/pawn]
Let me be straight with you...
YOU CAN'T SET A FREAKING TIMER TO A SPECIFIC PERSON IN PAWN!!!
I'm beginning to feel like a Lag God, Lag God