[FIXED]Mapping key to repair vehicle
#1

I've got my /r command that repairs the player's vehicle no problem, but now I'm trying to get my walk key to repair my vehicle, which is in this case, Alt.

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(IsPlayerInAnyVehicle(playerid))
	{
		new nos = GetPlayerVehicleID(playerid);
		if(Nitro(nos) && (oldkeys & 1 || oldkeys & 4))
		{
			RemoveVehicleComponent(nos, 1010);
			AddVehicleComponent(nos, 1010);
			return 1;
		}
	}
	if(IsPlayerInAnyVehicle(playerid))
	{
	  new vehicleid = GetPlayerVehicleID(playerid);
	  if((GetPlayerState(playerid) == PLAYER_STATE_DRIVER),((newkeys & 1024) && !(oldkeys & 1024))); // I keep getting an "empty statement" error on this line
		{
		  RepairVehicle(vehicleid);
		  SendClientMessage(playerid,COLOR_GREEN, "Your vehicle has been repaired.");
			return 1;
		}
	}
	return 1;
}
I tried to do it like so:
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(IsPlayerInAnyVehicle(playerid))
	{
		new nos = GetPlayerVehicleID(playerid);
		if(Nitro(nos) && (oldkeys & 1 || oldkeys & 4))
		{
			RemoveVehicleComponent(nos, 1010);
			AddVehicleComponent(nos, 1010);
			return 1;
		}
	}
	if(IsPlayerInAnyVehicle(playerid))
	{
	  new vehicleid = GetPlayerVehicleID(playerid);
	  if((GetPlayerState(playerid) == PLAYER_STATE_DRIVER),((newkeys & 1024) && !(oldkeys & 1024))) RepairVehicle(vehicleid),SendClientMessage(playerid,COLOR_GREEN, "Your vehicle has been repaired.");
		{
			return 1;
		}
	}
	return 1;
}
That eliminates the empty statement error, but it does absolutely nothing when I press alt in game, no message telling me my vehicle was repaired.
Any ideas?

EDIT: it now looks like this:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new nos = GetPlayerVehicleID(playerid);
        if(Nitro(nos) && (oldkeys & 1 || oldkeys & 4))
        {
            RemoveVehicleComponent(nos, 1010);
            AddVehicleComponent(nos, 1010);
            return 1;
        }
    }
    if(IsPlayerInAnyVehicle(playerid))
    {
      new vehicleid = GetPlayerVehicleID(playerid);
      if((GetPlayerState(playerid) == PLAYER_STATE_DRIVER),((newkeys & KEY_CROUCH) && !(oldkeys & KEY_CROUCH))) RepairVehicle(vehicleid),SendClientMessage(playerid,COLOR_GREEN, "Your vehicle has been repaired.");
      else SendClientMessage(playerid,COLOR_RED, "You're not in a vehicle");
        {
            return 1;
        }
    }
    return 1;
}
But now whenever I press any key in a vehicle it tells me I'm not in a vehicle and doesn't repair my vehicle.
Reply


Messages In This Thread
[FIXED]Mapping key to repair vehicle - by biltong - 23.01.2010, 19:11
Re: Mapping key to repair vehicle - by biltong - 24.01.2010, 06:45
Re: [FIXED]Mapping key to repair vehicle - by bluray - 24.01.2010, 10:38
Re: [FIXED]Mapping key to repair vehicle - by biltong - 24.01.2010, 12:03

Forum Jump:


Users browsing this thread: 1 Guest(s)