The checking when player pressed left or right not working
#1

PHP код:
        if(PRESSED(KEY_RIGHT))
        {
        
scm(playeridred#йойп);
        
CameraSys(playerid,NumCamera[playerid] + 1);
        }
        else if(
PRESSED(KEY_LEFT))
        {
        
scm(playeridred#щоам);
        
CameraSys(playerid,NumCamera[playerid] - 1);
        } 
in OnPlayerKeyStateChange

nothing didn't happen... why ?
Reply
#2

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.
Reply
#3

You have to use "GetPlayerKeys" inside "OnPlayerUpdate" to detect movement keys. Or timer like vince said.
Reply
#4

thank you now that's working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)