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