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

# Wagers, Entry Fees and Payouts

Wagers in the RedM Shooting Range & Competition script: money, gold and Range Tokens on VORP and RSG, entry fees, range commission, payouts, escrow, refunds and offline payments.

A match can be played for nothing, or for money, gold or Range Tokens. The server takes every stake before the first shot, holds it until the result and pays the winner itself. Nobody has to trust anybody.

## Currencies

| Currency         | VORP Core                        | RSG Core                                 |
| ---------------- | -------------------------------- | ---------------------------------------- |
| **No Wager**     | Free match                       | Free match                               |
| **Money**        | Character money                  | The `cash` account                       |
| **Gold**         | Character gold                   | An inventory item, `gold_bar` by default |
| **Range Tokens** | The `range_token` inventory item | The `range_token` inventory item         |

Turn any of them off in `Config.Currencies`. A disabled currency disappears from the menu and the server refuses it.

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

The items must exist in your inventory. See [Installation](/script-documentation/cas-shooting-range/installation.md), step 4.

## The stake

Each shooter pays the **wager** plus the **entry fee**. The host picks both from fixed steps, per currency:

```lua
Config.WagerSteps = {
    money  = { wager = { 5, 10, 25, 40, 50, 75, 100, 250 }, fee = { 0, 1, 2, 5, 10 } },
    gold   = { wager = { 1, 2, 3, 5 }, fee = { 0, 1 } },
    custom = { wager = { 2, 5, 10, 25, 50 }, fee = { 0, 1, 2, 5 } },
}
```

The server only accepts these values. Use whole numbers for currencies paid in items (Range Tokens, and gold on RSG). Amounts are rounded to cents for money, to a tenth for VORP gold and to whole items for items.

## The prize pool

Every shooter's wager and entry fee go into the pool. If the host keeps the **range commission** on, the range takes that percentage of the pool and the rest is paid out. The commission is not paid to anyone, so it takes money out of your economy.

```lua
Config.Commission = {
    Steps = { 2, 5, 10, 15 }, -- rates the host can pick (%)
    AllowOff = true,          -- false: commission is mandatory in every match
}
```

### Payout

| Payout               | Who is paid                                                                               |
| -------------------- | ----------------------------------------------------------------------------------------- |
| **Winner Takes All** | The winner gets the whole pool.                                                           |
| **70 / 30 Split**    | The winner gets 70%, second place 30%. Only for Elimination matches with 3 or 4 shooters. |

### Example

Two shooters, a $25 wager, a $2 entry fee and 5% commission:

|                        |        |
| ---------------------- | ------ |
| Each shooter pays      | $27.00 |
| Pool before commission | $54.00 |
| Commission (5%)        | $2.70  |
| Paid to the winner     | $51.30 |
| Winner's profit        | $24.30 |

Every shooter sees this breakdown in the pre-match check and must accept it before they can ready up.

## When money moves

| Moment                                                      | What happens                                                                                           |
| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| Creating or joining a lobby                                 | Nothing is taken. The server only checks the player can afford the stake.                              |
| Ready in the pre-match check                                | The stake is taken and held.                                                                           |
| A shooter steps back, leaves, or the check runs out of time | Every stake taken so far is refunded.                                                                  |
| The match ends                                              | The pool is paid out.                                                                                  |
| A shooter forfeits or leaves mid-match                      | Their stake stays in the pool.                                                                         |
| The match is cancelled                                      | Every stake is refunded. This covers a cancel after a disconnect, an admin cancel and an engine error. |

## Offline players and full inventories

If a winner is offline when the match ends, or the inventory cannot take the items (Range Tokens, or gold on RSG), the payment is not lost. It is saved in the `shooting_pending` table and the player is told it is being held. It is paid, with a **Payment Received** notice, the next time they load a character.

The same applies to refunds, tournament prizes and challenge rewards.

## Restarts and crashes

Every stake that is held sits in the `shooting_escrow` table until the match is settled. When the resource starts, anything still in that table belongs to a match that never finished. It is moved to `shooting_pending` as a refund, and each player gets it back the next time they load a character. The console prints how many were queued:

```
[shooting] 3 unfinished stake(s) from the last session were queued for refund
```

## Ranked matches without a wager

Rating and money are separate. A match can be ranked and free, wagered and unranked, or both. See [Ranked Play and Divisions](/script-documentation/cas-shooting-range/ranked.md).
