/unjail command doesn't kill jailtimer
#2

Try this
pawn Код:
new UnjailTimer[MAX_PLAYERS];
CMD:jail(playerid, params[])
{
 if (PlayerInfo[playerid][pAdmin] >= 4)
    {
        new targetid, name[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME], reason[128], time, string[128];
        if(sscanf(params, "uds[128]", targetid, time, reason)) return SendClientMessage(playerid, COLOR_YELLOW, "Correct Usage: /jail [playerid] [jailtime in minutes] [reason]");
        if(time >= 10 || time < 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: minimum amount of time is 1 minute, maximum amount of time is 10 minutes");
        if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: invalid playerid");
        SetPlayerPos(targetid, 197.6661,173.8179,1003.0234);
        PlayerInfo[targetid][Jailed] = true;
        SetPlayerInterior(targetid, 3);
        GetPlayerName(playerid, name, sizeof(name));
        new Minutes = time*1000*60;
        GetPlayerName(targetid, tname, sizeof(tname));
        format(string, sizeof(string), "ADMIN-JAIL: %s has been jailed by %s for %d Minutes(Reason: %s)", tname, name, time, reason);
        SendClientMessageToAll(COLOR_PURPLE, string);
        UnjailTimer[targetid] = SetTimerEx("UnjailPlayer",Minutes,0,"d",targetid);
    }
    else return SendClientMessage(playerid, COLOR_RED, "ERROR: you need to be atleast Admin Level 1 to use this command");
 return 1;
}
forward UnjailPlayer(targetid);
public UnjailPlayer(targetid)
{
    if(PlayerInfo[targetid][Jailed] == false) return 1;
    if(PlayerInfo[targetid][Jailed] == true)
    {
        SpawnPlayer(targetid);
        new tname[MAX_PLAYER_NAME], string[128];
        GetPlayerName(targetid, tname, sizeof(tname));
        format(string, sizeof(string), "SERVER-UNJAIL: %s has been automatically unjailed", tname);
        SendClientMessageToAll(COLOR_PURPLE, string);
        KillTimer(UnjailTimer[targetid]);
        PlayerInfo[targetid][Jailed] = false;
    }
    return 1;
}
Reply


Messages In This Thread
/unjail command doesn't kill jailtimer - by HurtLocker - 26.03.2013, 18:19
Re: /unjail command doesn't kill jailtimer - by nonamebla - 26.03.2013, 18:21
Re: /unjail command doesn't kill jailtimer - by HurtLocker - 26.03.2013, 18:24
Re: /unjail command doesn't kill jailtimer - by nonamebla - 26.03.2013, 18:25
Re: /unjail command doesn't kill jailtimer - by YoYo123 - 26.03.2013, 18:33
Re: /unjail command doesn't kill jailtimer - by HurtLocker - 26.03.2013, 18:44
Re: /unjail command doesn't kill jailtimer - by Nivniv2 - 26.03.2013, 19:45

Forum Jump:


Users browsing this thread: 2 Guest(s)