OPX//77
CreatorsServer exports

SetFuel

Last updated on

Sets a vehicle's tank in percent, ox_fuel's state:set('fuel', ...).

local res = exports.opx_infinity:SetFuel(vehicleId, percent)

Scope write · sync — answers from memory, safe called either way.

Parameters

  • vehicleId: integer | string

  • percent: number — 0..100

  • Raises opx:on:fuel:changed with reason = 'ext:<your resource>'. While open77_fuel runs, the write goes through its set export.

Returns

  • { litres, percent }

Errors

  • fuel.noVehicle, fuel.badAmount, fuel.busy (a pump or can is pouring into it), fuel.refused, export.badArgument, error.unavailable
Example
local res = exports.opx_infinity:SetFuel(vehicleId, 100)
if not res.ok then print('refused: ' .. res.error) end

On this page

No Headings