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

# Creating and Joining Matches

How players create, join and play shooting matches: the range menu, public and private lobbies, invites, quick match, the pre-match check, forfeits, disconnects and rematches.

## The range menu

Hold **E** at the range master or use `/shootingrange` near a range. The menu opens on six tabs:

| Tab                | What is on it                                                                                                          |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| **Play**           | Quick Match, Create Match, Join Match, Solo Practice, Tournament and Spectate, the shooters near you and your standing |
| **Open Matches**   | Every public lobby waiting for players, and every match live right now                                                 |
| **Ranked Profile** | Rating, division, record, streaks, accuracy, favourite weapon and recent form                                          |
| **Leaderboards**   | Six boards, daily, weekly and all time                                                                                 |
| **Challenges**     | The daily and weekly challenges and their rewards                                                                      |
| **Match History**  | The last 30 matches                                                                                                    |

## Create a match

**Play > Create Match** opens the match builder. It has five tabs, and a **Match Slip** on the side sums up everything as it is picked:

1. **Mode & Arena.** The mode and the range. Picking a mode applies its defaults.
2. **Targets.** Target type, count, distance, spacing and movement.
3. **Weapons.** The match weapon, same weapon for all or own choice, supplied or player owned.
4. **Rules.** Round format, time and ammunition limits, reloading, false start, wrong target, sudden death, friendly fire, ranked and the number of shooters.
5. **Wager.** Currency, wager, entry fee, range commission and payout.

Then open the lobby as **Public** (listed under Open Matches for anyone at the range) or **Private** (only invited players can join).

Every setting is checked on the server. See [Match Modes and Rules](/script-documentation/cas-shooting-range/modes.md) and [Wagers, Entry Fees and Payouts](/script-documentation/cas-shooting-range/wagers.md).

## The lobby

The host's lobby shows every seat, who is ready and who has been invited.

* **Invite.** The host can invite anyone within 75 metres (`Config.Rules.InviteDistance`). The **Nearby Shooters** list on the Play tab shows who is close and what they are doing (idle, in a lobby, in a match, practising or watching). You can also start from a nearby shooter and the invite goes out as soon as the lobby opens.
* **Edit settings.** The host can change any setting while the lobby is open. Everyone sees the change and every ready mark is cleared.
* **Remove a shooter.** The host can remove a player or withdraw an invite.
* **Ready.** Each shooter marks themselves ready. A shooter who cannot cover the stake cannot ready up.
* **Leave.** If the host leaves, the lobby closes and everyone in it is told why.

When there are at least two shooters and all of them are ready, the host sends the lobby to the pre-match check. The range must have enough free lanes. If it does not, the host is told the range is in use.

## Invites

An invite stays open for 30 seconds (`Config.Rules.InviteSeconds`). The invited player gets a notification, and if their menu is closed, a **View Invite** prompt (hold **H**). They can accept or decline from the menu. The host is told when an invite is declined or runs out.

A player who is already in a match, a lobby or practice cannot be invited until they are free.

## Join an open match

**Open Matches** lists every public lobby that still has a free seat, with the host, mode, weapon, targets, wager, entry fee, commission, payout and number of players. Joining needs enough money for the stake.

## Quick match

**Play > Quick Match** puts the player in the queue at the nearest range. As soon as a second player searches at the same range, the two are paired straight into the pre-match check with the settings in `Config.QuickMatch`:

```lua
Config.QuickMatch = {
    Arena = 'blackwater',
    Settings = { mode = 'bottle', targetType = 'bottles', targetCount = 10, rounds = 1, wagerType = 'none', ranked = true, weapon = 'schofield' },
}
```

By default a quick match is a ranked Bottle Shootout with the Schofield, no wager. Click the card again to stop searching.

## The pre-match check

Before the first shot, every shooter goes through the pre-match screen:

1. **Accept the terms.** With a wager, every shooter sees the full prize breakdown and must accept it. Without a wager this step is skipped.
2. **Be at the range.** A shooter must be within 120 metres of the firing line (`Config.Rules.JoinRange`) to ready up.
3. **Weapon check.** With player owned weapons, the shooter must have the weapon (see [Targets and Weapons](/script-documentation/cas-shooting-range/targets-and-weapons.md#weapon-rules)).
4. **Ready.** The stake is taken now and held by the server.

When every shooter is ready, the match starts. If anyone steps back, or the check is not finished within 90 seconds (`Config.Rules.PrematchSeconds`), the lobby returns to its normal state and every stake that was taken is refunded.

## In the match

Every shooter is moved to their lane and held there. The HUD shows:

* The scoreboard with every shooter's targets left and round wins, and the clock.
* Your lane's targets, with the ones you have broken and the order you broke them in.
* Your weapon card: rounds in the magazine, reserve and the reload bar.
* Your live stats: shots, hits, accuracy, streak and split times.
* The opponents' progress, and a feed of hits, misses, reloads and penalties.

Several matches and practice runs can share one range at the same time, as long as it has free lanes.

## Forfeiting

Hold **G** for 2.5 seconds to forfeit. In a two shooter match the opponent wins. In an Elimination match with more than two shooters left, you are out and the match goes on without you.

## Disconnects

If a shooter drops out of a two shooter match, the match pauses and the other shooter sees who left.

* **After 15 seconds** (`Config.Rules.DisconnectGrace`) the shooter who stayed can **claim the win** or **cancel the match**. Cancelling refunds every stake.
* **If the player comes back within 120 seconds** (`Config.Rules.ResumeSeconds`) with the same character, they are put straight back into the match and it carries on.
* **After 90 seconds** (`Config.Rules.AutoClaimSeconds`) the win is given to the player who stayed. If nobody is left, the match is cancelled and refunded.

In an Elimination match with three or more shooters left, a player who drops is simply out.

## Results and rematches

The result screen shows the winner, how it was won, the round by round log, every shooter's stats, the money won or lost and the rating change. **Rematch** sends an invite to the same opponents with the same settings. From there the lobby works as usual.
