View Full Version : Detecting keys

09/08/2013, 02:35 AM
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
if((newkeys & KEY_RIGHT) && !(oldkeys & KEY_RIGHT))
SendDebug(playerid, "Key Right Detected!");

if((newkeys == KEY_RIGHT))
SendDebug(playerid, "Key Right Detected! (Check 2)");
return 1;

Can someone test it cos when i connect to server and press right key or D (Walk to right) it does not detect it at all but it detects it when i press space or right aim key...(On foot and in vehicle)
I know the second way is not how we detect keys i just added it to be sure its not my fault

Im only one or someone may confirm these as a 0.3x bug?

09/08/2013, 03:01 AM
Aright, Let me test it.
EDIT:That also happened for me lol..

09/08/2013, 02:46 PM
Can anyone else test these please?

09/08/2013, 04:03 PM
It always was so and always will be so, even the wiki could tell you that -> OnPlayerKeyStateChange (http://wiki.sa-mp.com/wiki/OnPlayerKeyStateChange)
The obviously reason is that it would spam the callback

You need to use GetPlayerKeys (http://wiki.sa-mp.com/wiki/GetPlayerKeys)