SA-MP Forums Archive
GetPlayerKeys problem with arrow keys - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: GetPlayerKeys problem with arrow keys (/showthread.php?tid=469271)



GetPlayerKeys problem with arrow keys - BGTrucker - 12.10.2013

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);
		}
	}
}



Re: GetPlayerKeys problem with arrow keys - Pottus - 12.10.2013

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


Re: GetPlayerKeys problem with arrow keys - tuitalker - 12.10.2013

try 4 and 6 or 8 and 2


Re: GetPlayerKeys problem with arrow keys - BGTrucker - 12.10.2013

@[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


Re: GetPlayerKeys problem with arrow keys - Pottus - 12.10.2013

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


Re: GetPlayerKeys problem with arrow keys - kurta999 - 12.10.2013

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

if(UPDOWN)
{
// your code
}



Re: GetPlayerKeys problem with arrow keys - Pottus - 12.10.2013

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.


Re: GetPlayerKeys problem with arrow keys - Kar - 12.10.2013

key_accelerate = 8


Re: GetPlayerKeys problem with arrow keys - Pottus - 12.10.2013

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.


Re: GetPlayerKeys problem with arrow keys - BGTrucker - 13.10.2013

@[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);
		}
	}
}