SA-MP Forums Archive
Script takes lots of CPU, what is the reason? - 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: Script takes lots of CPU, what is the reason? (/showthread.php?tid=286175)



Script takes lots of CPU, what is the reason? - nescha - 27.09.2011

Hy everybody!
Why does my script takes so much CPU power?

I use following plugins: MySQL by G-Stylezzz and the streamer plugin by icognito.

I checked my strings in help with this tutorial: https://sampforum.blast.hk/showthread.php?tid=55261, i also optimize my strings.

my server allways takes a lot of cpu, when 2 or more players was over 10 minutes connected, i use an Godfather-based script. I allmost rewrite 80% of the complete script. The cpu is most over 20%, my hoster sayed that this isnt ok, otherwise he will take my server down.

Can it possibly be due to the timers? I run the followings (maybe too many?):

pawn Code:
synctimer = SetTimer("SyncUp", 60000, 1);
    othtimer = SetTimer("Timer2", 1000, 1);
    unjailtimer = SetTimer("SetPlayerUnjail", 999, 1);
    cartimer = SetTimer("CarCheck", 30000, 1);
    SetTimer("WantedGo", 1800000, 1);
    SetTimer("ShowLotto", 7200000, 1);
    checkgastimer = SetTimer("CheckGas", RunOutTime, 1);
The most of my script based on mysql. Anyone have an idea, how to fix that?

thanks.


Re: Script takes lots of CPU, what is the reason? - nescha - 27.09.2011

Ah, okay, thank you, i post the perfomance profiler - result later here. :- ) (if i didnt find the right error)