01.07.2016, 05:49
try this
PHP код:
new playertimer[MAX_PLAYERS];
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(playertimer[playerid]);
return 1;
}
forward AjailCount(playerid);
public AjailCount(playerid)
{
if(pInfo[playerid][pJailTime] != 0)
{
pInfo[playerid][pJailTime]--;
if(pInfo[playerid][pJailTime] == 0)
{
new randSpawn = random(sizeof(randomSpawns_DayZSA_Part1));
SetPlayerPos_Allow(playerid,randomSpawns_DayZSA_Part1[randSpawn][0],randomSpawns_DayZSA_Part1[randSpawn][1],randomSpawns_DayZSA_Part1[randSpawn][2]);
SetPlayerInterior(playerid, 0);//You can change interior
SetPlayerVirtualWorld(playerid, 0); //You can change virtual world
}
}
return 1;
}
CMD:ajail(playerid, params[])
{
new targetid, time, reason[64];
new string[128], adminname[64], targetname[64];
if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not Admin");
if(sscanf(params, "uis[64]", targetid, time, reason)) return SendClientMessage(playerid, -1, "USAGE: /ajail <playerid> <time> <reason>");
if(time == 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Minimum 1 minute !");
GetPlayerName(targetid, targetname, MAX_PLAYER_NAME);
GetPlayerName(playerid, adminname, MAX_PLAYER_NAME);
SetPlayerPos(targetid, 346.870025, 309.259033, 999.155700);
SetPlayerVirtualWorld(targetid, 2);
SetPlayerInterior(targetid,6);
pInfo[targetid][pJailTime] = time;
format(string, sizeof(string), "Administrator %s ajailed %s, reason: %s", adminname, targetname, reason);
SendClientMessageToAll(COLOR_RED, string);
playertimer[targetid] = SetTimerEx("AjailCount", 1000, 1, "i", playerid);
return 1;
}