opx_infinityfuel
Client
Last updated on
The fuel contract on the client — read a tank off its bag, the open stations, and the pump menu.
local fuel = OPX.Api.Get('fuel')From client code inside opx_infinity. Every read comes off the vehicle's state bag (fuel, fuelCapacity); nothing here writes a tank — a client cannot.
Level
The litres in a vehicle's tank and its capacity.
fuel.Level(vehicleId)Parameters
- vehicleId:
integer
Returns
number?litres — nil when nobody has written the tanknumbercapacity — the bag'sfuelCapacity, elseCAPACITY
Percent
ox's state.fuel: the tank in percent.
fuel.Percent(vehicleId)Parameters
- vehicleId:
integer
Returns
number?— 0..100; nil when nobody has written the tank
Current
The tank of the vehicle the local player sits in.
fuel.Current()Returns
{ vehicleId, litres, capacity, percent }?— nil on foot or with an unwritten tank
local tank = fuel.Current()
if tank and tank.percent < 15 then print(('low fuel: %.1f L'):format(tank.litres)) endStations
The open stations, as the blips module reads them.
fuel.Stations()Returns
table— key →{ key, label, x, y, z }
OpenPump
Opens the menu of the pump the player stands at. The choice is sent to the server, which decides.
fuel.OpenPump()Returns
boolean— whether a menu opened (false away from a pump, or with nomenumodule)