Jail timer, which is the best way?
#2

pawn Код:
new JailTime[MAX_PLAYERS];
OnGameModeInit:
pawn Код:
SetTimer("JailTimer", 1000, true);
pawn Код:
forward JailTimer();
public JailTimer()
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(JailTime[i] > 0)
            {
                JailTime[i]--;
                if(JailTime[i] == 0)
                {
                    // release player from jail
                }
            }
        }
    }
}
When you set player to jail, do
pawn Код:
JailTime[playerid] = 3600;
this will set player jail time to 3600 seconds (1 hour).

Save JailTime[playerid] with dini.
Reply


Messages In This Thread
Jail timer, which is the best way? - by Ihsan-Cingisiz - 30.12.2010, 14:35
Re: Jail timer, which is the best way? - by MadeMan - 30.12.2010, 14:45
Re: Jail timer, which is the best way? - by Ihsan-Cingisiz - 30.12.2010, 15:38
Re: Jail timer, which is the best way? - by Tessar - 30.12.2010, 15:49
Re: Jail timer, which is the best way? - by Ihsan-Cingisiz - 30.12.2010, 15:58
Re: Jail timer, which is the best way? - by MadeMan - 30.12.2010, 16:53

Forum Jump:


Users browsing this thread: 4 Guest(s)