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



OnPlayerUpdate Delay? - Matz - 26.10.2012

Does anyone know how much ms is that callback?


Re: OnPlayerUpdate Delay? - Abhishek. - 26.10.2012

what how much is that callback?
you mean how many times is it called? then its called every second while you do a action.or it could be when you chage your state i mean driveing spectating etc... dont know perfectly sorry.


Re: OnPlayerUpdate Delay? - jessejanssen - 26.10.2012

As far as I know, it gets called at about every second if you're standing still and doing nothing and if you move ( Drive, run, whatever. ) it gets called many more times, not exactly sure how much times though.

Best regards,
Jesse


Re: OnPlayerUpdate Delay? - Matz - 26.10.2012

Thank you both. Well, for cheap host, seems I have to use timers instead of this.


Re: OnPlayerUpdate Delay? - cessil - 26.10.2012

how about you show what you are putting in it so others can help you optimize it?


Re: OnPlayerUpdate Delay? - Matz - 26.10.2012

Actually it is for general things such as glass objects re-create, players' exp bar update, scores, anti cheats etc. but I made a 2000 ms timer for all of them. I think it will reduce CPU usage.


Re: OnPlayerUpdate Delay? - cessil - 26.10.2012

now sure what you mean by the window thing, exp should be done when the experience changes, anticheat is perfect for OPU, also running everything on a 2000ms timer might be worse if they're all doing the checks in the same function.

there's a profiler plugin that allows you to see what's causing bottlenecks in your script


Re: OnPlayerUpdate Delay? - Matz - 26.10.2012

Not everyting on same timer but if there are a few timers which running at the same time (like 10 timers) might be bad for CPU that's why I put similar checks in a same timer.

Код:
SetTimer("update",2000,1); // expbar, anti-cheats, TAB Score
SetTimer("ping",30000,1); // high ping checker
SetTimer("SendMSG",300000,1); // random msgs
SetTimer("Payday",3600000,1); // payday