> For the complete documentation index, see [llms.txt](https://ccfivem.gitbook.io/ccfivem-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ccfivem.gitbook.io/ccfivem-docs/vehicles/fuel-stations-cc_fuel.md).

# Fuel Stations (cc\_fuel)

Fuel consumption, refuelling and payment with petrol, diesel and electric, fuel stock per station with a tanker delivery job, boss-set prices, a damage model and a seatbelt.

**Frameworks:** ESX Legacy, QBCore, QBox (detected automatically, see Framework Bridge).

## Features

* Fuel pumps are detected automatically by model, including pumps in MLOs
* Petrol, diesel and electric; the fuel type is chosen per class or model, electric vehicles charge at charging points
* Misfuelling is possible: it requires confirmation, damages the engine and makes it sputter until repaired
* Pay only for what actually went into the tank; cash, bank or player's choice
* Consumption based on RPM and vehicle class; warning at 15 %, engine stalls at 0 %
* 28 preconfigured stations, each with its own fuel stock, including a marina station for boats
* Refuel zones for aircraft and helicopters at airfields and helipads
* Delivery job: tractor and tanker trailer, fill at the refinery, unload at stations, pay per litre from the company account
* Station revenue goes into the company account
* The boss sets prices per station and fuel type at the depot, within configured limits
* Damage model: collisions hit engine, body and tank; limp mode at low engine health
* Seatbelt with warning, sounds and reminders
* Built-in fuel gauge that steps aside automatically when cc\_hud/00%20Overview\.md) runs
* All amounts, prices, stations and fuel types are decided on the server; every callback is rate limited

## Optional integrations

| Resource                        | Effect                                                   |
| ------------------------------- | -------------------------------------------------------- |
| cc\_hud/00%20Overview\.md)      | Takes over the fuel gauge                                |
| cc\_keys/00%20Overview\.md)     | Keys for the tanker; otherwise none                      |
| cc\_garage/00%20Overview\.md)   | Saves the fuel level, impounds vehicles with engine at 0 |
| cc\_bossmenu/00%20Overview\.md) | Office blip; otherwise hidden                            |
| cc\_lib/00%20Overview\.md)      | Shared notification style                                |

{% hint style="info" %}
The script is protected by Cfx asset escrow. `config/`, `locales/`, `sql/` and the framework bridge files in `shared/` remain editable.
{% endhint %}

## Pages

* Installation
* Configuration
* API
* FAQ

Need help? See Support.

## Installation

See also the general installation guide and dependencies.

### Requirements

| Resource                                                                                | Required             | Purpose                                                           |
| --------------------------------------------------------------------------------------- | -------------------- | ----------------------------------------------------------------- |
| `oxmysql`                                                                               | Yes                  | Stock and prices in `cc_fuel_stations` (declared as `dependency`) |
| ESX Legacy / QBCore / QBox                                                              | Yes                  | Players, money, jobs                                              |
| Job `fueler` with company account                                                       | For the delivery job | Station revenue and driver pay                                    |
| Company account (`esx_addonaccount`, `qb-management`, `qbx_management` or `qb-banking`) | For the delivery job | See above                                                         |
| `cc_lib`, `cc_keys`, `cc_hud`, `cc_bossmenu`, `cc_garage`                               | Optional             | See overview                                                      |

### Steps

1. Copy the folder to `resources/[crankchaos]/cc_fuel`.
2. Add to your `server.cfg` (after your framework):

```cfg
ensure oxmysql
ensure cc_lib      # optional
ensure cc_keys     # optional, tanker keys
ensure cc_fuel
```

3. Restart the server.

### Database

The table `cc_fuel_stations` and its price columns are created or extended automatically on start.

#### Shipped SQL files (ESX Legacy only)

| File                             | Content                                                                                                                                                |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `sql/03-crankchaos-jobs.sql`     | Job `fueler` with grades `driver` (0), `senior` (1), `boss` (2), society account `society_fueler`, plus `cardealer` labels and vehicle category labels |
| `sql/04-crankchaos-vehicles.sql` | Adds boats, planes, helicopters and commercial vehicles to the `vehicles` table                                                                        |

Both files can be imported repeatedly without harm. QBCore and QBox do not need them.

{% hint style="warning" %}
On ESX, import `03-crankchaos-jobs.sql` (or create the job, grades and `society_fueler` yourself). Without a society account, station revenue goes nowhere and drivers are not paid.
{% endhint %}

### Framework notes

* The job from `Config.Supply.job` (default `fueler`) must exist.
* On QBCore/QBox, create the job with a boss grade in your shared jobs and make sure a company account resource is running.
* `Config.Supply.bossGrade` (default `3`) is the minimum grade for setting prices. Adjust it to your job's boss grade (the shipped ESX SQL uses grade `2` for `boss`).

