SA-MP Forums Archive
SetTimer or SetTimerEx ?? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SetTimer or SetTimerEx ?? (/showthread.php?tid=398270)



SetTimer or SetTimerEx ?? - dud - 08.12.2012

What is better to use?

This?
Код:
SetTimerEx("Timer", 1000, true, "i", playerid);
public Timer(playerid)
{
    //code
    return 1;
}
Or This ?
Код:
SetTimer("Timer", 1000, true);
public Timer()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        // code
    }
    return 1;
}



Re: SetTimer or SetTimerEx ?? - Vince - 08.12.2012

I really don't know, to be honest. I think the first one would be the better option as it allows for more sync. Do timer stuff for a player, sync a bit, do timer stuff for another player, sync a bit, ... As opposed to: do timer stuff for everyone, sync everything.


Re: SetTimer or SetTimerEx ?? - ikey07 - 08.12.2012

Its always better to have 1 timer as loop can be executed faster then many timers, also timers is not accurate it can be 1010 or 990 milliseconds afaik, so for each player each thing will happen in different time.