07.11.2012, 08:49
Hello, I've made a small code:
which disables LEFT and RIGHT moving keys, but there is a glitch. When player goes forward with vehicle at normal or full speed and when he press LEFT or RIGHT, his vehicle turns to left or right a little, because of TogglePlayerControllable(playerid, 0), which stops him.
Is there anything I can do with it?
P.S this code is written inside OnPlayerUpdate(playerid) callback.
Код:
new Keys, ud, lr; GetPlayerKeys(playerid, Keys, ud, lr); if(ud > 0) { SendClientMessage(playerid, 0xFFFFFFFF, "DOWN"); TogglePlayerControllable(playerid, 1); } else if(ud < 0) { SendClientMessage(playerid, 0xFFFFFFFF, "UP"); TogglePlayerControllable(playerid, 1); } if(lr > 0) { SendClientMessage(playerid, 0xFFFFFFFF, "RIGHT"); TogglePlayerControllable(playerid, 0); } else if(lr < 0) { SendClientMessage(playerid, 0xFFFFFFFF, "LEFT"); TogglePlayerControllable(playerid, 0); }
Is there anything I can do with it?
P.S this code is written inside OnPlayerUpdate(playerid) callback.