SA-MP Forums Archive
Optimize this 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)
+--- Thread: Optimize this timers (/showthread.php?tid=307195)



Optimize this timers - Face9000 - 29.12.2011

Hello guys,in OnGameModeInit i've this timers:

pawn Код:
zonetimer = SetTimer("ZoneUpdate", 2000, true);
    timer1 = SetTimer("AntiCheat",5000,true);
    SetTimer("SStats",10*60*1000,1);
   
    SetTimer("SendMSG", 60000, true);
Zonetimer is for gangwars system and runs every 2 seconds.
AntiCheat timer is obvious - Runs every 5 seconds.
SStats save all players stats every 10 minutes.
SendMsg is to send random messages on chat,runs every 60 seconds.

My question is,are they optimized or they run too fast and this will cause lag?Thanks.


Re: Optimize this timers - James Coral - 29.12.2011

mhm.... i think the ZoneUpdater can be 5sec :P
but i dont know mutch about scripting
but i learing,! and i know that the ZoneUpdate dont Updateing himself all the time!
exemple: Download SATM Rp and check there / Or from other GangWar GM!


Re: Optimize this timers - Face9000 - 29.12.2011

Quote:
Originally Posted by James Coral
Посмотреть сообщение
mhm.... i think the ZoneUpdater can be 5sec :P
but i dont know mutch about scripting
but i learing,! and i know that the ZoneUpdate dont Updateing himself all the time!
exemple: Download SATM Rp and check there / Or from other GangWar GM!
I scripted from scratch the Anticheat and Gangwars system.I was asking this questions because i don't want have lag on the server.


Re: Optimize this timers - fiki574 - 29.12.2011

I have bout 10-12 timers in my stunt GM, and server, luckily, doesnt lags!


Re: Optimize this timers - Face9000 - 29.12.2011

So it will cause no lag?


Re: Optimize this timers - Joe Staff - 29.12.2011

What you should try to do is desynchronize your timers so they don't activate simultaneously

Example:
TimerA is for every 2 seconds, TimerB is for every 5 seconds. 10 seconds in both timers will be activated at the same time ( TimerA on its fifth activation and TimerB on its second )

Also random messages every minute is too much, try every 15 minutes.