Detecting keys - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Detecting keys (
/showthread.php?tid=457090)
Detecting keys -
DRIFT_HUNTER - 09.08.2013
Код:
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?
Thx
Re: Detecting keys -
[D]ry[D]esert - 09.08.2013
Aright, Let me test it.
EDIT:That also happened for me lol..
Re: Detecting keys -
DRIFT_HUNTER - 09.08.2013
Can anyone else test these please?
AW: Detecting keys -
Nero_3D - 09.08.2013
It always was so and always will be so, even the wiki could tell you that ->
OnPlayerKeyStateChange
The obviously reason is that it would spam the callback
You need to use
GetPlayerKeys