API

Getters

All functions can be called from export

Example:

CreateThread(function()
    local ped = PlayerPedId()
    local veh = GetVehiclePedIsIn(ped, false)

    local currentFuelLiters = exports["rcore_fuel"]:GetVehicleFuelLiters(veh)
    local maxFuelLiters = exports["rcore_fuel"]:GetMaximumFuelCapacityForVehicle(veh)
    
    print(string.format("Current Fuel: %2.f | Max F: %2.f",  currentFuelLiters, maxFuelLiters))
end)

GetVehicleFuelConsumptionEfficiency(vehicle)

  • Parameters:

    • vehicle: entity

  • Return type: float

Description: This function simply return eco-friendliness in % the less fuel consumption the more eco friendly.


GetVehicleMaxCurrentDrivingRange(vehicle)

  • Parameters:

    • vehicle: entity

  • Return type: float

Description: This function calculates and returns the current maximum driving range of the specified vehicle.


GetMaximumFuelCapacityForVehicle(vehicle)

  • Parameters:

    • vehicle: entity

  • Return type: float

Description: This function returns the maximum fuel capacity of the specified vehicle in liters.


GetVehicleFuelPercentage(vehicle)

  • Parameters:

    • vehicle: entity

  • Return type: float

Description: This function returns the current fuel level of the vehicle as a percentage, ranging from 0.0 to 100.0.


GetVehicleFuelLiters(vehicle)

  • Parameters:

    • vehicle: entity

  • Return type: float

Description: This function returns the current fuel level of the vehicle in liters.


Add/Remove


AddVehicleFuelLiter(vehicle, fuel)

  • Parameters:

    • vehicle: entity

    • fuel: float

  • Return type: none

Description: This function adds the specified amount of fuel to the vehicle.


RemoveVehicleFuelLiter(vehicle, fuel)

  • Parameters:

    • vehicle: entity

    • fuel: float

  • Return type: none

Description: This function removes the specified amount of fuel from the vehicle.


AddVehicleFuelPercentage(vehicle, percentage)

  • Parameters:

    • vehicle: entity

    • percentage: float

  • Return type: none

Description: This function adds the specified percentage of fuel to the vehicle's current fuel level.


RemoveVehicleFuelPercentage(vehicle, percentage)

  • Parameters:

    • vehicle: entity

    • percentage: float

  • Return type: none

Description: This function removes the specified percentage of fuel from the vehicle's current fuel level.


Setter


SetVehicleFuel(vehicle, percentage)

  • Parameters:

    • vehicle: entity

    • percentage: float

  • Return type: none

Description: This function sets the vehicle's fuel level to the specified percentage.


Last updated