# Configuration

## Configuration

The main configuration file is:

```txt
config.lua
```

This file is fully editable and ignored by Asset Escrow.

### Locale

Set the resource language:

```
Config.Locale = 'en'
```

Available by default:

```
en
it
```

Translations are stored inside:

```
locales/en.lua
locales/it.lua
```

### UI

Customize the fuel station UI:

```
Config.UI = {    
    Brand = 'ZCF FUEL',    
    Accent = '#0A84FF'
}
```

#### Brand

Main title shown inside the NUI.

#### Accent

Main UI color.

Example:

```
Config.UI = {    
    Brand = 'MY SERVER FUEL',    
    Accent = '#FFAA00'
}
```

### ESX

Default ESX Legacy setup:

```
Config.ESX = {    
    Legacy = true,    
    ResourceName = 'es_extended',    
    SharedObjectEvent = 'esx:getSharedObject'
}
```

If your server uses old ESX shared object events:

```
Config.ESX.Legacy = false
```

### Notifications

Notification type:

```
Config.Notification = {    
    Type = 'esx',    
    OxLibResource = 'ox_lib'
}
```

Available types:

```
esxox_libnative
```

### Payment

Choose which account is used when buying fuel:

```
Config.Payment = {    
    Account = 'bank',    
    CurrencySymbol = '$'
}
```

Common values:

```
bankmoneycash
```

Custom ESX accounts can also be used if your framework supports them.

### Database

Default database configuration:

```
Config.Database = {    
    StationTable = 'zcf_fuel_stations',    
    OwnedVehiclesTable = 'owned_vehicles',   
    PlateColumn = 'plate',    
    FuelColumn = 'fuel'
}
```

Change these only if your server uses different table or column names.

### Fuel Persistence

Fuel persistence allows owned vehicles to keep fuel after restart or relog.

```
Config.Persistence = {    
    Enabled = true,    
    LoadOwnedVehicles = true,    
    SaveOwnedVehicles = true,    
    SaveWhenLeavingVehicle = true,    
    SaveIntervalMs = 30000,    
    DefaultFuel = 100.0
}
```

#### SaveIntervalMs

Controls how often the fuel level is saved while driving.

Lower values save more often, but create more database writes.

Recommended:

```
SaveIntervalMs = 30000
```

### ox\_target

Enable or disable `ox_target`:

```
Config.Target = {    
    Enabled = true,    
    Resource = 'ox_target',    
    Distance = 2.0
}
```

If disabled, the resource uses classic 3D text interaction.

```
Config.Target.Enabled = false
```

### ox\_inventory

Enable `ox_inventory` support for jerry cans:

```
Config.Inventory = {    
    UseOxInventory = true,    
    OxInventoryResource = 'ox_inventory',    
    PetrolCanItem = 'WEAPON_PETROLCAN'
}
```

If `ox_inventory` is disabled or not started, the script uses the native GTA petrol can weapon.

### Staff Groups

Staff groups can use staff commands and override station management if allowed.

```
Config.Staff = {    
    AllowedGroups = {        
        admin = true,        
        superadmin = true    
    }
}
```

Commands:

```
/setfuel [amount]
/fueldebug
```

### Fueling Behavior

Main fuel settings:

```
Config.Fueling = {    
    MaxFuel = 100.0,    
    TickInterval = 1000,    
    FullRefuelTime = 60,    
    DisableRefuelWithEngineOn = true,    
    StopEngineAt = 0.2
}
```

#### MaxFuel

Maximum fuel value.

Recommended:

```
MaxFuel = 100.0
```

#### TickInterval

Fuel consumption update interval.

```
TickInterval = 1000
```

#### FullRefuelTime

Seconds needed to refuel from 0 to 100.

```
FullRefuelTime = 60
```

### Low Fuel Warning

```
Config.Reserve = {    
    Enabled = true,    
    Threshold = 10.0,    
    NotifyIntervalMs = 15000,    
    PlaySound = true
}
```

The player receives a warning when fuel is below the configured threshold.

### Jerry Can

```
Config.JerryCan = {    
    Weapon = `WEAPON_PETROLCAN`,    
    CapacityLiters = 50,    
    AmmoPerLiter = 90,    
    FullAmmo = 4500
}
```

The GTA petrol can uses ammo internally.

Formula:

```
FullAmmo = CapacityLiters * AmmoPerLiter
```

Default:

```
50 * 90 = 4500
```

### Fuel Types

Default fuel types:

```
Config.FuelTypes = {    
    benzin95 = {        
        label = 'Gasoline 95',        
        short = '95'    
    },    
    benzin98 = {        
        label = 'Gasoline 98',        
        short = '98'    
    },    
    diesel = {    
        label = 'Diesel',        
        short = 'D'    
    }
}
```

You can disable fuel types per station.

### Fuel Consumption

Fuel usage is calculated using:

```
RPM usage * vehicle class multiplier * vehicle model multiplier
```

