03.01.2015, 19:43
How to make when i jail someone for 2 min and he left the server and come back again to put him again in jail for 2 min?
enum pInfo { pPass, pAdmin, pVIP, pKills, pDeaths, pJailed, pMuted, pCash, pScore, pBanned, pFightStyle, pLoggedIn, pStreamer };
CMD:jail(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 2) { new giveplayerid, reason[50], minutes, pname1[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME]; if(sscanf(params, "uds[50]", giveplayerid, minutes, reason)) return SendClientMessage(playerid, WHITE, "USAGE: /jail [playerid/name] [time in minutes] [reason]"); if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "Player not connected."); if(PlayerInfo[giveplayerid][pAdmin] >= 5) { SendClientMessage(playerid, RED, "You cannot jail 5 level admin!"); } else { GetPlayerName(playerid, pname1, sizeof(pname1)); GetPlayerName(giveplayerid, pname2, sizeof(pname2)); new str[250]; SetPlayerVirtualWorld(giveplayerid, 0); SetPlayerPos(giveplayerid, 2055.0920, 2432.3054, 171.6713); SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_CUFFED); PlayerInfo[giveplayerid][pJailed] = 1; format(str, sizeof(str), "ADMIN: %s jailed player %s for %d min. Reason: %s", pname1, pname2, minutes, reason); SendClientMessageToAll(RED, str); jtimer = SetTimerEx("Jailed", minutes*1000*60, false, "i", giveplayerid); } } else return SendClientMessage(playerid, RED, "You are not a admin!"); return 1; }
if(PlayerInfo[playerid][pJailed] == 0) { PlayerInfo[playerid][pJailed] = 0; KillTimer(jtimer); }
CMD:unjail(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 2) { new giveplayerid, string[120]; if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, WHITE, "USAGE: /unjail [playerid/name]"); if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "Player not connected."); new pname1[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname1, sizeof(pname1)); GetPlayerName(giveplayerid, pname2, sizeof(pname2)); format(string, sizeof(string), "ADMIN: %s unjailed player %s.", pname1, pname2); SendClientMessageToAll(GREEN, string); KillTimer(jtimer); SpawnPlayer(giveplayerid); } else return SendClientMessage(playerid, RED, "You are not a admin!"); return 1; }
public Jailed(giveplayerid) { SetPlayerVirtualWorld(giveplayerid, 0); SpawnPlayer(giveplayerid); SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_NONE); KillTimer(jtimer); PlayerInfo[giveplayerid][pJailed] = 0; return 1; }
public Jailed(giveplayerid) { SetPlayerVirtualWorld(giveplayerid, 0); SpawnPlayer(giveplayerid); SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_NONE); KillTimer(jtimer); PlayerInfo[giveplayerid][pJailed] = 1; return 1; }