Fuel drops instantly.
#5

This on OnGameModeEnit

pawn Код:
for(new i=0;i<MAX_VEHICLES;i++){
    fuel[i] = 100; //sets every car's fuel to 100 in a loop
    }
    SetTimer("timer_fuel_lower",35500,true); //sets the timer to drop the fuel
and this as Public fuel_lower

pawn Код:
public timer_fuel_lower()
{
    for(new i=0;i<MAX_PLAYERS;i++) { //loop for all players
        if (isrefuelling[i]) continue; //stop when a player is already refuelling
        new vid = GetPlayerVehicleID(i); //getting vehicle ID
        if (GetPlayerVehicleSeat(i) == 0) { //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
            {
                fuel[vid] = 0; //setting fuel to 0 (else the timer will set it to -1 -2 -3 etc before removing player)
                RemovePlayerFromVehicle(i); //remove player out of vehicle
                GameTextForPlayer(i,"~r~You are out of ~w~fuel~r~!",5000,4); //show text
            }
        }
        new string[125];format(string,sizeof string,"Fuel:%i",fuel[vid]); //preparing string with next fuel value
        TextDrawSetString(td_fuel[i],string); //updating textdraw
    }
    return 1;
}
You mihgt have to define some stuff, not sure. but it should work
Reply


Messages In This Thread
Fuel drops instantly. - by demonarn - 11.02.2012, 10:38
Re: Fuel drops instantly. - by milanosie - 11.02.2012, 10:40
Re: Fuel drops instantly. - by demonarn - 11.02.2012, 10:44
Re: Fuel drops instantly. - by Voldemort - 11.02.2012, 10:55
Re: Fuel drops instantly. - by milanosie - 11.02.2012, 10:56
Re: Fuel drops instantly. - by Babul - 11.02.2012, 10:58
Re: Fuel drops instantly. - by demonarn - 11.02.2012, 11:01
Re: Fuel drops instantly. - by demonarn - 11.02.2012, 11:03
Re: Fuel drops instantly. - by milanosie - 11.02.2012, 11:04
Re: Fuel drops instantly. - by demonarn - 11.02.2012, 11:10

Forum Jump:


Users browsing this thread: 1 Guest(s)