# Installation

## 📥 Installation

### Requirements

Before installing, make sure you have the following resources running on your server:

* [oxmysql](https://github.com/overextended/oxmysql) — Database
* [ox\_lib](https://github.com/overextended/ox_lib) — Utility library
* **ESX** or **QBCore** — Framework
* **ox\_target** or **qb-target** — *(Optional, for target mode)*

***

### Step 1: Download

Download the latest version of **Elena Truck Job V2** from your Tebex purchase.

***

### Step 2: Extract

Extract the folder and rename it to:elenatruckingjobv2

```

Place it in your server's `resources` folder:
resources/
└── [esx] or [qb]/
└── elenatruckingjobv2/
```

***

### Step 3: Import SQL

Import the SQL file into your database.

📁 **File:** `sql/install.sql`

```sql
CREATE TABLE IF NOT EXISTS `etruckjob_players` (
  `identifier` VARCHAR(60) NOT NULL,
  `level` INT NOT NULL DEFAULT 1,
  `xp` INT NOT NULL DEFAULT 0,
  `total_deliveries` INT NOT NULL DEFAULT 0,
  `total_earnings` INT NOT NULL DEFAULT 0,
  `selected_vehicle` VARCHAR(50) DEFAULT 'beginner',
  `consecutive_deliveries` INT NOT NULL DEFAULT 0,
  `last_delivery` TIMESTAMP NULL DEFAULT NULL,
  PRIMARY KEY (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `etruckjob_history` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `identifier` VARCHAR(60) NOT NULL,
  `route_id` VARCHAR(50) NOT NULL,
  `payment` INT NOT NULL DEFAULT 0,
  `xp` INT NOT NULL DEFAULT 0,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_identifier` (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```

💡 **Note:** The tables will also be created automatically when the resource starts, but manual import is recommended.

### Step 4: Configure

Open `config/main.lua` and set your framework:

```
Config.Framework = 'qb'    -- 'esx' or 'qb'
Config.Locale = 'en'        -- 'en' or 'tr'
Config.UseTarget = true     -- true = target mode, false = marker mode
Config.TargetSystem = 'qb'  -- 'ox' or 'qb'
```

📖 See the Configuration page for all options.

### Step 5: Add to server.cfg

Add the following line to your `server.cfg`:

```
ensure oxmysql
ensure ox_lib
ensure es_extended  # or qb-core
ensure elenatruckingjobv2
```

⚠️ **Important:** Make sure `elenatruckingjobv2` starts **AFTER** your framework and dependencies.

### Step 6: Restart Server

Restart your server and check the console for:

```
╔═══════════════════════════════════════╗
║       Elena Truck Job V2 v2.0.0       ║
║         by Elena Scripts              ║
╚═══════════════════════════════════════╝
[Elena Truck Job V2] Veritabanı hazır.
[Elena Truck Job V2] Client hazır!
```

If you see this, the installation is complete! ✅


---

# 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://elena-scripts.gitbook.io/elenascripts/jobs-and-activities/truck-job-v2/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.
