28.08.2010, 19:14
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 ...
Output from console:
Note that I got the defines from the wiki as well!
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;
}
Код:
[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