# Fuel add system

{% hint style="info" %}
Our HUD is already compatible with several fuel systems: cdn-fuel, frfuel, LegacyFuel, lj-fuel, nd\_fuel, okokGasStation, ox\_fuel, ps-fuel, Renewed-Fuel, ti\_fuel.
{% endhint %}

## Custom Fuel System Integration

### How to add your own fuel system

1. Create a new `.lua` file in this folder (e.g., `myfuel.lua`)
2. Use this template:

```lua
-- My Custom Fuel System
return {
    name = "myfuel",           -- unique identifier
    resourceName = "myfuel",   -- resource name to check (use nil for no check)

    GetFuel = function(vehicle)
        -- Your code to get fuel level here
        local success, result = pcall(function()
            return exports['myfuel']:GetFuelLevel(vehicle)
        end)

        if success and result then
            return math.ceil(result)  -- return 0-100
        end

        return nil  -- return nil if failed
    end
}
```

3. Save the file
4. In `config.lua`, set:
   * `Config.FuelSystem = "auto"` (auto-detect all systems)
   * OR `Config.FuelSystem = "myfuel"` (use only your system)

### Available Systems

* **LegacyFuel** - LegacyFuel system
* **ox\_fuel** - Overextended fuel
* **cdn-fuel** - CDN Fuel
* **ps-fuel** - Project Sloth fuel
* **lj-fuel** - LJ Fuel
* **okokGasStation** - okokGasStation
* **Renewed-Fuel** - Renewed Fuel
* **ti\_fuel** - TI Fuel
* **nd\_fuel** - ND Fuel
* **frfuel** - FR Fuel
* **native** - GTA V native fuel (fallback)

### Configuration

In `config.lua`:

```lua
-- Auto-detect (tries all systems in order)
Config.FuelSystem = "auto"

-- Or specify one system
Config.FuelSystem = "LegacyFuel"
```

### Priority Order (when using "auto")

The system will try fuel systems in this order:

1. Your configured system (if specified)
2. All systems in `editable/fuel/` folder
3. Native GTA V fuel (fallback)

### Notes

* Return values should be between 0-100
* Use `math.ceil()` to round up decimals
* Return `nil` if fuel cannot be retrieved
* The `resourceName` field is optional (set to `nil` if not needed)
