CreatorsServer exports
GetFuelState
Last updated on
A vehicle's whole tank — litres, capacity, percent and whether it takes fuel.
local res = exports.opx_infinity:GetFuelState(vehicleId)Scope read · sync.
Parameters
- vehicleId:
integer | string
Returns
{ litres?, capacity, percent?, usesFuel }litres,percent:nilbefore anybody wrote the tankcapacity: litres in a full tank (open77_fuel's while the module stands down)usesFuel:falsefor a class withUSAGE = 0(AVs)
Errors
fuel.noVehicle,export.badArgument,error.unavailable
local res = exports.opx_infinity:GetFuelState(vehicleId)
if res.ok and res.value.usesFuel then
print(('%.1f / %.0f L'):format(res.value.litres or 0, res.value.capacity))
end