> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-duel-arena-system/configuration.md).

# Configuration

Every config.lua setting of the RedM Duel & Arena System: framework, storage, wagers, ELO, timing, rules, modes, weapons and more.

Everything is in `config.lua`. Restart the resource after editing it:

```
restart cas-duel
```

The menu reads its modes, weapons, arenas, rule options and money settings from this file, so there is nothing to change in the interface when you edit them. All text lives in the language files under `locales/`; see [Languages and Translation](/script-documentation/cas-duel-arena-system/languages.md).

## General

```lua
Config.Framework = 'auto'      -- 'auto' | 'vorp' | 'rsg' | 'standalone'
Config.Storage   = 'auto'      -- 'auto' | 'oxmysql' | 'kvp'
Config.Command   = 'duels'
Config.AdminAce  = 'duels.admin'
Config.WorldYear = 1899
Config.Debug     = false
```

| Setting     | Meaning                                                                                                                           |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `Framework` | Which framework to use. See [VORP, RSG Core and Standalone](/script-documentation/cas-duel-arena-system/frameworks.md).           |
| `Storage`   | Where duel data is saved. See [VORP, RSG Core and Standalone](/script-documentation/cas-duel-arena-system/frameworks.md#storage). |
| `Command`   | The command that opens the menu.                                                                                                  |
| `AdminAce`  | ACE permission for `/duel_admin`. See [Permissions](/script-documentation/cas-duel-arena-system/permissions.md).                  |
| `WorldYear` | Year printed on achievement and record dates. `false` uses the real year.                                                         |
| `Debug`     | Prints arena placement diagnostics to the F8 console.                                                                             |

## Language

```lua
Config.Locale = 'en'   -- 'en' | 'tr' | any file you add to locales/
```

Sets the language of the menu, the duel HUD, notifications and server messages. Names of modes, arenas, outlaws, tournaments, titles and achievements come from the same language file. See [Languages and Translation](/script-documentation/cas-duel-arena-system/languages.md).

## Keys

```lua
Config.Keys = {
    accept  = { hash = 0x760A9C6F, label = 'G' },   -- INPUT_INTERACT_OPTION1
    decline = { hash = 0x84543902, label = 'H' },   -- INPUT_INTERACT_OPTION2
    draw    = { label = 'RMB' },
    strike  = { label = 'F' },
}
```

`accept` and `decline` are the hold prompts for answering a challenge while the menu is closed. `hash` is the control and `label` is the letter shown in the menu, so change both together. `draw` and `strike` are labels only.

## Challenges

```lua
Config.Challenge = {
    radius   = 250.0,   -- metres: "nearby players" list and challenge range
    window   = 30,      -- seconds the challenged player has to answer
    cooldown = 8,       -- seconds between two challenges from the same player
}
```

## Money

```lua
Config.Money = {
    houseCut     = 0.05,
    wagerPresets = { 0, 10, 25, 50, 100, 250 },
    maxWager     = 500,
    wagerStep    = 5,
}

Config.Standalone = { startingCash = 250 }
```

`houseCut` is taken from the wager pot. `Standalone.startingCash` is only used without a framework. See [Wagers, Side Bets and Payouts](/script-documentation/cas-duel-arena-system/wagers-and-betting.md).

## Rating

```lua
Config.Rating = {
    start = 1200,
    k     = 32,
    floor = 100,
}
```

A higher `k` makes ratings move faster. See [Ranked Matchmaking](/script-documentation/cas-duel-arena-system/matchmaking.md#elo-rating).

## Timing

All values are milliseconds unless noted.

```lua
Config.Timing = {
    firstIntro   = 3200,
    paceMs       = 520,
    intro        = 2600,
    count        = 750,
    steadyMin    = 900,
    steadyVar    = 1600,
    banner       = 2700,
    foul         = 2500,
    hitGrace     = 250,
    missGrace    = 700,
    quickdrawLimit = 3000,
    minReaction  = 110,
    prematchTimeout = 90,
    readyHandoff = 1100,
}

Config.Referee = { slack = 250 }
```

| Setting                  | Meaning                                                                            |
| ------------------------ | ---------------------------------------------------------------------------------- |
| `firstIntro`             | First round: fade and teleport time.                                               |
| `paceMs`                 | First round: walking time per pace, added to `firstIntro`.                         |
| `intro`                  | Later rounds: time to return to the marks.                                         |
| `count`                  | Length of each step of the 3, 2, 1 countdown.                                      |
| `steadyMin`, `steadyVar` | The steady pause lasts `steadyMin` plus a random part of `steadyVar`.              |
| `banner`                 | How long the round result card stays on screen.                                    |
| `foul`                   | How long the false start warning stays on screen.                                  |
| `hitGrace`               | After the first hit, how long to wait for a near simultaneous hit before deciding. |
| `missGrace`              | When both guns are empty, how long to wait for bullets still in flight.            |
| `quickdrawLimit`         | Quick Draw: the draw window after the signal.                                      |
| `minReaction`            | A draw faster than this after the signal is a false start.                         |
| `prematchTimeout`        | Seconds both players have to ready up before the duel is called off.               |
| `readyHandoff`           | Delay between both players being ready and the fade to the arena.                  |
| `Referee.slack`          | Tolerance in milliseconds, on top of ping, when checking reported reaction times.  |

{% hint style="warning" %}
Lowering `minReaction` or raising `slack` makes it easier for a modified client to report impossible draw times. Leave them unless you have a reason.
{% endhint %}

## Rules

```lua
Config.Rules = {
    ammoSteps  = { 1, 2, 3, 6, 12, 0 },   -- 0 = unlimited
    paceSteps  = { 5, 10, 15, 20 },
    timerSteps = { 15, 30, 45, 60 },
    defaults = {
        healing = true, tonics = false, melee = false,
        ammo = 6, paces = 10, timer = 30, foul = 'warn',   -- foul: 'warn' | 'round' | 'match'
    },
}
```

The steps are the choices offered in the menu. `defaults` are preselected in the menu and used by matchmaking queues and tournaments. Each default should be one of its steps. See [Duel Modes and Rules](/script-documentation/cas-duel-arena-system/duel-modes.md#rules).

## Modes

```lua
Config.Modes = {
    { id = 'classic',   format = { type = 'bo', options = { 1, 3, 5 }, default = 1 } },
    { id = 'quickdraw', format = { type = 'bo', options = { 1, 3, 5 }, default = 3 } },
    { id = 'bo3',       format = { type = 'bo', fixed = 3 } },
    { id = 'bo5',       format = { type = 'bo', fixed = 5 } },
    { id = 'firstto',   format = { type = 'ft', options = { 3, 5, 7, 10 }, default = 5 } },
    { id = 'headshot',  format = { type = 'bo', options = { 1, 3, 5 }, default = 3 } },
    { id = 'oneshot',   format = { type = 'bo', options = { 1, 3, 5 }, default = 3 } },
    { id = 'melee',     format = { type = 'bo', options = { 1, 3, 5 }, default = 3 } },
}
```

* The name and description of each mode are `mode_<id>` and `mode_<id>_blurb` in the [language file](/script-documentation/cas-duel-arena-system/languages.md). Add `name = '...'` to a line to use a fixed name instead.
* `type = 'bo'` is best of N. `type = 'ft'` is first to N.
* `options` are the formats offered in the menu and `default` is preselected. `fixed` locks a mode to one format.
* To remove a mode, delete its line. Make sure no queue, tournament or board post still uses it.
* The behaviour of a mode comes from its `id`. You can change formats and remove modes, but a new id behaves like Classic Duel.

## Weapons

```lua
Config.Weapons = {
    cattleman    = { hash = 'WEAPON_REVOLVER_CATTLEMAN',    ammo = 'AMMO_REVOLVER', clip = 6 },
    schofield    = { hash = 'WEAPON_REVOLVER_SCHOFIELD',    ammo = 'AMMO_REVOLVER', clip = 6 },
    doubleaction = { hash = 'WEAPON_REVOLVER_DOUBLEACTION', ammo = 'AMMO_REVOLVER', clip = 6 },
    volcanic     = { hash = 'WEAPON_PISTOL_VOLCANIC',       ammo = 'AMMO_PISTOL',   clip = 10 },
    mauser       = { hash = 'WEAPON_PISTOL_MAUSER',         ammo = 'AMMO_PISTOL',   clip = 10 },
    semiauto     = { hash = 'WEAPON_PISTOL_SEMIAUTO',       ammo = 'AMMO_PISTOL',   clip = 8 },
    knife        = { hash = 'WEAPON_MELEE_KNIFE',  melee = true },
    fists        = { hash = 'WEAPON_UNARMED',      melee = true },
}
Config.DefaultWeapon = 'cattleman'
Config.DefaultMeleeWeapon = 'fists'
```

| Field   | Meaning                                                                                           |
| ------- | ------------------------------------------------------------------------------------------------- |
| `hash`  | The game weapon name.                                                                             |
| `ammo`  | The ammo type the weapon uses.                                                                    |
| `clip`  | How many rounds fit in the weapon. The ammo limit fills this first and keeps the rest in reserve. |
| `melee` | `true` for melee weapons. Melee weapons are only offered in Melee mode.                           |

You can add a sidearm with a new id. Name it by adding `weapon_<id>` to each [language file](/script-documentation/cas-duel-arena-system/languages.md), for example `weapon_lemat = 'LeMat Revolver',`. Until then the menu shows the id as the name. It uses the artwork of a similar weapon until you give it its own; see [Editing the Interface](/script-documentation/cas-duel-arena-system/interface.md#adding-artwork-for-a-new-weapon).

`DefaultWeapon` and `DefaultMeleeWeapon` are used whenever a weapon is missing or not allowed for the mode.

## The duelist

```lua
Config.Duel = {
    health       = 600,
    paceLength   = 0.75,
    walkOut      = true,
    lockOn       = false,
    bucketBase   = 7100,
    population   = true,
    meleePaces   = 2,
}
```

| Setting      | Meaning                                                                                                                                              |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `health`     | Temporary health for the duel, so a single bullet does not kill. The player's own health is restored afterwards.                                     |
| `paceLength` | Metres per pace. Duelists stand `paces × paceLength` either side of the middle.                                                                      |
| `walkOut`    | First round: start back to back and walk the paces. `false` starts every round on the marks.                                                         |
| `lockOn`     | `false` turns aim assist lock-on off during duels.                                                                                                   |
| `bucketBase` | Each match runs in routing bucket `bucketBase` plus its match number (wrapping every 900). Change it if another resource uses buckets in that range. |
| `population` | `true` keeps ambient townsfolk inside the duel's bucket.                                                                                             |
| `meleePaces` | Distance in paces for Melee duels.                                                                                                                   |

## Everything else

| Section                                                 | Documented in                                                                                                                             |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `Config.Titles`                                         | [Profiles, Leaderboard and Achievements](/script-documentation/cas-duel-arena-system/profiles-and-achievements.md#titles)                 |
| `Config.Arenas`                                         | [Arenas](/script-documentation/cas-duel-arena-system/arenas.md)                                                                           |
| `Config.Npc`                                            | [NPC Outlaw Duels](/script-documentation/cas-duel-arena-system/npc-outlaws.md)                                                            |
| `Config.Queue`                                          | [Ranked Matchmaking](/script-documentation/cas-duel-arena-system/matchmaking.md#matchmaking-queues)                                       |
| `Config.Board`                                          | [Ranked Matchmaking](/script-documentation/cas-duel-arena-system/matchmaking.md#the-open-challenge-board)                                 |
| `Config.Tournament`                                     | [Tournaments](/script-documentation/cas-duel-arena-system/tournaments.md#templates)                                                       |
| `Config.Leaderboard`, `Config.Season`, `Config.History` | [Profiles, Leaderboard and Achievements](/script-documentation/cas-duel-arena-system/profiles-and-achievements.md#leaderboard-and-season) |
| `Config.Bets`                                           | [Wagers, Side Bets and Payouts](/script-documentation/cas-duel-arena-system/wagers-and-betting.md#spectator-side-bets)                    |
| `Config.Achievements`                                   | [Profiles, Leaderboard and Achievements](/script-documentation/cas-duel-arena-system/profiles-and-achievements.md#achievements)           |
