Problem with keys
#4

Oh, looks like you're passing in the keys from OnPlayerKeyStateChange. Those keys are different keys to the direction keys.

The KEY_DOWN, KEY_UP, KEY_LEFT and KEY_RIGHT don't work in OnPlayerKeyStateChange. You're required to use GetPlayerKeys(...). Maybe on a timer or OnPlayerUpdate, whichever suits your needs. If you wanted to detect direction keys, you would be required to do something like this:

pawn Код:
new keys, updown, leftright;

GetPlayerKeys(playerid, keys, updown, leftright);

if (updown > 0)  {
    // key_up
} else if (leftright < 0) {
    // key_down
}

if (leftright > 0) {
    // key_right
} else if (leftright < 0) {
    // key_left
}
https://sampwiki.blast.hk/wiki/GetPlayerKeys
Reply


Messages In This Thread
Problem with keys - by [IL]HeHu - 04.11.2011, 12:12
Re: Problem with keys - by Simon - 04.11.2011, 12:14
Re: Problem with keys - by [IL]HeHu - 04.11.2011, 12:16
Re: Problem with keys - by Simon - 04.11.2011, 12:21

Forum Jump:


Users browsing this thread: 2 Guest(s)