# Installation

## Installation

Follow these steps carefully to install `zcf_fuel`.

### 1. Download the Resource

Download the resource from your purchase page and place it inside your server resources folder.

Recommended path:

```txt
resources/[zcf]/zcf_fuel
```

The folder name must be:

```
zcf_fuel
```

### 2. Install SQL

Import the SQL file included with the resource:

```
sql/install.sql
```

Default SQL:

```
CREATE TABLE IF NOT EXISTS `zcf_fuel_stations` (    `station_id` VARCHAR(80) NOT NULL,    `prices` LONGTEXT NOT NULL,    `stock` LONGTEXT NOT NULL,    `updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,    PRIMARY KEY (`station_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;ALTER TABLE `owned_vehicles`ADD COLUMN IF NOT EXISTS `fuel` FLOAT NOT NULL DEFAULT 100;
```

### SQL Compatibility Note

Some older MySQL or MariaDB versions may not support:

```
ADD COLUMN IF NOT EXISTS
```

If you get an SQL error, manually check if the `fuel` column already exists.

If it does not exist, run:

```
ALTER TABLE `owned_vehicles`
ADD COLUMN `fuel` FLOAT NOT NULL DEFAULT 100;
```

### 3. Server.cfg

Add the resource after `es_extended` and `oxmysql`.

Example:

```
ensure oxmysql
ensure es_extended
ensure zcf_fuel
```

If you use optional integrations, start them before `zcf_fuel`:

```
ensure ox_lib
ensure ox_inventory
ensure ox_target
ensure zcf_fuel
```

### 4. Dependencies

#### Required

```
es_extendedoxmysql
```

#### Optional

```
ox_targetox_inventoryox_lib
```

### 5. Configure the Script

Open:

```
config.lua
```

Main options to check first:

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

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

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

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

### 6. Restart the Server

After installing the SQL and configuring the resource, restart your server.

You can also use:

```
refreshensure zcf_fuel
```

A full restart is recommended after the first installation.

### 7. Test Checklist

After installation, test the following:

* Fuel station opens correctly
* Vehicle can be refueled
* Payment is removed from the correct account
* Jerry can can be bought
* Jerry can can be refilled
* Vehicle consumes fuel while driving
* Fuel saves in the database
* Fuel loads after vehicle respawn/relog
* `/setfuel` works for staff
* `/fueldebug` works for staff
* `ox_target` interaction works if enabled
* 3D text fallback works if `ox_target` is disabled

### Common Issues

#### The UI does not open

Check that the folder name is exactly:

```
zcf_fuel
```

Also make sure the resource is started and there are no client console errors.

#### Fuel does not save

Check that the `owned_vehicles` table has the `fuel` column.

```
SHOW COLUMNS FROM owned_vehicles LIKE 'fuel';
```

#### ox\_target does not show the pump option

Make sure `ox_target` is started before `zcf_fuel`.

```
ensure ox_targetensure zcf_fuel
```

Also check:

```
Config.Target.Enabled = true
```

#### Jerry can does not work with ox\_inventory

Check that the item name matches your inventory setup:

```
Config.Inventory.PetrolCanItem = 'WEAPON_PETROLCAN'
```

Some inventories may use a different weapon item name.


---

# 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/installation.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.
