OnPlayerKeyStateChange what the hell? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerKeyStateChange what the hell? (
/showthread.php?tid=249992)
OnPlayerKeyStateChange what the hell? -
Seven_of_Nine - 21.04.2011
Hey all!
You know I'm working on an AirBreak feature, but when I bind KEY_UP to Z+10 then it does nothing with W or arrow UP it works with Caps Lock
pawn Код:
if(newkeys & KEY_UP) {
if(AirBreak[playerid][enabled] == 1) {
#if AIRBREAK_ALLOWED == true
GetPlayerPos(playerid,AirBreak[playerid][ax],AirBreak[playerid][ay],AirBreak[playerid][az]);
SetPlayerPos(playerid,AirBreak[playerid][ax],AirBreak[playerid][ay],AirBreak[playerid][az]+10);
#endif
}
}
See. So I press Caps Lock then it works. xD
What the hell is this?
EDIT: If I bind the wrong keys then can you give me the right ones? :]
Re: OnPlayerKeyStateChange what the hell? -
Joe Staff - 21.04.2011
OnPlayerKeyStateChange doesn't detect arrow/wasd key strokes, only special keys like jump or sprint
Re: OnPlayerKeyStateChange what the hell? -
Seven_of_Nine - 21.04.2011
KEY_ANALOG_UP
KEY_ANALOG_DOWN
KEY_ANALOG_LEFT
KEY_ANALOG_RIGHT
Then which buttons are these?
Re: OnPlayerKeyStateChange what the hell? -
Joe Staff - 21.04.2011
GetPlayerKeys(specialkeys,updown,leftright);
Re: OnPlayerKeyStateChange what the hell? -
Seven_of_Nine - 21.04.2011
pawn Код:
new Keys,ud,lr;
GetPlayerKeys(playerid,Keys,ud,lr);
if(ud < 0) {
if(AirBreak[playerid][enabled] == 1) {
#if AIRBREAK_ALLOWED == true
GetPlayerPos(playerid,AirBreak[playerid][ax],AirBreak[playerid][ay],AirBreak[playerid][az]);
SetPlayerPos(playerid,AirBreak[playerid][ax],AirBreak[playerid][ay],AirBreak[playerid][az]+10);
#endif
}
}
Thanks, now it works!