PHP код:
CMD:jail(playerid,params[])
{
if(pInfo[playerid][pAdminLevel] >= 1)
{
new reason[100];
if(sscanf(params, "uis[100]", params[0], params[1], reason))
return SendClientMessage(playerid, -1, "*"COL_WHITE" /jail [playerid] [time] [reason]");
if(!IsPlayerConnected(params[0]) && params[0] == INVALID_PLAYER_ID)
return SendClientMessage(playerid, -1,"*"COL_RED" Player is not connected.");
if(Jailed[params[0]] == 1)
return SendClientMessage(playerid, -1, "*"COL_RED" Player is already jailed.");
new name1[24], name2[24];
GetPlayerName(params[0], name1, sizeof(name1));
GetPlayerName(playerid, name2, sizeof(name2));
format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", name1, params[0], params[1], reason);
SendClientMessageToAll(-1, szString);
Jailed[params[0]] = 1;
ResetPlayerWeapons(params[0]);
SetPlayerInterior(params[0], 3);
SetPlayerVirtualWorld(params[0], 10);
SetPlayerFacingAngle(params[0], 360.0);
SetPlayerPos(params[0], 197.5662, 175.4800, 1004.0);
SetPlayerHealth(params[0], 9999999999.00);
JailTimer[params[0]] = SetTimerEx("Unjail", params[1]*60*1000, false, "i", params[0]);
}
return true;
}
CMD:unjail(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] >= 1)
{
if(sscanf(params, "u", params[0]))
return SendClientMessage(playerid, -1, "*"COL_WHITE" /unjail [playerid]");
if(!IsPlayerConnected(params[0]) && params[0] == INVALID_PLAYER_ID)
return SendClientMessage(playerid, -1, "*"COL_RED" Player is not connected.");
if(Jailed[params[0]] == 0)
return SendClientMessage(playerid, -1, "*"COL_RED" Player is not jailed.");
SetPlayerInterior(params[0], 0);
SetPlayerVirtualWorld(params[0], 0);
SpawnPlayer(params[0]);
SetPlayerHealth(params[0], 100);
KillTimer(JailTimer[params[0]]);
Jailed[params[0]] = 0;
}
return true;
}
forward Unjail(playerid);
public Unjail(playerid)
{
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SpawnPlayer(playerid);
SetPlayerHealth(playerid, 100);
Jailed[playerid] = 0;
return true;
}