Detecting a key being held
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Because OnPlayerKeyStateChange is only called when a key is changed. If you press sprint OnPlayerKeyStateChange will be called, but it won't be called again until you release sprint OR you press another key in addition to sprint. Only the latter one will trigger HOLDING.

You will likely want to use PRESSED and RELEASED to set and unset a variable and/or timer.
Believe it or not, that's what I thought at first. So I moved my code to OnPlayerUpdate with GetPlayerKeys which still didn't work (before I found "HOLDING" definition on SA-MP Wiki) then I found that define and moved it back to OnPlayerKeyStateChange. *facepalm*

Thanks for the help.
Reply


Messages In This Thread
Detecting a key being held - by Denying - 18.08.2015, 17:44
Re: Detecting a key being held - by Vince - 18.08.2015, 18:04
Re: Detecting a key being held - by Denying - 18.08.2015, 18:14

Forum Jump:


Users browsing this thread: 1 Guest(s)