> 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-poker/tables-and-stakes.md).

# Tables and stakes

The five CAS Poker tables at the Valentine, Blackwater, Saint Denis, Flatneck Station and Tumbleweed saloons: stakes, blinds and buy-ins, the Hold'em rules, and how to add your own table.

## The tables

CAS Poker plays at the story mode's own poker tables, the five Red Dead Online uses. Every table has six seats and that saloon's own cards and chips.

| Table id     | Saloon            | Stakes   | Blinds        | Buy-in         | Card and chip set |
| ------------ | ----------------- | -------- | ------------- | -------------- | ----------------- |
| `valentine`  | Valentine Saloon  | `low`    | $0.25 / $0.50 | $10 to $50     | `7` Valentine     |
| `blackwater` | Blackwater Saloon | `medium` | $1 / $2       | $40 to $200    | `0` Blackwater    |
| `saintdenis` | Saint Denis       | `high`   | $5 / $10      | $200 to $1,000 | `5` Saint Denis   |
| `flatneck`   | Flatneck Station  | `low`    | $0.25 / $0.50 | $10 to $50     | `4` Flatneck      |
| `tumbleweed` | Tumbleweed Saloon | `medium` | $1 / $2       | $40 to $200    | `6` Tumbleweed    |

The Sit Down prompt shows each table's label and blinds, for example "Valentine Saloon, Blinds $0.25 / $0.50".

The tables are set in `config/tables.lua`:

```lua
{
    id = "valentine", label = "Valentine Saloon",
    coords = vector3(-304.5352, 801.1352, 117.9785), heading = 135.0, deckSet = 7,
    stakes = "low",
},
```