#### RPM Usage

```
Config.Usage.RPM = {    
    [1.0] = 0.70,    
    [0.9] = 0.60,    
    [0.8] = 0.50,    
    [0.7] = 0.40,    
    [0.6] = 0.30,    
    [0.5] = 0.20,    
    [0.4] = 0.10,    
    [0.3] = 0.08,    
    [0.2] = 0.05,    
    [0.1] = 0.03,    
    [0.0] = 0.00
}
```

#### Vehicle Class Multipliers

Example:

```
[6] = 1.15, -- Sports
[7] = 1.22, -- Super
[8] = 0.82, -- Motorcycles
ecc...
```

#### Vehicle Model Multipliers

Use spawn names:

```
VehicleMultipliers = {    
    bati = 0.83,    
    cheetah = 1.24,    
    taco = 0.86,
    ecc...
}
```

### Electric Vehicles

Electric vehicles do not consume fuel and cannot be refueled.

```
Config.Usage.ElectricVehicles = {    
    'cyclone',    
    'neon',    
    'raiden',    
    'voltic',
    ecc...
}
```

Add or remove spawn names as needed.

### Pump Hashes

The script detects fuel pumps using prop hashes.

```
Config.PumpHashes = {    
    [-2007231801] = true,    
    [1339433404] = true,    
    [1694452750] = true
}
```

If your map uses custom fuel pump props, add their hashes here.

### Public Stations

Public stations are generated from:

```
Config.Stations.PublicCoords
```

Each coordinate uses:

```
Config.Stations.DefaultPublic
```

### Custom Stations

Example custom station:

```
['zcf_route68'] = {    
    label = 'ZCF Route 68',    
    coords = vector3(1179.21, 2660.42, 37.81),    
    radius = 35.0,    
    managedByJob = 'mechanic',    
    fuelTypes = {        
        benzin95 = true,        
        benzin98 = true,        
        diesel = true    
    },    
    stock = {        
        enabled = true,        
        benzin95 = 2500,        
        benzin98 = 1500,        
        diesel = 2000,        
        maxPerFuel = 7000    
    },    
    management = {        
        enabled = true,        
        canChangePrices = true,        
        canRestock = true,        
        allowStaffOverride = true    
    }
}
```

### Station Management

A managed station can allow a job to:

* change fuel prices
* restock fuel
* manage station stock

Set the job:

```
managedByJob = 'mechanic'
```

Enable management:

```
management = {    
    enabled = true,    
    canChangePrices = true,    
    canRestock = true,    
    allowStaffOverride = true
}
```

### Station Stock

If stock is enabled, fuel purchases reduce the station stock.

```
stock = {    
    enabled = true,    
    benzin95 = 2500,    
    benzin98 = 1500,    
    diesel = 2000,    
    maxPerFuel = 7000
}
```

If disabled, the station has infinite stock:

```
stock = {    
    enabled = false
}
```

### Dynamic Prices

If enabled, prices are randomized on every restart.

```
priceRules = {    
    dynamicOnRestart = true,    
    benzin95 = { min = 2.00, max = 2.07 },    
    benzin98 = { min = 2.17, max = 2.25 },    
    diesel = { min = 2.06, max = 2.14 }
}
```

If disabled, prices are loaded from the database after the first generation.

```
dynamicOnRestart = false
```

### Restock Prices

Restock cost can be calculated from selling price:

```
Config.Restock = {    
    UseSellPriceMultiplier = true,    
    SellPriceMultiplier = 0.65
}
```

Example:

```
Sell price: $2.00/L
Multiplier: 0.65
Restock cost: $1.30/L
```

You can also use fixed prices:

```
Prices = {    
    benzin95 = 1.48,    
    benzin98 = 1.68,    
    diesel = 1.55
}
```

### Security

Server-side checks:

```
Config.Security = {    
    ValidateStationDistance = true,    
    ExtraStationDistance = 18.0,    
    MaxPurchaseLiters = 100,    
    MaxRestockLiters = 5000
}
```

These checks help prevent fake callback abuse.

Recommended:

```
ValidateStationDistance = true
```

### Exports

#### GetFuel

```
local fuel = exports['zcf_fuel']:GetFuel(vehicle)
```

#### SetFuel

```
exports['zcf_fuel']:SetFuel(vehicle, 75.0)
```

#### AddFuel

```
exports['zcf_fuel']:AddFuel(vehicle, 10.0)
```

#### RemoveFuel

```
exports['zcf_fuel']:RemoveFuel(vehicle, 10.0)
```

#### SaveFuelByPlate

```
exports['zcf_fuel']:SaveFuelByPlate('ABC123', 80.0)
```

#### GetSavedFuelByPlate

```
local fuel = exports['zcf_fuel']:GetSavedFuelByPlate('ABC123')
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zcf-development.gitbook.io/zcf_dev/resources/zcf_fuel/configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
