SA-MP Forums Archive
SetTimer vs 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetTimer vs SetTimerEx (/showthread.php?tid=274606)



SetTimer vs SetTimerEx - Tee - 06.08.2011

Do you think it's better to create 1 timer when the server loads (using SetTimer) and then loop through all players to save their stats or use SetTimerEx to create a timer each time they login?


Re: SetTimer vs SetTimerEx - WoodPecker - 06.08.2011

I think it will be more good if you will use one timer when the server loads.


Re: SetTimer vs SetTimerEx - Tee - 06.08.2011

That's what I'm thinking too, anyone else?


Re: SetTimer vs SetTimerEx - Jay_ - 06.08.2011

One timer, obviously. Timers are highly inefficient.


Re: SetTimer vs SetTimerEx - MadeMan - 06.08.2011

One timer, but don't save all players at a time (do it one player each time for example).


Re: SetTimer vs SetTimerEx - robanswe - 06.08.2011

Quote:
Originally Posted by Jay_
Посмотреть сообщение
One timer, obviously. Timers are highly inefficient.
Are you kidding me xD You made my day thanks So you mean it takes a lot of prepossessing power to have a timer running? Then your more then wrong. The thing that takes time to execute is the callback the timer is calling but a callback that are only ran for one player will take less time then one that loops true all connected players.

Now to the real question. of course it's better to spread out the load over a larger time period in single thread languages as pawn. So yes it's better to start one timer for every player then to start one timer with a function that loops true all the players. This gets more important on slow script like saving stats and so on.