### Permissions

No ACE permissions are required. Job functions are controlled by `Config.Supply.job`, `minGrade` and `bossGrade`.

## Configuration

Editable files: `config/config.lua`, `config/ui.lua` (look, language), `locales/de.json`, `locales/en.json`, and the framework bridge in `shared/`. Set `locale = 'en'` in `config/ui.lua` for English.

### Pumps and payment

```lua
Config.Debug = false
Config.OpenKey = 38            -- E
Config.Pumps = {
    distance = 2.5,
    vehicleDistance = 5.0,
    models = { 'prop_gas_pump_1a', 'prop_gas_pump_1b', 'prop_gas_pump_1c',
               'prop_gas_pump_1d', 'prop_gas_pump_old2', 'prop_gas_pump_old3',
               'prop_vintage_pump' },
}
Config.PricePerLitre = 3.4     -- default price (petrol)
Config.PaymentAccount = 'any'  -- 'cash', 'bank' or 'any'
Config.LitresPerSecond = 2.0
Config.TankSize = 65
```

Add pump models used by your MLOs to `Config.Pumps.models`.

### Fuel types

```lua
Config.Fuels = {
    benzin = { order = 1, colour = '#F59E0B' },
    diesel = { order = 2, colour = '#38BDF8', price = 3.10 },
    strom  = { order = 3, colour = '#34D399', price = 0.85, electric = true },
}
Config.FuelTypes = {
    default = 'benzin',
    classes = { [10] = 'diesel', [11] = 'diesel', [12] = 'diesel', [20] = 'diesel' },
    models = { ['bus'] = 'diesel', ['bison'] = 'benzin', --[[ ... ]] },
}
```

`benzin` = petrol, `strom` = electricity. The key of a fuel type also becomes a database column (`price_<name>`), so use simple lower-case names. Model entries override class entries.

```lua
Config.WrongFuel = { enabled = true, damage = 9.0, stutter = true, stutterEvery = { 4, 13 }, stutterFor = 450 }
Config.Price = {
    min = { benzin = 1.50, diesel = 1.50, strom = 0.30 },
    max = { benzin = 9.00, diesel = 9.00, strom = 3.00 },
}
```

`Config.Price` limits what the boss may set per station.

### Consumption and empty tank

```lua
Config.Consumption = {
    enabled = true,
    base = 1.4, rpmWeight = 1.0, idle = 0.25,
    boatIdleRpm = 0.3, airIdleRpm = 0.2,
    classes = { [7] = 1.6, [13] = 0.0, [18] = 0.0, --[[ ... ]] },
    electric = { 'neon', 'raiden', 'cyclone', 'tezeract', 'voltic', --[[ ... ]] },
}
Config.Empty = { stall = true, warnAt = 15 }
```

`classes` are multipliers per GTA class (0.0 = no consumption, e.g. bicycles and emergency vehicles). `electric` lists models that use electricity.

### Damage and seatbelt

```lua
Config.Damage = {
    enabled = true, threshold = 22.0, multiplier = 1.0,
    engine = 1.0, body = 1.4, tank = 0.5,
    limpAt = 30, limpPower = 0.45,
}
Config.Seatbelt = {
    enabled = true, key = 'B', warnAbove = 60.0, warn = true, sound = true,
    holdIn = true, remind = true, remindAfter = 2, remindEvery = 25,
}
```

With `holdIn = true` players must unbuckle before leaving the vehicle (not when it burns or the engine is dead).

### HUD and blips

```lua
Config.Hud = { enabled = 'auto', inVehicleOnly = true, fadeAfter = 0 }
Config.Blips = true
Config.BlipDefaults = { sprite = 361, colour = 1, scale = 0.6, shortRange = true }
Config.GroupBlipNames = true
```

`Hud.enabled`: `'auto'` hides the built-in gauge when cc\_hud runs, `true` always shows it, `false` disables it. `GroupBlipNames = true` groups all station blips under one legend entry.

### Stations and refuel zones

```lua
Config.Stations = {
    { id = 'davis', label = 'Davis', coords = vector3(-70.2, -1761.8, 29.5), capacity = 5000 },
    -- 28 stations in total
}
Config.FuelZones = {
    { id = 'lsia_east', label = 'LSIA Ost-Vorfeld', coords = vector3(-923.12, -2976.81, 12.95), radius = 12.0, vehicleClasses = { 16 } },
    -- 7 zones for planes (16) and helicopters (15)
}
Config.ZoneVehicleDistance = 20.0
Config.ZoneBlips = true
```

Pumps belong to the nearest station within `Config.Supply.radius`.

### Charging points

