11.02.2013, 16:57
Variable.
Put this in Unjail cmd and under the callbacks OnPlayerSpawn,OnPlayerRequestClass and OnPlayerDeath to avoid bugs
pawn Код:
//Put it under the includes
Jailed[MAX_PLAYERS];
pawn Код:
CMD:jail(playerid, reason)
{
if(pInfo[playerid][AdminLevel] < 2) return 0;
{
SendClientMessage(playerid, COLOR_RED, "-Warning- /Jail [Playername/id] [Reason]");
return 1;
}
new id,pjailed;
if(IsPlayerNPC(id))return SendClientMessage(playerid, COLOR_RED, "-Warning- This player is an Bot.");
if(id == playerid)return SendClientMessage(playerid, COLOR_RED, "-Warning- You can't jail yourself.");
if(Jailed[playerid] == 1)return SendClientMessage(playerid, COLOR_RED, "This player is already in jail.");
new reason[128];
reason = bigstrtok(cmdtext, idx);
if(!strlen(reason)) return SendClientMessage(playerid, COLOR_RED, "-Warning- /Jail [playername/id] [Reason]",reason);
JB_Playerinfo[targetid][JB_pJailed]=180;
SetPlayerInterior(id, 6);
SetPlayerPos(targetid, 264.3700,77.5700,1001.0391);
SetPlayerFacingAngle(id, 272.6900);
TogglePlayerControllable(id, false);
ResetPlayerMoney(targetid);
Jailed[playerid] = 1;
new string[128];
format(string,sizeof(string), "-AdminInfo- Admin %s has jailed %s [Reason: %d]",pName(playerid),GetName(targetid));
SendClientMessageToAll(-1,string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "-Warning- This player isn't online.");
}
}
else SendClientMessage(id, COLOR_RED, "-Warning- You have to be level 2 for this command!");
return 1;
}
pawn Код:
//Setting back the variable to 0
Jailed[playerid] = 0;