How to disable moving keys LEFT and RIGHT
#1

Hello, I've made a small code:
Код:
	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);
	}
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.
Reply


Messages In This Thread
How to disable moving keys LEFT and RIGHT - by Darth1993 - 07.11.2012, 08:49
Re: How to disable moving keys LEFT and RIGHT - by Darth1993 - 07.11.2012, 11:39
Re: How to disable moving keys LEFT and RIGHT - by Darth1993 - 07.11.2012, 12:33
Re: How to disable moving keys LEFT and RIGHT - by ReneG - 07.11.2012, 13:04
Re: How to disable moving keys LEFT and RIGHT - by Darth1993 - 07.11.2012, 13:26

Forum Jump:


Users browsing this thread: 2 Guest(s)