```lua
Config.Chargers = {
    enabled = true,
    kwPerSecond = 0.55,
    vehicleDistance = 8.0,
    points = {
        { id = 'charge_legion', label = 'Legion Square Tiefgarage', coords = vector3(233.1, -789.3, 30.6), radius = 14.0, verified = false },
        -- 6 points in total
    },
}
```

{% hint style="warning" %}
The shipped charger coordinates are marked `verified = false`. Check them in game, especially the `z` value.
{% endhint %}

### Delivery job

```lua
Config.Supply = {
    job = 'fueler',
    minGrade = 0,
    bossGrade = 3,         -- grade needed to set prices
    radius = 60.0,         -- distance at which a pump belongs to a station
    strict = false,        -- false: pumps without a station stay unlimited
    capacity = 5000,       -- default station capacity
    load = 5000,           -- litres per full trailer
    loadSeconds = 20, unloadSeconds = 25,
    dropRadius = 25.0,
    payPerLitre = 0.12,
    payFromSociety = true,
    payAccount = 'bank',
    toSociety = true,      -- station revenue into the company account
    depot = vector4(1721.87, -1557.67, 111.65, 243.12),
    fillPoint = vector3(1688.59, -1460.29, 111.65),
    office = vector3(1724.13, -1553.21, 111.65),
    cab = 'phantom',
    trailer = 'tanker',
    plate = 'FUEL',        -- plate prefix, followed by four digits
    timeout = 45,          -- minutes until an unfinished job ends; 0 = off
}
```

Flow: accept the job at the depot, the tractor and tanker trailer spawn, fill at the fill point (E), unload at a station (E), get paid per litre. `Config.Supply.office` should match the `fuel` entry in cc\_bossmenu.

`Config.Marker` controls the marker at pumps.

## Exports, Events & Commands

cc\_fuel provides **no exports** and no public events. Other scripts read and write the fuel level through the native fuel level or vehicle state bags.

### Vehicle state bags

| Key         | Content                                                        |
| ----------- | -------------------------------------------------------------- |
| `ccFuel`    | Fuel level 0-100, networked; mirrored to `GetVehicleFuelLevel` |
| `ccFuelBad` | `true` after wrong fuel (engine sputters until repaired)       |
| `ccPlate`   | Plate of delivery job vehicles                                 |

```lua
-- read (client or server)
local fuel = Entity(vehicle).state.ccFuel or GetVehicleFuelLevel(vehicle)

-- set (server)
Entity(vehicle).state:set('ccFuel', 50.0, true)
```

### Commands

| Command / key                                 | Effect                                            | Permission                                       |
| --------------------------------------------- | ------------------------------------------------- | ------------------------------------------------ |
| E (pump, charger, depot, fill point, station) | Refuel, job menu, fill, unload                    | Everyone; job functions need `Config.Supply.job` |
| `cc_seatbelt` (default B)                     | Seatbelt on/off                                   | Everyone                                         |
| `/ccfuelblips`                                | Toggle station blips                              | Everyone                                         |
| `/ccfuel [percent]`                           | Show or set fuel, only when `Config.Debug = true` | Everyone (debug only)                            |

## FAQ & Troubleshooting

**I can't refuel at a pump.** Leave the vehicle and stand at the pump. If the pump comes from an MLO or map add-on, add its model to `Config.Pumps.models`.

**A station says it is empty.** Stations have stock that only deliveries refill. Run the delivery job, or raise `capacity`. Pumps that belong to no station stay unlimited while `Config.Supply.strict = false`.

**Delivery drivers are not paid / revenue disappears.** The job (`fueler`) needs a company account with money. On ESX import `sql/03-crankchaos-jobs.sql` or create `society_fueler` in `addon_account` yourself.

**The boss can't set prices.** Prices can be set from `Config.Supply.bossGrade` (default `3`). The shipped ESX SQL gives `fueler` the grades 0-2, so set `bossGrade = 2` there or match it to your own boss grade.

**Two fuel gauges are shown.** Keep `Config.Hud.enabled = 'auto'` so the built-in gauge steps aside for cc\_hud/00%20Overview\.md).

**The engine sputters after refuelling.** The wrong fuel was used (`ccFuelBad`). The vehicle needs a repair.

**Electric vehicles can't be charged.** Use the charging points in `Config.Chargers`. Add the model to `Config.Consumption.electric` if it is not recognised as electric. Verify the shipped charger coordinates in game.

**How do aircraft refuel?** In the zones of `Config.FuelZones` (airfields and helipads).

**The fuel level resets after parking.** Use cc\_garage/00%20Overview\.md), which saves the `ccFuel` state bag.

Still stuck? See Support.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://ccfivem.gitbook.io/ccfivem-docs/vehicles/fuel-stations-cc_fuel.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
