Код:
CMD:jail(playerid,params[])
{
if(pInfo[playerid][Adminlevel] < 2)return SendClientMessage(playerid, 0xFF0000FF, "You are not authorised to use this command");
new id,time,reason[100],plname[MAX_PLAYER_NAME],GPlayerName[MAX_PLAYER_NAME], szString[128];
if(sscanf(params,"dds",id,time,reason)) return SendClientMessage(playerid, -1, "USAGE: /jail <playerid> <time> <reason>");
if(Jailed[id] == 1) return SendClientMessage(playerid, 0x8B0000FF, "ERROR: Player is already jailed.");
GetPlayerName(id, plname, sizeof(plname));
GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName));
format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", plname, id, time, reason);
SendClientMessageToAll(0x5F9EA0FF, szString);
SetPlayerInterior(id, 3);
SetPlayerVirtualWorld(id, 10);
SetPlayerFacingAngle(id, 360.0);
SetPlayerPos(id, 197.5662, 175.4800, 1004.0);
SetPlayerHealth(id, 9999999999.0);
ResetPlayerWeapons(id);
Jailed[id] = 1;
JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id);
return 1;
}
CMD:unjail(playerid,params[])
{
if(pInfo[playerid][Adminlevel] < 2)return SendClientMessage(playerid, 0xFF0000FF, "You are not authorised to use this command");
new id;
if(sscanf(params,"u",id)) return SendClientMessage(playerid, COLOR_BLUE, "USAGE: /unjail <playerid>");//sscanf routine
if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected.");//checks if the targetid is connected
if(Jailed[id] == 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not jailed.");//checks if the id is jailed and if he isnt it will send an error.
Jailed[id] = 0;
SetPlayerInterior(id, 0);
SetPlayerVirtualWorld(id, 0);
SpawnPlayer(id);
SetPlayerHealth(id, 100);
KillTimer(JailTimer[id]);
return 1;
}