ai-fuel
Fuel use per vehicle and gas stations at the map's pumps, with a nozzle and hose everyone sees.
ai-fuel makes vehicles use fuel while they drive and lets players fill up at gas stations. The fuel level lives on the vehicle itself (the fuel state bag, 0-100), so the HUD, garages and any other script read the same number.
What it does in the game
- Fuel use. The game burns fuel by engine revs: high revs burn more. A full tank lasts about 25 minutes of driving at the default burn rate. Bicycles, vehicles without a tank and the panel's electric models burn nothing.
- Refuelling. At a gas station, walk to a pump and take the nozzle (prompt Take the nozzle). Walk to your vehicle (the hose reaches 8 m from the pump) and plug it in (prompt Refuel the vehicle). A progress bar runs; when it ends, the tank is full and the price is taken from the first account that can pay it. Hang the nozzle back up with Hang up the nozzle. Walking past the hose's end or getting into a vehicle puts the nozzle back on its own.
- Everyone sees it. The nozzle in a player's hand and the hose from the pump are drawn for every player near.
- Owned vehicles. The fuel of an owned vehicle is saved in ai-vehicles whenever the whole number changes, so it is the same after parking or a restart.
Installation
Installed by the AI Core recipe. By hand: ensure ai-fuel after ai-core (and after ai-vehicles if you use it). 27 gas stations around the map come ready in data/stations.json.
Do not run a second fuel script next to it: two scripts would burn the same tank.
Panel settings
Admin panel > Fuel.
Tab: Gas stations
Where players refuel and what it costs. One record per station (New station / Delete station). Only pumps inside a station's area sell fuel.
| Setting | What it changes | Unit | Default for new |
|---|---|---|---|
| Name | The station's name. 1-48 characters. | ||
| Centre | Stand in the middle of the pumps and use your position. | point | |
| Area | How far from the centre a pump counts as part of this station. 2-40. | m | 12 |
| Price | Dollars per percent of a tank (a full fill from empty costs 100 times this). 0-1000, steps of 0.5. | $ | 3 |
| Map blip | Shows this station on the map, with the look from Station blip below. | on / off | on |
Tab: Settings
How fast vehicles use fuel and how refuelling is paid.
| Setting | What it changes | Unit | Default |
|---|---|---|---|
| Burn rate | 1 is normal (a full tank lasts about 25 minutes of driving), 2 burns twice as fast, 0 turns fuel off. 0-10, steps of 0.1. | x | 1 |
| Refuel time | Seconds per percent filled. A fill from empty takes 100 times this; the bar runs at least 1 second. 0-5, steps of 0.05. | s | 0.15 |
| Paid from | Money accounts tried in order. The whole price comes from one account. | cash, bank | |
| Electric models | Vehicle models (spawn names) that burn no fuel; add your add-on electric cars here. | voltic, voltic2, raiden, cyclone, tezeract, neon, surge, dilettante, dilettante2, imorgon, khamelion, iwagen, omnisegt, virtue, caddy, caddy2, caddy3, airtug, rcbandito | |
| Station blip | How gas stations look on the map (icon, color, size); each station switches its blip on or off. | icon 361, color 0, size 0.7 |
Commands and keybinds
None. The pump prompts use the interact key (E by default).
Logs
Each paid refuel goes to the refuels log channel (station, percent filled, price).
Other fuel scripts
AI Core's fuel layer also works with ox_fuel, Renewed-Fuel, codem-xfuelv2, LegacyFuel, cdn-fuel, ps-fuel, lc_fuel, okokGasStation and x-fuel. Run one of them instead of ai-fuel (never both). Pick it in the admin panel: Server > General > Fuel script (Automatic takes the first one running). ai-* scripts read and set fuel through the layer, so they keep working.
Known limits
- Electric models simply burn nothing. There are no charging stations.
- Refuelling always fills the tank to 100 %. There is no partial fill.
- The nozzle sits on the fuel cap bone of the vehicle. On models without one (some vans and trucks), it uses a rough spot near a rear wheel or the engine and may look out of place.
- The nozzle does not follow a vehicle that moves while it is plugged in.