> 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-shooting-range/configuration.md).

# Configuration

Full configuration reference for the RedM Shooting Range & Competition script: framework, commands, keys, currencies, wagers, ranges, weapons, modes, targets, match rules, ranked, challenges, tourname

Every setting is in `shared/config.lua`. It is the single source of truth: the server enforces these values and the menu reads them when it opens. Every text a player sees is in the language file instead. See [Languages and Translation](/script-documentation/cas-shooting-range/languages.md).

Restart the resource after changing the config.

## General

| Setting            | Default  | What it does                                                                                         |
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------- |
| `Config.Framework` | `'auto'` | `'auto'` uses whichever of `vorp_core` or `rsg-core` is running. Force one with `'vorp'` or `'rsg'`. |
| `Config.Locale`    | `'en'`   | The language file to use, `locales/<Locale>.lua`.                                                    |
| `Config.Debug`     | `false`  | Prints detailed logs to the server console.                                                          |

## Commands and permissions

| Setting                  | Default                     | What it does                                                           |
| ------------------------ | --------------------------- | ---------------------------------------------------------------------- |
| `Config.Command`         | `'shootingrange'`           | The player command.                                                    |
| `Config.CommandAnywhere` | `false`                     | `true` lets the command open the menu anywhere, not just near a range. |
| `Config.AdminCommand`    | `'shootingadmin'`           | The admin command.                                                     |
| `Config.AdminAce`        | `'shootingrange.admin'`     | The ACE permission for admins.                                         |
| `Config.AdminGroups`     | `{ 'admin', 'superadmin' }` | VORP groups or RSG permissions that count as admin.                    |

See [Permissions and Admin Commands](/script-documentation/cas-shooting-range/permissions.md).

## Keys and prompts

| Setting                 | Default          | What it does                                                               |
| ----------------------- | ---------------- | -------------------------------------------------------------------------- |
| `Config.Keys`           | E, G, H, G, G, H | Control hashes for Open, Practice, Invite, Forfeit, EndRun and Restart.    |
| `Config.KeyLabels`      |                  | The key letters shown in the menu's hint lines. Change them with the keys. |
| `Config.PromptDistance` | `2.5`            | Metres from the menu point at which the prompt shows.                      |
| `Config.HoldMs`         | `900`            | Hold time for prompts and practice keys, in ms.                            |
| `Config.ForfeitHoldMs`  | `2500`           | Hold time to forfeit, in ms.                                               |

