SA-MP Forums Archive
Question about Timers' - 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: Question about Timers' (/showthread.php?tid=224784)



Question about Timers' - Tomejus - 12.02.2011

Hello,

I and my friend discuss about Timers and he think that if I put all timers in one f-ion it work faster than an timer.

Example I have:
Код:
	SetTimer( "AntiJail", 20000, true );
	SetTimer( "AntiFlood", 8000, true );
	SetTimer( "AntiSpeed", 1000, true );
	SetTimer( "AntiJetPack", 1000, true );
	SetTimer( "AntiArmour", 1000, true );
	SetTimer( "AntiToggle", 1000, true );
	SetTimer( "AntiWeap", 1000, true );
	SetTimer( "AntiPing", 1000, true );
He thinks that better is use one f-ion instead of this example:
Код:
	SetTimer( "AntiCheats", 1000, true );
And put all codes into this timer f-ion. What would be better? A lot of f-ions or one f-ion with all codes. In my opinion i think that it be the same, but i'm not sure about this. So people tell me!


Re: Question about Timers' - OldDirtyBastard - 12.02.2011

I would definitly go for

pawn Код:
SetTimer( "AntiCheats", 1000, true );
Having lots of timers causes server lag.


Re: Question about Timers' - cessil - 12.02.2011

having all timers run at the exact millisecond might cause lag but if you run them a few milliseconds apart I believe it wouldn't lag.
Here's my reasoning, say you have 10 functions per player in one AC function the server has to run a MAX of 5000 within that one single AC function and that could cause some lag since the server would be waiting on that to finish, but it you broke it down to 50 milliseconds apart it would be less stressful.


Re: Question about Timers' - Tomejus - 12.02.2011

Thank you guys a lot.


Re: Question about Timers' - On_Top_Non_Stop - 12.02.2011

https://sampforum.blast.hk/showthread.php?tid=61322

VERY interesting post.