> 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-duel-arena-system/wagers-and-betting.md).

# Wagers, Side Bets and Payouts

Duel wagers with a house cut, spectator side bets with live odds, tournament prizes, NPC bounties and owed money in the RedM Duel & Arena System.

All money moves on the server, through your framework. On VORP and RSG Core it is the character's cash. On a standalone server it is the duel ledger.

## Duel wagers

When issuing a challenge, the challenger picks a wager. Both players stake the same amount.

```lua
Config.Money = {
    houseCut     = 0.05,                     -- cut taken from the wager pot (0.05 = 5%)
    wagerPresets = { 0, 10, 25, 50, 100, 250 },
    maxWager     = 500,                      -- highest wager per player in a single duel ($)
    wagerStep    = 5,                        -- step for custom wagers ($)
}
```

* The menu offers the presets plus a custom amount in steps of $5, up to $500 per player.
* The challenger must be able to cover the wager to send the challenge, and the other player to accept it.
* **Nothing is taken until both players are ready.** Then both stakes are held by the server. If either player cannot cover the stake at that moment, the duel is called off and nobody pays.
* The winner takes the pot minus the house cut.
* A drawn match refunds both stakes.
* A duel cancelled before it starts, or called off by an admin, refunds both stakes.
* A player who disconnects or switches character during the duel forfeits. The opponent is paid.

### Example

Both players wager $25. The pot is $50. The house takes 5%, which is $2.50. The winner receives **$47.50**, a profit of $22.50.

Matchmaking queue duels and tournament matches never carry a wager. NPC duels pay a bounty instead. See [NPC Outlaw Duels](/script-documentation/cas-duel-arena-system/npc-outlaws.md#bounties).

## Spectator side bets

Anyone watching a duel can back one of the shooters.

```lua
Config.Bets = { stakes = { 5, 10, 25 }, margin = 0.08, minOdds = 1.05 }
```

* **Stakes** are fixed at $5, $10 or $25.
* **Odds** come from the two ratings. The favourite pays less, the underdog more. `margin` is the house edge built into the odds, and no side pays less than `minOdds`.
* **One bet per spectator per match.**
* **Betting closes once the first round is decided.** Spectators cannot wait to see the score and then bet at the opening odds. The betting buttons grey out and the menu says betting is closed.
* A winning bet pays the stake multiplied by the odds it was placed at. A losing bet is gone.
* If the match ends level or is called off, every bet is refunded.

Duelists cannot bet on their own match, because a player in a duel cannot spectate it.

### Example

Two players are rated 1216 and 1184. The odds are **1.69** on the higher rated player and **2.03** on the other. A $10 bet on the favourite returns $16.90 if that player wins.

## Tournament prizes

Entry fees form the pool. The champion, the runner up and the two losing semifinalists are paid shares of it. See [Tournaments](/script-documentation/cas-duel-arena-system/tournaments.md#prizes).

## Money owed to offline players

Sometimes money is due to a player who is not there to receive it: a spectator who logged off before the duel ended, a tournament finalist who disconnected, or a character that is not currently loaded.

That money is never lost. It is kept on the player's duel profile and paid the next time they open the duel menu, with the message "Collected $X owed from earlier duels."

## Restarting the resource

Stopping or restarting `cas-duel` refunds every wager and side bet that is still in play. Players who are online get their money straight away; anybody else has it kept as owed.

## Earnings

Wager winnings and losses, NPC bounties and tournament prizes are recorded on the player's profile as **duel earnings**. The biggest wager they have won is kept as a personal record. See [Profiles, Leaderboard and Achievements](/script-documentation/cas-duel-arena-system/profiles-and-achievements.md).