See [Commands and Controls](/script-documentation/cas-shooting-range/commands.md#changing-the-keys).

## Map marker and range master

| Setting                | Default                  | What it does                                 |
| ---------------------- | ------------------------ | -------------------------------------------- |
| `Config.Blips.Enabled` | `true`                   | Shows a map marker on every range.           |
| `Config.Blips.Sprite`  | `'blip_mp_shootout'`     | The marker icon.                             |
| `Config.Ped.Enabled`   | `true`                   | Spawns the range master at every menu point. |
| `Config.Ped.Model`     | `'u_m_m_valgunsmith_01'` | The range master's model.                    |
| `Config.Ped.Scenario`  | `'WORLD_HUMAN_SMOKE'`    | What he does. `nil` makes him just stand.    |

## Currencies

```lua
Config.Currencies = {
    money  = { enabled = true },
    gold   = { enabled = true, rsgItem = 'gold_bar' },
    custom = { enabled = true, item = 'range_token' },
}
```

| Setting          | What it does                                                 |
| ---------------- | ------------------------------------------------------------ |
| `money.enabled`  | VORP money or the RSG `cash` account.                        |
| `gold.enabled`   | VORP gold, or on RSG the item named in `rsgItem`.            |
| `custom.enabled` | Range Tokens, the item named in `item`, on either framework. |

See [Wagers, Entry Fees and Payouts](/script-documentation/cas-shooting-range/wagers.md).

## Wager steps and commission

| Setting                              | What it does                                           |
| ------------------------------------ | ------------------------------------------------------ |
| `Config.WagerSteps.<currency>.wager` | The wager amounts a host can pick.                     |
| `Config.WagerSteps.<currency>.fee`   | The entry fees a host can pick.                        |
| `Config.Commission.Steps`            | The commission rates a host can pick, in %.            |
| `Config.Commission.AllowOff`         | `false` makes the commission mandatory in every match. |

## Ranges

`Config.Arenas` holds every range. See [Shooting Ranges](/script-documentation/cas-shooting-range/ranges.md).

## Weapons

`Config.Weapons` holds every weapon: `hash` (the game weapon name), `mag` (rounds per load) and `reload` (seconds). See [Targets and Weapons](/script-documentation/cas-shooting-range/targets-and-weapons.md#weapons).

## Modes

```lua
Config.Modes = {
    bottle     = { enabled = true, preset = { rounds = 1, targetCount = 10, timeLimit = 0, targetType = 'bottles' } },
    breakall   = { enabled = true, preset = { rounds = 1, timeLimit = 0 } },
    bo3        = { enabled = true, preset = { rounds = 3, timeLimit = 0 } },
    bo5        = { enabled = true, preset = { rounds = 5, timeLimit = 0 } },
    timed      = { enabled = true, preset = { rounds = 1, timeLimit = 45, targetCount = 20 } },
    accuracy   = { enabled = true, preset = { rounds = 1, ammoLimit = 12, timeLimit = 60 } },
    speed      = { enabled = true, preset = { rounds = 1, timeLimit = 0 } },
    onemag     = { enabled = true, preset = { rounds = 1, reload = false, ammoLimit = 0 } },
    elim       = { enabled = true, preset = { rounds = 3, maxPlayers = 4 } },
    solo       = { enabled = true, preset = {} },
    tournament = { enabled = true, preset = {} },
}
Config.SpeedMissPenalty = 500 -- Speed Challenge: each miss adds 0.5 s
```

* `enabled = false` removes a mode from the menu.
* `preset` holds the values applied when a host picks the mode. The host can still change them afterwards, within the limits below.
* A few rules are fixed by the mode: Best of 3 is always 3 rounds, Best of 5 always 5, One Magazine never reloads, Timed always has a clock (45 s if none is set) and Accuracy always has a clock or an ammunition limit.

See [Match Modes and Rules](/script-documentation/cas-shooting-range/modes.md).

## Targets

```lua
Config.Targets = {
    bottles   = { models = { 'p_bottle02x', 'p_bottle03x', 'p_bottlebeer01x' }, stand = 'p_fencepost_01x', hp = 1, radius = 0.35, icon = 'generic_bottle' },
    -- ...
}
Config.MixedCycle = { 'bottles', 'cans', 'hanging', 'precision', 'moving' }
Config.SuddenDeathModel = 'p_coin01x'
```

| Field    | What it does                                                |
| -------- | ----------------------------------------------------------- |
| `models` | Props tried in order. Invalid ones are skipped.             |
| `stand`  | The prop the target sits on. `nil` stands it on the ground. |
| `hang`   | Height of a hanging target, in metres.                      |
| `float`  | Height of a floating target, in metres.                     |
| `swing`  | Makes the target always move, with this much sway.          |
| `hp`     | Hits needed to break it.                                    |
| `radius` | How close a shot must land to count as a hit, in metres.    |
| `icon`   | The menu icon.                                              |

`Config.MixedCycle` is the order the Mixed Set cycles through. `Config.SuddenDeathModel` is the coin used to break a tie.

## Limits

```lua
Config.Limits = {
    MinTargets = 1, MaxTargets = 20,
    MinDistance = 5,               -- yards
    Rounds = { 1, 3, 5 },
    TimeLimits = { 0, 30, 45, 60, 90, 120 },
    AmmoLimits = { 0, 12, 18, 24, 36 },
    MaxPlayers = 4,
}
```

These are the choices the menu offers and the server accepts. `0` means no limit.

## Match rules

```lua
Config.Rules = {
    TieWindow = 250,
    Lockout = 2000,
    NetSlack = 300,
    MaxPingComp = 400,
    MinShotGap = 70,
    Leash = 4.0,
    InviteSeconds = 30,
    InviteDistance = 75.0,
    DisconnectGrace = 15,
    MaxRoundSeconds = 300,
    FreezeShooters = true,
    JoinRange = 120.0,
    PrematchSeconds = 90,
    ResumeSeconds = 120,
    AutoClaimSeconds = 90,
}
```

| Setting            | Default | What it does                                                                                                               |
| ------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------- |
| `TieWindow`        | 250 ms  | Two finishes this close are a tie, which goes to sudden death.                                                             |
| `Lockout`          | 2000 ms | The penalty for a false start or a wrong lane shot.                                                                        |
| `NetSlack`         | 300 ms  | How long the server waits for the other shooter's finish after the first one.                                              |
| `MaxPingComp`      | 400 ms  | The most lag compensation a shot can get. Half the shooter's ping is taken off each shot's time, up to this.               |
| `MinShotGap`       | 70 ms   | The shortest time allowed between two shots. Faster shots are ignored.                                                     |
| `Leash`            | 4.0 m   | How far a shooter may stray from their lane before they are warned. Shots fired from more than 2 m beyond it do not count. |
| `InviteSeconds`    | 30      | How long an invite stays open.                                                                                             |
| `InviteDistance`   | 75.0 m  | The nearby players list and invite range.                                                                                  |
| `DisconnectGrace`  | 15 s    | Wait before a win can be claimed after the opponent drops.                                                                 |
| `MaxRoundSeconds`  | 300 s   | The longest a round can last.                                                                                              |
| `FreezeShooters`   | `true`  | Holds shooters in their lanes for the whole match.                                                                         |
| `JoinRange`        | 120.0 m | How close to the range a player must be to ready up, check in for a tournament or use the command.                         |
| `PrematchSeconds`  | 90      | The pre-match check returns to the lobby if not finished in time.                                                          |
| `ResumeSeconds`    | 120     | A dropped player who comes back within this time rejoins their match.                                                      |
| `AutoClaimSeconds` | 90      | If the opponent does not come back, the win is awarded after this time.                                                    |

## Quick match

`Config.QuickMatch.Arena` and `Config.QuickMatch.Settings`. See [Creating and Joining Matches](/script-documentation/cas-shooting-range/matches.md#quick-match).

## Practice

`Config.Practice.Anywhere`, `MaxRange` and `Records`. See [Solo Practice](/script-documentation/cas-shooting-range/practice.md#where-practice-can-be-started).

## Ranked

`Config.Ranked.Enabled`, `StartRating`, `K` and `Divisions`. See [Ranked Play and Divisions](/script-documentation/cas-shooting-range/ranked.md).

## Challenges

`Config.Challenges`. See [Daily and Weekly Challenges](/script-documentation/cas-shooting-range/challenges.md#writing-your-own).

## Tournament

`Config.Tournament`. See [Tournaments](/script-documentation/cas-shooting-range/tournaments.md#settings).

## Leaderboards

`Config.Boards.Rows`, `CacheSeconds` and `MinMatches`. See [Leaderboards, Profile and History](/script-documentation/cas-shooting-range/leaderboards.md).
