Код:
CMD:ajail(playerid, params[])
{
new id, time, reason[24];
if(pAdmin[playerid] < 1) return 0;
if(sscanf(params, "uis[21]", id, time, reason)) return SendClientMessage(playerid, -1, "{0008F7}USAGE: {FFFFFF}/AJAIL ID MINUTES REASON");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xCD0000FF, "Player is not connected");
RemovePlayerFromVehicle(id);
ResetPlayerWeapons(id);
format(str,sizeof(str),"Administrator %s have jailed %s for %d Minute. Reason: ''%s''",name,PName,time,reason);
SendClientMessageToAll(-1, str);
SetPlayerPos(id, 264.8763, 77.8042, 1001.0391);
SetPlayerInterior(id, 6);
Jailed[id] = 1;
counter[id] = time * 60;
countt[id] = SetTimerEx("Count", 1000, true, "id", id, counter[id]);
return 1;
}
Код:
forward Count(playerid, time);
public Count(playerid, time)
{
new string[55];
time[playerid]--;
format(string, sizeof(string),"~b~%d Second remaining", time[playerid]);
GameTextForPlayer(playerid, string, 990, 3);
if(time[playerid] <= 0)
{
format( string, sizeof(string), "~g~Released from jail");
GameTextForPlayer(playerid, string, 990, 3);
KillTimer(countt[playerid]);
Jailed[playerid] = 0;
SpawnPlayer(playerid);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
new Float: PPos[3];
GetPlayerPos(playerid, PPos[0], PPos[1], PPos[2]);
PlayerPlaySound(playerid, 1058, PPos[0], PPos[1], PPos[2]);
}
return 1;
}