Weird key detecting
#1

Ok, I'm having some weird problems with OnPlayerKeyStateChange here ..

For some reason, it calls KEY_SPRINT when I press the forward key, but only when in a vehicle. The Wiki clearly states that OnPlayerKeyStateChange doesn't get called for updown and leftright. And, on top of that, KEY_UP is defined as 128 ...

pawn Код:
#define PRESSED(%0) \
        (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

    if(PRESSED(KEY_SPRINT))
    {
        printf("[debug] Found: KEY_SPRINT - %d", KEY_SPRINT);
        ClearAnimations(playerid);
        SetPlayerSpecialAction(playerid, 0);
        return 1;
    }
Output from console:
Код:
[21:09:18] [debug] Found: KEY_SECONDARY_ATTACK - 16 // I enter a vehicle
[21:09:22] [debug] Found: KEY_SPRINT - 8 // I press the accelerate key
Note that I got the defines from the wiki as well!
Reply
#2

maybe you changed the keys of the gta sa so Menu > Options > Keyboard > redefine keys.. did u change keys?
Reply
#3

Yes, I use the arrow keys to steer (instead of WASD), but that shouldn't have anything to do with it.
The server is not dependent on the key configuration of the client. KEY_SPRINT is KEY_SPRINT, no matter if you assign KEY_SPRINT to control, or shift, or whatever.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)