PHP Code:
dcmd_jail(playerid,params[])
{
if(pInfo[playerid][Adminlevel] < 3) return SendClientMessage(playerid, COLOR_RED, ""ERROR_MESSAGE"");
new id, time, admin[MAX_PLAYER_NAME], JailTimer[MAX_PLAYERS], Jailed[MAX_PLAYERS];
new TargetID, reason[20];
new str1[128];
new targetname[MAX_PLAYER_NAME];
GetPlayerName(TargetID,targetname,24);
GetPlayerName(TargetID,targetname,24);
GetPlayerName(playerid, admin, sizeof(admin));
GetPlayerName(id, Jailed, sizeof(Jailed));
if(sscanf(params,"df",id,time)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /jail [playerid] [time] ");
if (!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player is not connected.");
if(Jailed[id] == 1) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player is already jailed.");
GameTextForPlayer(TargetID,"~r~Jailed By Admin", 3000, 3);
format(str1,sizeof(str1),"** JAIL: %s(%d) (ADMIN JAIL) Has Been Jailed By An Admin.", targetname, TargetID, reason);
SendClientMessageToAll(COLOR_HOTPINK, str1);
print(str1);
SetPlayerInterior(id, 3);
SetPlayerVirtualWorld(id, 10);
SetPlayerFacingAngle(id, 360.0);
SetPlayerPos(id, 197.5662, 175.4800, 1004.0);
SetPlayerHealth(id, 9999999999.0);
ResetPlayerWeapons(id);
jail[playerid] =1;
JailTimer[id] = SetTimerEx("unjail", time*60000, false, "i", id);
return 1;
}
dcmd_unjail(playerid,params[])
{
new id, admin[MAX_PLAYER_NAME], JailTimer[MAX_PLAYERS], Jailed[MAX_PLAYERS] ;
new TargetID;
GetPlayerName(playerid, admin, sizeof(admin));
GetPlayerName(id, Jailed, sizeof(Jailed));
if(pInfo[playerid][Adminlevel] < 3) return SendClientMessage(playerid, COLOR_RED, ""ERROR_MESSAGE"");
if(sscanf(params,"d",id)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /unjail <playerid>");
if (!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player is not connected.");
if(Jailed[id] == 0) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player is not jailed.");
Jailed[id] = 0;
SetPlayerInterior(id, 0);
SetPlayerVirtualWorld(id, 0);
SpawnPlayer(id);
SetPlayerHealth(id, 100);
KillTimer(JailTimer[id]);
jail[playerid] =0;
GameTextForPlayer(TargetID,"~r~Unjailed By Admin", 3000, 3);
return 1;
}