13.05.2014, 19:41
how to make jail system with countdown?
CMD:jail(playerid, params[])
{
if(PlayerInfo[playerid][pAdminLevel] == 0) return SendClientMessage(playerid,-1,"You are not admin to use this command!");
new targetid, minutes,id,reason;
if(sscanf(params, "ris[30]", targetid, minutes)) return SendClientMessage(playerid, -1,"[System Usage]: /jail [playerid] [minutes] [reason]");
if(minutes <= 0 || minutes > 60) return SendClientMessage(playerid, -1, "Minutes can't be less than 0 or more than 60!");
new str[300];
format(str, sizeof(str), "{00FFE5}Jail |{FFFFFF} Administrator %s has jailed %s for %d |{00FFE5} reason : %s", GetPlayerNameEx(playerid), GetPlayerNameEx(id), minutes,reason);
SendClientMessageToAll(-1,str);
JailTimer[targetid] = SetTimer("Unjail", minutes*60*1000, false);
SetPlayerPos(targetid, 264.4176, 77.8930, 1001.0391);
SetPlayerInterior(playerid, 6);
inJail[targetid] = true;
GameTextForPlayer(playerid, "~p~JAILED", 10000, 6);
PlayerPlaySound(targetid,1057,0.0,0.0,0.0);
return 1;
}
forward Unjail(playerid);
public Unjail(playerid)
{
SpawnPlayer(playerid);
SetPlayerInterior(playerid, 0);
inJail[playerid] = false;
KillTimer(JailTimer[playerid]);
GameTextForPlayer(playerid, "~g~Unjailed", 5000, 6);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
pawn Код:
|