23.01.2010, 19:11
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.
I tried to do it like so:
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:
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.
Код:
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; }
Код:
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; }
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;
}