Timers Problem - 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: Timers Problem (
/showthread.php?tid=642336)
Timers Problem -
Banditul18 - 28.09.2017
Recently i've got a problem with timer. On my host timers just mess up. I don't have that much timers or conde in them....I have 2 global timers and 5 per player(for usual things like mute, speed , fuel...)
When i give mute to someone(or me) for 100 seconds(example) the mutes seconds go down for what..From 100 jump at 80 then to 60 and in like 5-6 seconds you don't have mute anymore......
I kill every timer when its need (OnPlayerDisconnect or when its not used)....
What can cause this mess up?
Re: Timers Problem -
FuNkYTheGreat - 28.09.2017
Are you sure that you are created timers, like this?
And then killing it by using
On Gamemode exit?
And why bother creating player timers for fuel, speed? or even mute?
Just create a global timer, Loop through all players,
And check there whatever you want to check,
More timers = More lag.
Re: Timers Problem -
Banditul18 - 28.09.2017
Quote:
Originally Posted by FuNkYTheGreat
Are you sure that you are created timers, like this?
And then killing it by using
On Gamemode exit?
And why bother creating player timers for fuel, speed? or even mute?
Just create a global timer, Loop through all players,
And check there whatever you want to check,
More timers = More lag.
|
Yep, all timers are saved into a variabile and then killed when need to be
Not really , if the fucntion called by the timer has eficinet or less code will not cause that much lag
Re: Timers Problem -
nG Inverse - 29.09.2017
Better case; unix timestamps:
https://sampforum.blast.hk/showthread.php?tid=254915
IIRC, timers become inaccurate and buggy after some time. Don't quote me, but I believe that's why y_timers was made.
Re: Timers Problem -
coool - 30.09.2017
Quote:
Originally Posted by FuNkYTheGreat
And why bother creating player timers for fuel, speed? or even mute?
Just create a global timer, Loop through all players,
And check there whatever you want to check,
More timers = More lag.
|
Timers do not create lag whether you create 100 timers or 1 it is all same. It depends upon the code inside.