14.01.2012, 22:01
Hey everyone... i need to detect a few keys at OnPlayerUpdate for a new epic script i'm working on, only im having a kind of a problem...
I need to get the keys at OnPlayerUpdate, because i need to keep the player from updating when the player is pressing a special key, so i cannot use OnPlayerKeyStateChange because this one is called AFTER the player is being updated!
Now lets say i want to detect the Crouch key at OnPlayerUpdate, i would use this code:
Now i can detect the keys by using the "keys" variable, BUT when you press 2 keys at the same time, as example KEY_ACTION (value 1) and KEY_CROUCH (value 2) together it will output 3 instead of an array as example with [1][2].
Is there any option to get the keycode per key ?
I need to get the keys at OnPlayerUpdate, because i need to keep the player from updating when the player is pressing a special key, so i cannot use OnPlayerKeyStateChange because this one is called AFTER the player is being updated!
Now lets say i want to detect the Crouch key at OnPlayerUpdate, i would use this code:
pawn Код:
public OnPlayerUpdate(playerid)
{
new keys,updown,leftright;
GetPlayerKeys(playerid,keys,updown,leftright);
printf("Key pressed: %i",keys);
}
Is there any option to get the keycode per key ?