OnPlayerKeyStateChange what the hell?
#1

Hey all!

You know I'm working on an AirBreak feature, but when I bind KEY_UP to Z+10 then it does nothing with W or arrow UP it works with Caps Lock
pawn Код:
if(newkeys & KEY_UP) {
        if(AirBreak[playerid][enabled] == 1) {
            #if AIRBREAK_ALLOWED == true
                GetPlayerPos(playerid,AirBreak[playerid][ax],AirBreak[playerid][ay],AirBreak[playerid][az]);
                SetPlayerPos(playerid,AirBreak[playerid][ax],AirBreak[playerid][ay],AirBreak[playerid][az]+10);
            #endif
        }
    }
See. So I press Caps Lock then it works. xD
What the hell is this?

EDIT: If I bind the wrong keys then can you give me the right ones? :]
Reply
#2

OnPlayerKeyStateChange doesn't detect arrow/wasd key strokes, only special keys like jump or sprint
Reply
#3

KEY_ANALOG_UP
KEY_ANALOG_DOWN
KEY_ANALOG_LEFT
KEY_ANALOG_RIGHT

Then which buttons are these?
Reply
#4

GetPlayerKeys(specialkeys,updown,leftright);
Reply
#5

pawn Код:
new Keys,ud,lr;
    GetPlayerKeys(playerid,Keys,ud,lr);
    if(ud < 0) {
        if(AirBreak[playerid][enabled] == 1) {
            #if AIRBREAK_ALLOWED == true
                GetPlayerPos(playerid,AirBreak[playerid][ax],AirBreak[playerid][ay],AirBreak[playerid][az]);
                SetPlayerPos(playerid,AirBreak[playerid][ax],AirBreak[playerid][ay],AirBreak[playerid][az]+10);
            #endif
        }
    }
Thanks, now it works!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)