# Installation

Follow these steps to install EL\_EVENTS on your FiveM server.

***

### Step 1: Download

Download the latest release from your purchase platform (Tebex or CFX Forum).

***

### Step 2: Extract

Extract the `el_events` folder into your server's `resources` directory:

```
resources/
└── el_events/
├── config.lua
├── fxmanifest.lua
├── server/
├── client/
├── shared/
└── ui/
```

***

### Step 3: Database Setup

The tables are created automatically on first start. However, you can also import them manually:

```sql
CREATE TABLE IF NOT EXISTS `el_events_history` (
    `id` INT AUTO_INCREMENT PRIMARY KEY,
    `event_id` VARCHAR(50) NOT NULL,
    `event_type` VARCHAR(20) NOT NULL,
    `location_label` VARCHAR(100) DEFAULT 'Unknown',
    `started_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    `ended_at` TIMESTAMP NULL,
    `duration_seconds` INT DEFAULT 0,
    `result` VARCHAR(20) DEFAULT 'expired',
    `claimed_by` VARCHAR(100) DEFAULT NULL,
    `claimed_by_id` INT DEFAULT NULL,
    `reward_money` INT DEFAULT 0,
    `reward_items` TEXT DEFAULT NULL,
    `participants` INT DEFAULT 0
) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

CREATE TABLE IF NOT EXISTS `el_events_stats` (
    `id` INT AUTO_INCREMENT PRIMARY KEY,
    `date` DATE NOT NULL,
    `total_events` INT DEFAULT 0,
    `total_rewards` INT DEFAULT 0,
    `total_participants` INT DEFAULT 0,
    `airdrop_count` INT DEFAULT 0,
    `hotzone_count` INT DEFAULT 0,
    `convoy_count` INT DEFAULT 0,
    `treasure_count` INT DEFAULT 0,
    UNIQUE KEY `date_unique` (`date`)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
```

### Step 4: Configure

Open `config.lua` and adjust settings for your server:

1. Set your framework: `Config.Framework = 'qb'` or `'esx'` or `'auto'`
2. Set your language: `Config.Locale = 'en'` or `'tr'`
3. Set your Discord webhook URL
4. Adjust event settings, rewards, and locations
5. Configure admin groups

See the **Configuration** page for detailed information on every setting.

### Step 5: Add to server.cfg

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

```
ensure oxmysql
ensure el_events
```

**Important:** Make sure `oxmysql` starts BEFORE `el_events`.

***

### Step 6: Start and Verify

Start your server. You should see this in the console:

```
═══════════════════════════════════════
Elena Events v1.0.0 started!
═══════════════════════════════════════
Framework: qb
Scheduler: Active
Database: Active
Discord: Active
═══════════════════════════════════════
```

### Step 7: Test

1. Join your server
2. Open the admin panel: `/eventadmin`
3. Start a test event by clicking any "Launch Event" button
4. Verify the event appears on the map and works correctly

***

### Troubleshooting Installation

| Issue                  | Solution                                                      |
| ---------------------- | ------------------------------------------------------------- |
| Tables not created     | Ensure oxmysql starts before el\_events in server.cfg         |
| Framework not detected | Set `Config.Framework` manually instead of `'auto'`           |
| Events not starting    | Check `Config.Scheduler.minPlayers` - lower it for testing    |
| Admin panel won't open | Ensure your player group is in `Config.AdminGroups`           |
| No Discord logs        | Verify your webhook URL is correct and the bot has permission |


---

# 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/core-systems/el-events/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.
