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



Keys Update? - Harty - 03.04.2016

How much time of 'update' while i press 2 keys without leave the pressing ?
I mean, if i press 2 keys, the game will call again the onplayerkeystatechange if i leave and press again or too if i continue pressing, but after how many seconds??

Do i need to use GetPlayerKeys(playerid,Keys,ud,lr) or can i only use keystate public ?

P.S: Sorry for my bad english.

Thanks.


Re: Keys Update? - Vanter - 03.04.2016

You can use OnPlayerKeyStateChange in all cases (if pressing, if pressed, if pressed and release)
and you can even detect for how long the key has been pressed by using a timer.
you can learn all abt that public Here


Re: Keys Update? - Vince - 03.04.2016

Nope, the callback is only called when the state of the keys changes. If you want to do stuff when the player is holding a key you need to set a timer when they first press the key and kill the timer when they release it.


Re: Keys Update? - Harty - 03.04.2016

How can i do that? Just an example.

Thanks.