SA-MP Forums Archive
All global timers stop working while longer server uptime - 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: All global timers stop working while longer server uptime (/showthread.php?tid=614193)



All global timers stop working while longer server uptime - Daveosss - 05.08.2016

Hello, I have bunch of "global" timers in my gamemode, but there's a bug that appeared few days ago. When my server is up for 5-10 hours, all the "SetTimer" timers suddenly stop, even though "SetTimerEx" timers keep on working properly. There are no warnings/errors in compiler or serverlog. Someone who knows why this happens?

Timers in OnGameModeInIt:
PHP код:
    SetTimer("afkcheck", 1000, 0);
    
SetTimer("CheckBalon", 1500, true);
    
SetTimer("ObnovaBalicku", 7200000, true);
    
SetTimer("ObnovaWantedu", 600000, true);
    
SetTimer("Pocasi", 3600000, true);
    
SetTimer("Bedny", 1800000, true);
    
SetTimer("CheckBrana", 1500, true);
    
SetTimer("CheckKartac", 150, true);
    
SetTimer("CheckMicky", 1500, true);
    
SetTimer("DespawnVehicles", 3000, true);
    
SetTimer("ExportVeh", 3600000, true);
    
SetTimer("StartExportVeh", 1500, false);
    
SetTimer("Vysilac", 30000, true);
    
SetTimer("RandomZpravy", 600000, true);
    
SetTimer("SmazaniBodcu", 300000, true);
    
SetTimer("burglarcheck", 1500, true);
    
SetTimer("UzemiCheck", 1500, true);
    
SetTimer("CheckPlane", 1500, true);
    
SetTimer("CheckTime", 1500, true);
    
SetTimer("Check82", 1500, true);
    
SetTimer("Check83", 1500, true);
    
SetTimer("CheckCar", 10000, true);
    
SetTimer("SetCas", 1000, true);
    
SetTimer("AfkKick", 1500, true);
    
SetTimer("Vezeni2", 1500, true);
    
SetTimer("Timer", 1000, true);
    
SetTimer("FlasherFunc", 200, true);
    
SetTimer("MizeniPlosin", 1500, true); 
There are few more "global" timers in my gamemode, but not different than these in OnGameModeInIt.


Re: All global timers stop working while longer server uptime - AndySedeyn - 05.08.2016

How many of them are used to loop through players? You can easily merge a few together to reduce the amount of timers.


Re: All global timers stop working while longer server uptime - Daveosss - 05.08.2016

Around 11 of them use loop, I'll try it.


Re: All global timers stop working while longer server uptime - SickAttack - 05.08.2016

Why do you need so many global timers? The timer "Timer" is very self explanatory.


Re: All global timers stop working while longer server uptime - Daveosss - 05.08.2016

Alright, I've merged most of the global timers together.

Quote:

The timer "Timer" is very self explanatory.

Well, I don't really get what this explains.


Re: All global timers stop working while longer server uptime - Vince - 05.08.2016

It's probably because all of them will at one time converge because they're all multiples of 100. If possible, use primes for timer intervals.


Re: All global timers stop working while longer server uptime - Daveosss - 05.08.2016

Quote:

It's probably because all of them will at one time converge because they're all multiples of 100. If possible, use primes for timer intervals.

Ok, thanks for advice.


Re: All global timers stop working while longer server uptime - Shinja - 05.08.2016

Many timers will cause a huge lag in the server


Re: All global timers stop working while longer server uptime - SickAttack - 05.08.2016

Quote:
Originally Posted by Daveosss
Посмотреть сообщение
Well, I don't really get what this explains.
What does "Timer" do? You're the first I've seen that calls a timer, Timer. It doesn't really explain what it does. But the real question is, why do you have so much timers? What are they all for?


Re: All global timers stop working while longer server uptime - Daveosss - 06.08.2016

Quote:

Many timers will cause a huge lag in the server

I've already decreased the number of global timers.

Quote:

What does "Timer" do? You're the first I've seen that calls a timer, Timer. It doesn't really explain what it does. But the real question is, why do you have so much timers? What are they all for?

Timer "Timer" was controling server time. I had a lot of timers, because I liked when the every single piece of code was seperated and put in its own public. Gamemode looked cleaner.

Anyway, I did everything you guys recommended to me and server is running for 7 hours without any bugged timer. Hopefully, it's going to work now. Thanks for your time (rep+)