04.11.2011, 12:21
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:
https://sampwiki.blast.hk/wiki/GetPlayerKeys
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
}