SA-MP Forums Archive
Quick Question - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Quick Question (/showthread.php?tid=89925)



Quick Question - Zeromanster - 05.08.2009

Whats a good interval for a timer that checks GetPlayerKeys ?

Thanks.


Re: Quick Question - yezizhu - 05.08.2009

OnPlayerUpdate is the best for this case.


Re: Quick Question - Zeromanster - 05.08.2009

Thanks


Re: Quick Question - Woet - 05.08.2009

Quote:
Originally Posted by yezizhu
OnPlayerUpdate is the best for this case.
No, it's not, why do people keep thinking that?
OnPlayerUpdate gets called about 20 times a second per player, you should not do things like GetPlayerKeys in it.
A timer depends totally on how important keys are to you, but about 1 or 2 seconds would do fine.



Re: Quick Question - Simon - 05.08.2009

There's also the OnPlayerKeyStateChange callback if you don't need walking buttons (up, down, left, right).


Re: Quick Question - Zeromanster - 05.08.2009

Quote:
Originally Posted by Simon
There's also the OnPlayerKeyStateChange callback if you don't need walking buttons (up, down, left, right).
It's for a food menu and i need left/right. I made an interval to 500ms, it works fine