SA-MP Forums Archive
Detecting if a key is pressed despite of other keys in GetPlayerKeys (Not OnPlayerKeyStateChange) - 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: Detecting if a key is pressed despite of other keys in GetPlayerKeys (Not OnPlayerKeyStateChange) (/showthread.php?tid=372803)



Detecting if a key is pressed despite of other keys in GetPlayerKeys (Not OnPlayerKeyStateChange) - Siralos - 28.08.2012

Hello all,

I need to detect if KEY_SPRINT/KEY_WALK is pressed on callback 'OnPlayerUpdate' despite of other keys.

Example:
I press KEY_SPRINT and KEY_FIRE at the same time. I call 'GetPlayerKeys'.
How can I check if KEY_SPRINT is pressed despite of the rest of the pressed keys?


Respuesta: Detecting if a key is pressed despite of other keys in GetPlayerKeys (Not OnPlayerKeyStateChange) - Siralos - 28.08.2012

Maybe with: if(keys & KEY_SPRINT)


Re: Detecting if a key is pressed despite of other keys in GetPlayerKeys (Not OnPlayerKeyStateChange) - Mauzen - 28.08.2012

Exactly this. Why didnt you even test it, before doubleposting?


Respuesta: Re: Detecting if a key is pressed despite of other keys in GetPlayerKeys (Not OnPlayerKeyStateChange) - Siralos - 28.08.2012

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
Exactly this. Why didnt you even test it, before doubleposting?
Well, because I can't test now

Thanks!