| Field        | Meaning                                                                                                                                                                        |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id`         | Unique name. Also used by `/pokertp` and the server export.                                                                                                                    |
| `label`      | Shown on the buy-in panel, the Sit Down prompt and the map blip.                                                                                                               |
| `coords`     | The table centre at floor level (`vector3`).                                                                                                                                   |
| `heading`    | The table heading in degrees.                                                                                                                                                  |
| `deckSet`    | The saloon's cards and chips: `0` Blackwater, `1` camp, `2` Serendipity, `3` Rhodes, `4` Flatneck, `5` Saint Denis (La Bastille), `6` Tumbleweed, `7` Valentine, `8` Van Horn. |
| `stakes`     | A level from `Config.Stakes` (`"low"`, `"medium"`, `"high"`) or your own `{ smallBlind, bigBlind, minBuyIn, maxBuyIn }`.                                                       |
| `bots`       | `false`: no house players at this table.                                                                                                                                       |
| `botFillTo`  | Optional. This table's own `fillTo` for the house players (see [House players](/script-documentation/cas-poker/house-players.md#settings)).                                    |
| `spawnTable` | `"auto"` (default), `true` or `false`. See [Table and chairs](/script-documentation/cas-poker/tables-and-stakes.md#table-and-chairs).                                          |
| `blip`       | `false` hides this table's map blip.                                                                                                                                           |
| `enabled`    | `false` turns this table off.                                                                                                                                                  |

{% hint style="warning" %}
Keep `coords` and `heading` of the five tables as they are. They are the story mode's own values: the seats, the cards and the chips are all placed from them.
{% endhint %}

## Stakes

The three levels are in `Config.Stakes` in `config/config.lua`:

| Level    | Small blind | Big blind | Buy-in         |
| -------- | ----------- | --------- | -------------- |
| `low`    | $0.25       | $0.50     | $10 to $50     |
| `medium` | $1          | $2        | $40 to $200    |
| `high`   | $5          | $10       | $200 to $1,000 |

* **Buy-in.** A player picks a stake between the minimum and the maximum buy-in on the buy-in panel. It starts halfway and moves in steps of one big blind.
* **More chips.** Between hands a player can buy more, up to the table's maximum buy-in in all.
* **House players** sit down with `stackShare` (60% by default) of the maximum buy-in: $30 at `low`, $120 at `medium`, $600 at `high`.

There are three ways to change the stakes:

1. **Pick another level.** `stakes = "high"` gives a table $5 / $10 blinds and a $200 to $1,000 buy-in.
2. **Give a table its own stakes.** `stakes = { smallBlind = 2, bigBlind = 4, minBuyIn = 80, maxBuyIn = 400 }`.
3. **Change a level.** Edit `Config.Stakes` in `config/config.lua` and every table that uses that level follows.

Restart the resource after the change.

## The rules

No-limit Texas Hold'em, run on the server.

* **The deck.** One 52-card deck, shuffled on the server for every hand. A card is burned before the flop, the turn and the river.
* **The button and the blinds.** The dealer button moves one seat round the table every hand, and the player on the button deals. The next two seats post the small and the big blind. With two players, the button posts the small blind.
* **Betting.** Check, call, bet, raise or go all in. A bet or raise is at least the big blind, and a raise is at least the size of the last raise. A short all-in that is not a full raise does not reopen the betting for players who have already acted.
* **The turn timer.** `Config.TurnSeconds` (20 seconds) to act. When it runs out, the player checks if they can, otherwise they fold. After `Config.MaxTimeouts` (2) timeouts in a row the player is sat out.
* **All in.** When nobody left in the hand can bet any more, the rest of the board is dealt and the hand goes to the showdown.
* **Side pots and split pots.** Every all-in makes its own pot, and each pot goes to the best hand that can win it. A tie splits the pot, and an odd cent goes to the first winner left of the button.
* **Hands.** High Card, Pair, Two Pair, Three of a Kind, Straight, Flush, Full House, Four of a Kind, Straight Flush and Royal Flush, the best five of your two cards and the five on the board.
* **The next hand** starts `Config.HandPauseSeconds` (10 seconds) after the last one, as soon as at least two players with chips are seated and not sitting out. House players count.
* **Rake.** Off by default. See [Rake](/script-documentation/cas-poker/configuration.md#rake).

## Adding a table

1. Find the spot: the centre of the table on the floor (`coords`) and the way the table is turned (`heading`). On a map table, use its centre and heading so the seats meet its chairs.
2. Add an entry to `Config.Tables` in `config/tables.lua` with a new `id`, a `label`, the `coords` and `heading`, a `deckSet` for the look of the cards and chips, and a `stakes` level.
3. Restart the resource.

The six seats, the cards, the chips and the deck are laid out from `coords` and `heading` exactly as the story mode lays out its own tables.

## Table and chairs

The five saloons already have their poker tables and chairs. For a table you add yourself, `spawnTable` decides whether the script puts furniture down:

| Value              | What happens                                                                                                                                                                                                                                                                                                   |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `"auto"` (default) | A table and six chairs are put down only where the map has none. When a player has stood within 12 meters of the spot for 4 seconds and there is still no poker table there, the set is spawned. If the map's own table streams in later (saloon interiors often load late), the spawned set is removed again. |
| `true`             | Always put a table and chairs down.                                                                                                                                                                                                                                                                            |
| `false`            | Never put anything down.                                                                                                                                                                                                                                                                                       |

The models are set at the bottom of `config/tables.lua`:

| Option                   | Default                 | Meaning                                                                                                                                           |
| ------------------------ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Config.TableModels`     | 10 poker table models   | The models the script looks for to tell whether the map already has a poker table at the spot. Add your map's poker table model if it is missing. |
| `Config.ChairModels`     | 10 chair models         | The chair models that count as the map's own chairs round a table.                                                                                |
| `Config.SpawnTableModel` | `"p_gen_tablepoker01x"` | The table that is spawned.                                                                                                                        |
| `Config.SpawnChairModel` | `"p_chair05x"`          | The chair that is spawned at every seat.                                                                                                          |

One table can use other models with `tableModel = "..."` and `chairModel = "..."` in its entry.

## More

* [Buy CAS Poker](https://codeaftersex.com/script/poker)
* [Support Discord](https://discord.gg/codeaftersex)
* [All CodeAfterSex scripts](https://codeaftersex.com/scripts)
