04.06.2017, 00:49
pawn Код:
CMD:jail(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid,0xFFFFFFFF,"");
new targetid, time, reason[256];
if(sscanf(params,"uis[50]", targetid, time, reason)) return SendClientMessage(playerid, 0xFFFFFFFF, "");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,0xFFFFFFFF,"");
if(PlayerInfo[playerid][pAdmin] < 6 && PlayerInfo[targetid][pAdmin] == 6) return SendClientMessage(playerid,0xFFFFFFFF,"");
new string[128];
format(string, sizeof(string), "",GetName(playerid), GetName(targetid), time);
SendClientMessageToAll(0xCC000022, string);
format(string, sizeof(string), "", reason);
SendClientMessageToAll(0xCC000022, string);
SetPlayerInterior(targetid, 6);
SetPlayerPos(targetid,264.1800,77.5989,1001.0391);
PlayerInfo[targetid][pJailed] = 1;
PlayerInfo[targetid][pJailedTime] = time + 1;
KillTimer(JailTime[targetid]);
JailTime[targetid] = SetTimerEx("UpdateJailTime",1000,true,"d",targetid);
return 1;
}
forward UpdateJailTime(playerid);
public UpdateJailTime(playerid)
{
if(!IsPlayerConnected(playerid))
{
KillTimer(JailTime[playerid]);
return 0;
}
if(--PlayerInfo[playerid][pJailedTime] < 1)
{
KillTimer(JailTime[playerid]);
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid,1552.5085,-1675.7572,16.1953);
GameTextForPlayer(playerid, "~w~BlahBlah~r~!", 3000, 6);
PlayerInfo[playerid][pJailed] = 0;
PlayerInfo[playerid][pJailedTime] = 0;
return 1;
}
new str[20];
format(str,sizeof(str),"~r~%d",PlayerInfo[playerid][pJailedTime]);
GameTextForPlayer(playerid,str,1200,1);
return 0;
}