# Settings

## 🎮 Arena PvP — Script Configuration (config.lua)

This page explains **how to configure the Arena PvP** through the `config.lua` file in a simple and clear way.

You will understand:

* What each configuration does
* What you can safely edit
* How each game mode works
* How to configure maps properly

> ⚠️ After editing `config.lua`, always restart the resource:
>
> ```
> restart energy_arenapvpv3
> ```

***

## 📂 File Location

The configuration file is usually located at:

```
shared/config.lua
```

or

```
config.lua
```

***

## 🌎 General Settings

### 🔤 Language

```lua
Language = 'en', -- en, ptbr
```

Defines the script language.

| Value | Language   |
| ----- | ---------- |
| en    | English    |
| ptbr  | Portuguese |
| es    | Spanish    |
| fr    | French     |

Example:

```lua
Language = 'ptbr'
```

***

### 🖼 Logo

```lua
Logo = 'https://i.postimg.cc/157xSPx9/image.png'
```

Image displayed in the Arena menu.

* Must be a direct image URL (png/jpg/webp).
* You can use Postimg, Imgur, etc.

***

### 🔫 Weapon Spawn Mode

```lua
spawnWeapon = 'client'
spawnAmmoo = 'client'
```

#### spawnWeapon

| Value  | Description                                                         |
| ------ | ------------------------------------------------------------------- |
| client | Weapon given by client (default)                                    |
| server | Weapon given by server (recommended for stricter anti-cheat setups) |

If needed:

```lua
spawnWeapon = 'server'
```

#### spawnAmmoo

🚫 **Do not change this value.**

***

## 🎮 Commands

### Open Arena Command

```lua
CommandOpenArena = {
    name = 'iniciar',
    enable = true,
}
```

* `name` → command players type (example: `/arena`)
* `enable` → enable or disable the command

Example:

```lua
name = 'arena'
```

***

### Exit Arena Command

```lua
exitArenaCommand = 'sairarena'
```

Players exit using:

```
/sairarena
```

***

### Open Menu via Event

You can also open the Arena menu using:

```lua
TriggerEvent("energy_arena:open")
```

***

## 📍 Arena Marker (Locations)

```lua
Locations = {
    vec3(-290.41, -1916.47, 29.95),
}
```

Defines where the Arena access marker appears.

To add more locations:

```lua
vec3(200.0, -900.0, 30.0),
```

> If the marker does not appear, the Z coordinate is usually incorrect.

***

## 💥 Defuse Explosion

```lua
ExplisionAnimation = true
```

| Value | Result                                               |
| ----- | ---------------------------------------------------- |
| true  | Bomb explosion enabled                               |
| false | Explosion disabled (recommended if using anti-cheat) |

***

## 🎬 Animations

```lua
Animations = {
    Dead = {
        name = 'misslamar1dead_body',
        dict = 'dead_idle',
    },
}
```

Defines the death animation inside Arena.

Normally you do not need to edit this.

***

## ⌨ Keys (Keybinds)

### Leave Training

```lua
Keys = {
    LeaveTraining = {
        command = 'arena:leaveTraining',
        description = 'Return to lobby',
        key = 'F'
    },
}
```

* `key` → key to leave training
* `description` → displayed text
* `command` → internal command triggered

Example:

```lua
key = 'G'
```

***

## 💰 Defuse Economy

```lua
Money = {
    kill = 100,
    loseRound = 500,
    winRound = 1000,
    plantSpike = 1000,
}
```

Defines rewards in Defuse mode:

* `kill` → money per kill
* `loseRound` → reward for losing round
* `winRound` → reward for winning round
* `plantSpike` → reward for planting the bomb

***

## 🛒 Buy Phase (Defuse Shop)

```lua
BuyPhase = {
    key = 'E',
    timeToBuy = 10,
    initialMoney = 10000,
    percentageSell = 1,
}
```

#### Explanation

* `key` → key to open shop
* `timeToBuy` → buy phase duration (seconds)
* `initialMoney` → starting money
* `percentageSell`
  * `1` = 100%
  * `0.5` = 50%

***

### Default Weapons

```lua
initialWeapons = {
    {key = 'WEAPON_PISTOL', ammo = 100},
    {key = 'WEAPON_KNIFE', ammo = 1},
},
```

Defines the weapons players start with.

***

### Store Structure

Each category inside `store` looks like:

```lua
[1] = {
    type = 'pistol',
    label = 'Pistols',
    items = {
        {label = 'Glock', key = 'WEAPON_PISTOL', price = 500, ammo = 100, type = 'pistol'},
    },
},
```

To add a weapon:

* `label` → display name
* `key` → weapon name
* `price` → cost
* `ammo` → ammo amount
* `type` → category

***

## 🎯 Game Modes (Modes)

***

### Deathmatch

```lua
['deathmatch'] = {
    queueCountdown = 25,
    timeLimit = 420,
    players = {min = 1, max = 25},
    randomCoords = true,
    autoRespawn = true
}
```

* `randomCoords` → random spawn positions
* `autoRespawn` → instant respawn

***

### Gungame

```lua
['gungame'] = {
    finishKill = 45,
    killsToUpgrade = 3,
}
```

* `finishKill` → kills required to win
* `killsToUpgrade` → kills to switch weapon

The `weapons` list defines the weapon order.

***

### Defuse

```lua
['defuse'] = {
    roundTime = 55,
    timeToDefuse = 10,
    maxRounds = 20,
    buyPhase = true,
}
```

* `roundTime` → round duration
* `timeToDefuse` → time required to defuse
* `maxRounds` → maximum rounds
* `buyPhase` → enables shop

#### ChooseTeam

Handles:

* Team selection time
* Attack team spawns
* Defense team spawns
* Camera position during selection

***

### Training Mode

Contains two sub-modes:

#### Aimlab

Aim training with fixed target positions.

#### NPC

Training against NPC enemies.

***

## 🗺 Maps

Each map contains:

```lua
[1] = {
    name = 'Map Name',
    img = 'IMAGE_URL',
    arenaData = {cds = vec3(x,y,z), range = 300.0},
    gamemodes = { ... },
}
```

### arenaData

* `cds` → map center
* `range` → map radius

### gamemodes

Defines allowed modes:

```lua
['deathmatch'] = true,
['gungame'] = true,
['defuse'] = true,
```

To disable a mode:

```lua
['defuse'] = false
```

### randomCoords

List of random spawn locations.

### spike

Defines plant zones in Defuse mode:

* `radius` → plant area radius
* `radiusToDefuse` → defuse distance
* `coords` → bomb position

***

## 🏠 Lobby

```lua
Lobby = {
    [1] = { pos = vec(-1049.89, -2754.44, -65.48), h = 182.70 },
    cam = {
        pos = vec3(-1049.29, -2763.52, -65.48),
        fov = 45
    },
}
```

Defines:

* Player spawn position in lobby
* Heading (direction)
* Camera position
* Zoom (FOV)

***

## 🚨 Common Issues

#### Marker not appearing

* Z coordinate incorrect
* Resource not restarted

#### Players spawning on top of each other

* Not enough spawn points in `randomCoords`
* Not enough spawns in `coordsAttack/coordsDefense`

#### Defuse not starting

* `players.min` too high
* Map has Defuse disabled
