Best way to use timers?
#2

Hello.
A lotta players does the most stupid thing ever for me..
They makes invidual timers for everything..
SetTimer("pissing"..,
SetTimer("fapfaping..
And so on..

The best thing I could recommend you is to make ONE timer which will repeat EVERY ONE SECOND.

pawn Код:
SetTimer("GlobalTimer", 1000, 0);
Now you can do a lotta thing, such as:
pawn Код:
public GlobalTimer()
{
    for(new i = 0; i != MAX_PLAYERS; i++)
    {
        if(Player[i][Jailed] > 0)
            Player[i][Jailed]--;
        if(Player[i][Jailed] == 1)
            UnjailPlayer(i);
           
        new currentTime;
        currentTime = gettime();
        if(currentTime == Player[i][VIPExpired])
            unVIP(i);
    }
   
    if(Countdown > 0)
    {
        Countdown--;
        updateCountDownTD();
    }
   
    if(Countdown == 0)
    {
        sendStartMessage();
        Countdown = -1;
    }
}
And basically - everything you want.

Any problems? Text here.

Greetz,
LetsOWN
Reply


Messages In This Thread
Best way to use timers? - by PaulDinam - 11.03.2013, 12:08
Re: Best way to use timers? - by LetsOWN[PL] - 11.03.2013, 12:14
Re: Best way to use timers? - by PaulDinam - 11.03.2013, 12:17
Re: Best way to use timers? - by Sinner - 11.03.2013, 12:22
Re: Best way to use timers? - by LetsOWN[PL] - 11.03.2013, 12:26
Re: Best way to use timers? - by mineralo - 11.03.2013, 12:28
Re: Best way to use timers? - by Sinner - 11.03.2013, 13:29

Forum Jump:


Users browsing this thread: 1 Guest(s)