Vice City Multiplayer

VC:MP => mIRC/pawn Scripting => ShowRoom (pawn) => Topic started by: sseebbyy on March 17, 2011, 10:22:31 PM

Title: Simple Jail System By Moby (me) !
Post by: sseebbyy on March 17, 2011, 10:22:31 PM
SIMPLE JAIL SYSTEM


This is Include ! By [RBS]Moby (me) !

Commands: /c jail [Nick/ID] , /c unjail [Nick/ID] => Commands for rcon admins !

Type on your gm top this:

new Jail[MAX_PLAYERS];

Now, add Commands !

Jail Command:


else if (strcmp(cmd, "jail", true) == 0) {
   if(IsPlayerAdmin(playerid))
   {
   new plr = FindPlayerIDFromString(tmp);
   if(Jail[plr] == 1) {
   SendClientMessage(playerid,COLOR_RED,"This Player Is In Jail !");
   }
   if(Jail[plr] == 0) {
tmp = strtok(cmdtext, idx);
if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED, "USAGE: /c jail [Nick/ID]");
else {
new string[256];
    if (plr != INACTIVE_PLAYER_ID) {
SetPlayerPos(plr,387.873, -509.743, 8.98706,0,0);
SetPlayerWeapon(plr,0,0);
SetPlayerWeapon(plr,0,0);
SetPlayerWeapon(plr,0,0);
TogglePlayerControllable(plr,0);
RemovePlayerMarker(plr);
format(string,sizeof(string),"Admin %s has jailed %s",gPlayers[playerid],gPlayers[plr]);
SendClientMessageToAll(COLOR_YELLOW, string);
SendClientMessage(plr,COLOR_YELLOW,"You have been jailed!");
                               SendClientMessage(plr,COLOR_YELLOW,"[Jail System By [RBS]Moby]");
Jail[plr] = 1;
}
else SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
}
}
}else{
SendClientMessage(playerid,COLOR_RED,"***Not have permission to use this command!");
}
return 1;
}


And UnJail Command :

else if(strcmp(cmd, "unjail", true) == 0) {
   if(IsPlayerAdmin(playerid))
   {
   tmp = strtok(cmdtext, idx);
   new plr = FindPlayerIDFromString(tmp);
   if(Jail[plr] == 0) {
   SendClientMessage(playerid,COLOR_RED,"This Player Is Not In Jail !");
   }
   if(Jail[plr] == 1) {
   if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED, "USAGE: /c unjail [Nick/ID]");
   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);
TogglePlayerControllable(plr,1);
SetPlayerMarker(plr,1);
SendClientMessage(plr,COLOR_YELLOW,"You have been unjailed!");
                               SendClientMessage(plr,COLOR_YELLOW,"[Jail System By [RBS]Moby]");
Jail[plr] = 0;
}
else SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
}
}
}else{
SendClientMessage(playerid,COLOR_RED,"***Not have permission to use this command!");
}
return 1;
}



Finish !



Title: Re: Simple Jail System !
Post by: Madara on March 18, 2011, 02:36:41 AM
Nice work!! :D
Greetings ;)
Title: Re: Simple Jail System !
Post by: sseebbyy on March 18, 2011, 07:36:11 AM
thanx  ;D
Title: Re: Jail System By Moby (me) !
Post by: BIG[H] on March 18, 2011, 09:06:53 AM
huh that is soo easy well its [Fine for newbies] !
Title: Re: Jail System By Moby (me) !
Post by: yazeen on March 18, 2011, 09:17:54 AM
This is so easy man . when i saw topic jail system i thought of the argonath type jail system
Title: Re: Jail System By Moby (me) !
Post by: sseebbyy on March 18, 2011, 10:17:26 AM
Ss just beginning  :D
Title: Re: Simple Jail System By Moby (me) !
Post by: yazeen on March 18, 2011, 12:56:26 PM
Same Man If ur beggining You will be pro within days Best Of Luck

;) ;)
Title: Re: Simple Jail System By Moby (me) !
Post by: DRACULA346 on April 04, 2011, 01:34:31 PM
a question. where is the first code? sorry but I am beginner in PAWN: P
Title: Re: Simple Jail System By Moby (me) !
Post by: sseebbyy on April 05, 2011, 08:55:09 AM
Jail and Unjail is the Commands for jailed or unjailed player

Title: Re: Simple Jail System By Moby (me) !
Post by: tato on April 06, 2011, 02:57:31 AM
cool!
Title: Re: Simple Jail System By Moby (me) !
Post by: sseebbyy on April 06, 2011, 07:47:00 AM
Thanx XD
Title: Re: Simple Jail System By Moby (me) !
Post by: Robd on April 06, 2011, 06:46:45 PM
For argo jail system
enum pInfo
{
   jail,
   cop
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayers[MAX_PLAYERS][MAX_PLAYER_NAME+1];


OnPlayerConnect(playerid)
{
   GetPlayerName(playerid,gPlayers[playerid],MAX_PLAYER_NAME);
}

OnPlayerCommandText(playerid,cmdtext[])
{
   new cmd[256],tmp[256],idx;
   cmd = strtok(cmdtext,idx);
   if (strcmp(cmd, "cop", true) == 0) {
       if(PlayerInfo[playerid][jail] != 0) SendClientMessage(playerid,COLOR,"You cannot become a cop from jail");
       else {
            new szMsg[256];
            format(szMsg,sizeof(szMsg),"%s has joined VCPD",gPlayers[playerid]);
             SendClientMessageToAll(COLOR_GREEN,szMsg);
            PlayerInfo[playerid][cop] = 1;
       }
       return 1;
   }
   else if (strcmp(cmd, "jail", true) == 0) {
       tmp = strtok(cmdtext,idx);
       new plr;
       plr = FindPlayerIDFromString(tmp);
       if(!strlen(tmp)) SendClientMessage(playerid,COLOR_GREEN,"Use /c jail <Nick/ID>");
       else if(plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR,"Unknown player");
       else if(PlayerInfop[playerid][cop] != 1) SendClientMessage(playerid,COLOR_GREEN,"Only cops can jail");
       else {
           PlayerInfo[plr][jail] = 1;
           SendClientMessage(plr,COLOR_GREEN,"You have been jailed");
       }
       return 1;
   }
   else if (strcmp(cmd, "unjail", true) == 0) {
       tmp = strtok(cmdtext,idx);
       new plr;
       plr = FindPlayerIDFromString(tmp);
       if(!strlen(tmp)) SendClientMessage(playerid,COLOR_GREEN,"Use /c jail <Nick/ID>");
       else if(plr == INACTIVE_PLAYER_ID) SendClientMEssage(playerid,COLOR,"Unknown player");
       else if(PlayerInfo[playerid][cop] != 1) SendClientMessage(playerid,COLOR_GREEN,"Only cops can unjail");
       else {
           PlayerInfo[plr][jail] = 0;
           SendClientMessage(plr,COLOR_GREEN,"You have been unjailed");
       }
       return 1;
}


OnGameModInit()
{
   SetTimer(jailsystem,1000,true);
}



public jailsystem()
{
   for(new i = 0; i <= MAX_PLAYERS; i++) {
       if(IsPlayerConnected(i) == 1 && GetDistance(playerid,387.45043945,-504.51019287,9.39638042) > 5 && PlayerInfo[playerid][jail] == 1) SetPlayerPos(i,387.45043945,-504.51019287,9.39638042,0,0);
}