09.06.2012, 17:12
Why does the fuel go down even if the engine is off please help me
Thank You
pawn Код:
public timer_fuel_lower()
{
new engine, lights, alarm, doors, bonnet, boot, objective;
for(new i=0;i<MAX_PLAYERS;i++) { //loop for all players
new PlayerVehicle = GetVehicleFileID(GetPlayerVehicleID(i));
if (isrefuelling[i]) continue; //stop when a player is already refuelling
new vid = GetPlayerVehicleID(i); //getting vehicle ID
if (GetPlayerVehicleSeat(i) == 0 && EngineOn[vid] == 1 || IsPlayerInHotWiredCar == 1 || Vehicles[PlayerVehicle][CarGroup] >= 0 && Vehicles[PlayerVehicle][CarGroup] == Player[i][Group]) { //if the player is a driver (it should only lower the fuel when theres an driver!)
fuel[vid] = fuel[vid] -1; //lowering fuel value
if (fuel[vid]<1) //if fuel is empty
{
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
fuel[vid] = 0; //setting fuel to 0 (else the timer will set it to -1 -2 -3 etc before removing player)
SetVehicleParamsEx(vid, 0, lights, alarm, doors, bonnet, boot, 0);
}
}
new string[125];format(string,sizeof string,"Fuel:%i",fuel[vid]); //preparing string with next fuel value
TextDrawSetString(td_fuel[i],string); //updating textdraw
}
}