Installation

3 min readUpdated 2 weeks ago

Overview

ML Fuel replaces pay-at-pump refueling with a survival fuel economy. Vehicles consume typed fuel (gasoline, diesel, kerosene, plus optional types) based on their handling data, and players get fuel from items: refillable jerry cans, one-use containers, siphoning, vehicle wrecks and a rotating set of scavengeable gas stations. Electric vehicles, charging stations, power cells, tank upgrades and per-plate fuel conversions are included.

Quick Start

  1. Download from the CFX Portal
  2. Extract to your resources folder as ml_fuel
  3. Add to server.cfg:
server.cfg
1ensure oxmysql
2ensure ox_lib
3ensure ox_inventory   # or your inventory
4ensure ml_bridge
5ensure ml_fuel
Load Order

ml_fuel must start AFTER ml_bridge, ox_lib and your inventory.

One fuel resource

Remove any other fuel resource before starting ml_fuel. Two fuel scripts writing the same vehicle fuel level fight each other.

Database

Tables are created on first start:

  • ml_fuel_conversions: per-plate fuel type conversions, tank bonus liters and installed upgrades
  • ml_fuel_reservoirs: fuel left in each scavenge station
  • ml_fuel_solar_cells: placed solar cells

_INSTALL/install.sql has the same schema if you prefer to import it by hand.

Auto Created

No SQL import is needed. The schema is built automatically on start.

Item Registration

Register every item referenced by the config in your inventory. Ready-made definitions ship in _INSTALL/ox_inventory_items.lua and _INSTALL/qb_items.lua, with icons in _INSTALL/images. Adapt the names to match your config keys. The shipped defaults:

  • jerrycan_empty, plastic_bottle_empty: refillable jerry cans (Config.JerryCans)
  • fuel_liter, fuel_canister, diesel_liter, diesel_canister, kerosene_can, fuel_sample: one-use fuel items (Config.FuelItems)
  • siphon_hose: siphon hose, also used for wreck scavenging and for installing tank upgrades
  • electric_pump: electric pump for pump scavenging
  • tank_expansion_small, tank_expansion_medium, tank_expansion_large: tank upgrades (Config.TankUpgrades)
  • diesel_conversion_kit: conversion kit (Config.ConversionKits). The biofuel and ethanol kits ship commented out
  • power_cell, power_cell_heavy, solar_cell: power cells (Config.PowerCells)
Jerry can item definition

Jerry cans and power cells must be defined with stack = false and consume = 0: their fuel state lives in item metadata and the item is never removed on use.

Verify

After starting, the console prints the banner and:

lua
1[ml_fuel] Resource started
2[ml_fuel] Developed by Micio Mods | miciomods.it
3[ml_fuel] [INFO] Database tables verified!
4[ml_fuel] [INFO] Fuel mode resolved: advanced
5[ml_fuel] [INFO] Station availability initialized with 27 configured stations
6[ml_fuel] [INFO] All usable items registered (mode: advanced)

Enter a vehicle: the fuel gauge appears and the level starts draining while you drive.

  • Jerry can does nothing on use, the item is not registered in the inventory, or its name does not match a Config.JerryCans key
  • "Jerry cans are not available with your server inventory system", the resolved fuel mode is simple because the inventory does not support metadata. Check Config.FuelMode and the startup line Fuel mode resolved
  • No refuel option on the vehicle, the target only appears while you carry a compatible container, and never on locked vehicles or bicycles
  • Pumps never give fuel, station rotation may have them depleted or dormant. Use /showpumps as admin to see the active stations, or disable PumpScavenging.availability
  • Fuel does not drain, check Config.Features.Consumption and that no other fuel resource is running
  • Version errors at start: make sure ox_lib and your inventory are up to date.