The checking when player pressed left or right not working - 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: The checking when player pressed left or right not working (
/showthread.php?tid=251690)
The checking when player pressed left or right not working -
tal_peretz - 28.04.2011
PHP код:
if(PRESSED(KEY_RIGHT))
{
scm(playerid, red, #йойп);
CameraSys(playerid,NumCamera[playerid] + 1);
}
else if(PRESSED(KEY_LEFT))
{
scm(playerid, red, #щоам);
CameraSys(playerid,NumCamera[playerid] - 1);
}
in OnPlayerKeyStateChange
nothing didn't happen... why ?
Re: The checking when player pressed left or right not working -
Vince - 28.04.2011
OnPlayerKeyStateChange is not called for the movement keys. You would've known if you read the wiki properly:
Quote:
Originally Posted by wiki
This callback is called when the state of any key except the movement keys (up, down, left, right) changes (i.e. are pressed or released).
|
Use a timer/OnPlayerUpdate instead.
Re: The checking when player pressed left or right not working -
iggy1 - 28.04.2011
You have to use "GetPlayerKeys" inside "OnPlayerUpdate" to detect movement keys. Or timer like vince said.
Re: The checking when player pressed left or right not working -
tal_peretz - 28.04.2011
thank you now that's working