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

# Leaderboards, Profile and History

Leaderboards, player profiles and match history in the RedM Shooting Range & Competition script: the six boards, daily and weekly views, profile stats and Steam portraits.

## Leaderboards

The **Leaderboards** tab has six boards, each with a **Daily**, **Weekly** and **All Time** view.

| Board                    | Ranks by                                                                        |
| ------------------------ | ------------------------------------------------------------------------------- |
| **Most Wins**            | Matches won in the period                                                       |
| **Highest Rating**       | Current rating, for everyone who has played at least one match                  |
| **Fastest Bottle Clear** | Fastest winning time in Bottle Shootout                                         |
| **Best Accuracy**        | Average accuracy, for players with at least 3 matches in the period             |
| **Longest Win Streak**   | Most wins in a row in the period (all time uses each player's best ever streak) |
| **Best Solo Time**       | Fastest cleared 10 target practice run                                          |

Daily means since midnight server time. Weekly means the last 7 days. The board shows the top 20 with their number of matches, and the player's own rank at the top when they are on it.

```lua
Config.Boards = {
    Rows = 20,          -- rows per board
    CacheSeconds = 60,  -- how long a board is cached before it is read again
    MinMatches = 3,     -- matches needed to appear on the accuracy board
}
```

Highest Rating does not change with the period, because a rating is always current.

## Ranked Profile

The **Ranked Profile** tab is the player's card:

* Name, portrait, rating, division, tier and progress to the next division
* Wins, losses and win rate
* Current streak and best streak
* Average accuracy over every shot fired in matches
* Fastest round clear and best solo time
* Targets destroyed
* Favourite weapon and how often it is used
* Recent form, the last results as W and L
* Money, gold and Range Tokens on hand

## Match History

The **Match History** tab lists the player's last 30 matches: result, opponent, mode, score, weapon, accuracy, time, wager and when it was played. In an Elimination match the opponent shows as the best placed opponent plus the number of others.

## Portraits

Portraits come from the player's Steam profile picture. See [Installation](/script-documentation/cas-shooting-range/installation.md), step 5. Players without one get the game's default silhouette.

## Where the data lives

| Table               | Used for                                                                          |
| ------------------- | --------------------------------------------------------------------------------- |
| `shooting_profiles` | Profile card, Highest Rating and all time Longest Win Streak                      |
| `shooting_history`  | Match History, Most Wins, Fastest Bottle Clear, Best Accuracy, period win streaks |
| `shooting_practice` | Practice records and Best Solo Time                                               |

To wipe the boards for a new season, empty `shooting_history` and `shooting_practice`, and reset the columns you want in `shooting_profiles`, with the resource stopped.
