31.03.2012, 16:59
JAIL CMD:
Top of script:
Top of script:
pawn Код:
new LastPos[2];
pawn Код:
CMD:jail(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
new targetid, minutes;
if(sscanf(params, "ui", targetid, minutes)) return SendClientMessage(playerid, COLOR_RED,"Usage: /jail <playerid> <minutes>");
if(minutes <= 0 || minutes > 60) return SendClientMessage(playerid, COLOR_RED, "Minutes can't be less than 0 or more than 60!");
//if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "You can't jail yourself!");
//if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_RED, "You can't jail higher level admins!");
if(!IsPlayerConnected(targetid))
return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected!");
else
{
new str[128];
format(str, sizeof(str), "Administrator %s has jailed %s for %d minutes!", Name(playerid), Name(targetid), minutes);
new Float: pX, Float: pY, Float: pZ;
GetPlayerPos(playerid, pX, pY, pZ);
LastPos[0] = pX;
LastPos[1] = pY;
LastPos[2] = pZ;
SendClientMessageToAll(COLOR_LIGHTBLUE,str);
JailTimer[targetid] = SetTimer("Unjail", minutes*60*1000, false);
SetPlayerPos(targetid, 264.4176, 77.8930, 1001.0391);
SetPlayerInterior(targetid, 6);
inJail[targetid] = true;
GameTextForPlayer(targetid, "~p~JAILED", 10000, 6);
PlayerPlaySound(targetid,1057,0.0,0.0,0.0);
}
}
else return SendClientMessage(playerid, COLOR_RED, "You have to be level 4 to use this command!");
return 1;
}
pawn Код:
forward Unjail(playerid);
public Unjail(playerid)
{
SetPlayerPos(playerid, LastPos[0], LastPos[1], LastPos[2]);
SetPlayerInterior(playerid, 0);
inJail[playerid] = false;
KillTimer(JailTimer[playerid]);
GameTextForPlayer(playerid, "~g~Unjailed", 5000, 6);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}