View Single Post
Old 14/06/2019, 05:52 PM   #1
iNeo
Little Clucker
 
iNeo's Avatar
 
Join Date: Nov 2016
Posts: 17
Reputation: 0
Default Sistema de Consumo Combustivel

Pessoal, o que ocorre é que ele não consome o combustível, sempre na textdraw ele fica o valor como NaN
HTML Code:
forward ConsumeFuel();
public ConsumeFuel()
{
    new Float: mass, Float: speed, Float: dist;
    for(new i = 1, ps = GetVehiclePoolSize(); i <= ps; i++)
    {
        if(!IsValidVehicle(i)) continue;
        if(Vehicle_IsANoFuelVehicle( GetVehicleModel(i) )) continue;
        if(!GetVehicleParams(i, VEHICLE_TYPE_ENGINE)) continue;
        dist = GetVehicleDistanceFromPoint(i, VehicleLastCoords[i][0], VehicleLastCoords[i][1], VehicleLastCoords[i][2]);
        mass = GetVehicleModelInfoAsFloat(GetVehicleModel(i), "fMass");
        speed = Vehicle_GetSpeed(i) + 0.001;
        ConcessionariaData[i][DEALERSHIP_FUEL] -= ((mass / (mass * 4.5)) * ((speed / 60) + 0.015) / 30) * ((dist / 10) + 0.001);
        if(ConcessionariaData[i][DEALERSHIP_FUEL] < 0.1) SetVehicleParams(i, VEHICLE_TYPE_ENGINE, 0);
        GetVehiclePos(i, VehicleLastCoords[i][0], VehicleLastCoords[i][1], VehicleLastCoords[i][2]);
       
    }
 
    return 1;
}
iNeo is offline   Reply With Quote