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 !
Nice work!! :D
Greetings ;)
thanx ;D
huh that is soo easy well its [Fine for newbies] !
This is so easy man . when i saw topic jail system i thought of the argonath type jail system
Ss just beginning :D
Same Man If ur beggining You will be pro within days Best Of Luck
;) ;)
a question. where is the first code? sorry but I am beginner in PAWN: P
Jail and Unjail is the Commands for jailed or unjailed player
cool!
Thanx XD
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);
}