GetPlayerKeys problem with arrow keys
#1

Well,I made to turn vehicle engine ON by pressing up/down arrow,but for some reason instead of up/down arrows,Num 6 and Num 9 are the keys which turn the engine ON.And I'm sure I have done it right.So what could be wrong
Код:
if (GetPlayerVehicleSeat(playerid) == 0)
{
	GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
	if (engine == 0)
	{
		new Keys, ud, lr;

		GetPlayerKeys(playerid, Keys, ud, lr);
		if ((ud == KEY_UP) || (ud == KEY_DOWN))
		{
		        if(AVehicleData[GetPlayerVehicleID(playerid)][Fuel] > 0)
	    	        {
				SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1, 1, alarm, doors, bonnet, boot, objective);
    		        }
			else
			    GameTextForPlayer(playerid, "~r~Your vehicle doesn't have fuel ~n~to start the engine", 3000, 3);
		}
	}
}
Reply
#2

Those keys don't detect in a vehicle I believe.
Reply
#3

try 4 and 6 or 8 and 2
Reply
#4

@[uL]Pottus:if so,then how come another guy has done it on his server?
@tuitalker:I have tried,but no result.I mean that then it works with the keys I setted,but I want it to work with arrow keys
Reply
#5

I tried this before they don't detect where is this other guys server?
Reply
#6

Try this.
pawn Код:
GetPlayerKeys(playerid, Keys, UPDOWN, LEFTRIGHT);

if(UPDOWN)
{
// your code
}
Reply
#7

Quote:
Originally Posted by kurta999
Посмотреть сообщение
Try this.
pawn Код:
GetPlayerKeys(playerid, Keys, UPDOWN, LEFTRIGHT);

if(UPDOWN)
{
// your code
}
That works on foot but not when in a vehicle.
Reply
#8

key_accelerate = 8
Reply
#9

Quote:
Originally Posted by Kar
Посмотреть сообщение
key_accelerate = 8
Ya your right my bad, it's actually the left/right that don't detect through the keys variable when in a vehicle, ud will not detect in a vehicle but lr will That is why I was getting confused.
Reply
#10

@[uL]Pottus: its the server from my signature-Convoy Trucking.
@kurta999: I tried the way you told me,but still Num 6 and Num 9 are the keys which respond :S Here's how I done it
Код:
GetPlayerKeys(playerid, Keys, ud, lr);
if(ud)
{
	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
		if (engine == 0)
		{
			if(AVehicleData[GetPlayerVehicleID(playerid)][Fuel] > 0)
	    		{
				SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1, 1, alarm, doors, bonnet, boot, objective);
    			}
			else
				GameTextForPlayer(playerid, "~r~Your vehicle doesn't have fuel ~n~to start the engine", 3000, 3);
		}
	}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)