Pressing and releasing UD and LR
#1

How do I check when I release for example the 'W' key (forward or any of the buttons that orientates you?

I tried the GetPlayerKeys example, but can't seem to make it work, also tried the KEY_UP/DOWN/LEFT/RIGHT definitons. Didn't work, I tried them with PRESSED and RELEASED macro, same thing, doesn't detect them. Any ideas?


My code.
pawn Код:
if(PRESSED(KEY_UP | KEY_DOWN | KEY_LEFT | KEY_RIGHT)) Pressed
else if(RELEASED(KEY_UP | KEY_DOWN | KEY_LEFT | KEY_RIGHT)) Released
If I use another key, like KEY_ACTION or KEY_CROUCH, it works.
Reply
#2

Are you using the OnPlayerKeState callback? because as it says on the wiki

"OnPlayerKeyStateChange will be called each time a key state is changed. It will never be called for up, down, left and right."
Reply
#3

Keys: Up, down, left and right do not call OnPlayerKeyStateChange.

You can move the code over to OnPlayerUpdate or a timer to detect when the key combinations are pressed.
Reply
#4

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
Keys: Up, down, left and right do not call OnPlayerKeyStateChange.

You can move the code over to OnPlayerUpdate or a timer to detect when the key combinations are pressed.
I know that way, but I can only make it being pressed but not released...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)