> 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/ranked.md).

# Ranked Play and Divisions

Ranked play in the RedM Shooting Range & Competition script: ELO ratings, the six divisions from Tin Can to Deadeye, tiers, and how rating changes are calculated.

Every player starts with a rating of **1000**. Ranked matches move it up or down, and the rating decides the player's division.

## Which matches are ranked

* A **created match** is ranked when the host turns on **Ranked** on the Rules tab.
* A **quick match** is ranked by default (`Config.QuickMatch.Settings.ranked`).
* **Tournament** matches and **practice** runs are never ranked.

Ranked play can be switched off for the whole server:

```lua
Config.Ranked = {
    Enabled = true,
    StartRating = 1000,
    K = 28,
    -- ...
}
```

## How rating is calculated

The script uses the ELO system. Before the match, it works out how likely each shooter is to win from the ratings:

* Beat a stronger shooter and you gain more than 14 points.
* Beat a weaker one and you gain less.
* Losing works the same way in reverse.

`K` is the most a single match can move a rating (28 by default). In an Elimination match with more than two shooters, each shooter is compared with the average rating of the others. A rating never goes below 0.

## Divisions

| Division    | From rating |
| ----------- | ----------- |
| Tin Can     | 0           |
| Copper      | 1000        |
| Iron        | 1200        |
| Silver Spur | 1400        |
| Gold Spur   | 1600        |
| Deadeye     | 1800        |

Every division is split into three tiers, **I**, **II** and **III**, over its rating range. A new player at 1000 is **Copper I**. The top division counts its tiers over 300 points.

The Ranked Profile tab shows the current division and tier, a progress bar and how many points are needed for the next division. The result screen shows the old and new rating, the change and the division after the match.

### Changing the divisions

```lua
Divisions = {
    { id = 'tin_can', min = 0 },
    { id = 'copper', min = 1000 },
    { id = 'iron', min = 1200 },
    { id = 'silver_spur', min = 1400 },
    { id = 'gold_spur', min = 1600 },
    { id = 'deadeye', min = 1800 },
},
```

Keep them in order from lowest to highest. Division names are in the language file as `data.division.<id>`. You can rename, add or remove divisions without rebuilding the menu.

## What else is recorded

Every match, ranked or not, updates the player's wins, losses, win streak, best streak, shots, hits, targets destroyed and fastest clear. See [Leaderboards, Profile and History](/script-documentation/cas-shooting-range/leaderboards.md).
