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
#2

Yes, but there is no other way to do it. :S
Damn, sa-mp need a function to do that.
Reply
#3

Anyway, it would be great to have such function on sa-mp to disable specified keys.
I was thinking to make trials server on sa-mp, but it's not possible:
- Camera moving, but there is a visual glitch.
- Can't disable left/right buttons.
- When you try to drive only on back wheel, you fall down.

Reply
#4

Quote:
Originally Posted by Darth1993
Посмотреть сообщение
I was thinking to make trials server on sa-mp, but it's not possible:
I think you're in for a rude awakening if you're trying to make sa-mp into another game.
Reply
#5

Yeah. Anyway, it's still possible. I just need to make a map with invisible walls, so player won't be able to go left or right.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)