Fuel Consumption
#2

Detect if the engine is off then kill the timer.
Or detect if the vehicle is moving by using some speed script
if((speed) > 1) Fuel --;

Could try something like
PHP код:
public timer_fuel_lower()
{
    for(new 
0MAX_PLAYERSi++)
    {
        new 
vid GetPlayerVehicleID(i);
        new 
speed GetPlayerSpeed(ifalse)
        if(
isrefuelling[i]) continue;
        
        if(
fuel[vid] > 0)
        {
            if((
speed) > 1fuel[vid] --;
            if(
fuel[vid] >= && fuel[vid] <= 15 && GetPlayerState(i) == PLAYER_STATE_DRIVER)
            {
                
SendClientMessage(i, -1"Vehicle low on fuel");
            }
        }
        
        if(
fuel[vid] <= 0)
        {
            
fuel[vid] = 0;
            
// Turn the engine off here.
        
}
    }
    return 
1;
}
GetPlayerSpeed(playeridbool:kmh false)
{
    new 
Float:Vx,Float:Vy,Float:Vz,Float:rtn;
    if(
IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid), VxVyVz); else GetPlayerVelocity(playeridVxVyVz);
    
rtn floatsqroot(floatabs(floatpower(Vx Vy Vz2)));
    return 
kmh?floatround(rtn 100 1.61):floatround(rtn 100);

If you get errors post them cause this is untested and yeah
Reply


Messages In This Thread
Fuel Consumption - by eikzdej - 06.02.2016, 02:07
Re: Fuel Consumption - by itsCody - 06.02.2016, 02:27
Re: Fuel Consumption - by eikzdej - 06.02.2016, 02:44
Re: Fuel Consumption - by FreAkeD - 06.02.2016, 02:51
Re: Fuel Consumption - by itsCody - 06.02.2016, 03:00
Re: Fuel Consumption - by Sew_Sumi - 06.02.2016, 03:04
Re: Fuel Consumption - by eikzdej - 06.02.2016, 03:07
Re: Fuel Consumption - by itsCody - 06.02.2016, 03:09
Re: Fuel Consumption - by eikzdej - 06.02.2016, 03:18
Re: Fuel Consumption - by itsCody - 06.02.2016, 03:38

Forum Jump:


Users browsing this thread: 1 Guest(s)