Question about Timers'
#1

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!
Reply
#2

I would definitly go for

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

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.
Reply
#4

Thank you guys a lot.
Reply
#5

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

VERY interesting post.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)