SA-MP Forums Archive
Lag - 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: Lag (/showthread.php?tid=602020)



Lag - Marshall2015 - 01.03.2016

Delay (lag) and high CPU utilization (15-20% with 30 players). What is this should, may have something to do timers?

I have these:
SetTimer ("RefreshHat", 180000, true);
SetTimer ("UpgradeOther", 300000, true);
SetTimer ("WeatherRotator" 2400000, true);
SetTimer ("OneMinuteTimer", 60000, true);
SetTimer ("TimerOfASecond", 1000, true);
SetTimer ("Timer45M" 2700000, true);
SetTimer ("TimerHalfASecond", 500, true);


The longest code (in terms of lines) timers is "TimerOfASecond." If necessary, I can go.

Help please, the lag is unbearable.


Re: Lag - CalvinC - 01.03.2016

If you have a very laggy code that runs every 1 second then that'll quickly lag your server.
Try to tone it down as much as possible, or increase the timer time.
Or just get higher specs.

Could also be your TimerHalfASecond if there's a lot of stuff in there.


Re: Lag - Marshall2015 - 01.03.2016

Thanks for answering. "TimerHalfASecond" only has the speedometer and updating of vehicles carrying gasoline. If you want, you can spend Timer code a second for you to see.


Re: Lag - CalvinC - 01.03.2016

Quote:
Originally Posted by Marshall2015
Посмотреть сообщение
Thanks for answering. "TimerHalfASecond" only has the speedometer and updating of vehicles carrying gasoline. If you want, you can spend Timer code a second for you to see.
Well you can try to comment it out on a test server and see how much it decreases lag.
You could consider putting some of the code in a longer timer though.


Re: Lag - Marshall2015 - 01.03.2016

Right now I'm doing this:

timer TimerHalfASecond[500]()

Will it improve anything? You will be charged from main - repeat TimerHalfASecond();