> 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-blackjack/tables-and-rules.md).

# Tables and rules

The three CAS Blackjack tables at the Blackwater, Rhodes and Van Horn saloons: bet limits, dealers, card sets, how to change them, and the house rules and payouts.

## The tables

CAS Blackjack plays at the story mode's own three blackjack tables. The tables and chairs are part of the saloon interiors, so they are already in the world. The script adds the house dealer, the cards, the chips, the deck and the chip caddy. Every table has four seats.

| Table id     | Saloon            | Bet limits                    | Dealer model         | Card and chip set |
| ------------ | ----------------- | ----------------------------- | -------------------- | ----------------- |
| `blackwater` | Blackwater Saloon | `medium`: $5 to $250, step $5 | `S_M_M_BLWDEALER_01` | `0` Blackwater    |
| `rhodes`     | Rhodes Saloon     | `low`: $1 to $50, step $1     | `S_M_M_RHDDEALER_01` | `3` Rhodes        |
| `vanhorn`    | Van Horn Saloon   | `low`: $1 to $50, step $1     | `S_M_M_VHTDEALER_01` | `8` Van Horn      |

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

```lua
{
    id = "blackwater", label = "Blackwater Saloon",
    coords = vector3(-813.2971, -1324.285, 46.89), heading = 0.29, deckSet = 0,
    dealer = "S_M_M_BLWDEALER_01", limits = "medium",
},
```

| Field     | Meaning                                                                                                            |
| --------- | ------------------------------------------------------------------------------------------------------------------ |
| `id`      | Unique name. Also used by `/bjtp` and the server export.                                                           |
| `label`   | Shown on the prompts, the HUD 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, `3` Rhodes, `8` Van Horn. `1` (camp) and `7` (Valentine) also exist. |
| `dealer`  | The dealer's ped model.                                                                                            |
| `limits`  | A preset from `Config.Limits` (`"low"`, `"medium"`, `"high"`) or your own `{ minBet, maxBet, step }`.              |
| `blip`    | `false` hides this table's map blip.                                                                               |
| `enabled` | `false` turns this table off.                                                                                      |

{% hint style="warning" %}
Keep `coords` and `heading` as they are. They match the tables built into the saloons, and the seats, the dealer and every card are placed from them.
{% endhint %}

## Changing the bet limits

There are three ways:

1. **Pick another preset.** `limits = "high"` gives a table $25 to $1000 in $25 steps.
2. **Give a table its own limits.** `limits = { minBet = 10, maxBet = 500, step = 10 }`.
3. **Change a preset.** Edit `Config.Limits` in `config/config.lua` and every table that uses that preset follows.

The Sit Down prompt shows each table's limits (for example "Blackwater Saloon, Bets $5 to $250") and the server refuses any bet outside them. Restart the resource after the change.

## House rules

These are the defaults. Every rule can be changed in `Config.Rules` (see [Configuration](/script-documentation/cas-blackjack/configuration.md#house-rules)).

* **Six-deck shoe.** Once three quarters of the shoe are dealt, it is reshuffled before the next deal.
* **Betting.** Betting opens with the first bet and stays open for `Config.BetSeconds` (15 seconds). When everyone seated has bet, the deal starts 1.5 seconds later. A bet can be taken back while betting is open.
* **The deal.** One card to each player, the dealer's up card, a second card to each player, then the dealer's hole card.
* **Insurance.** When the dealer's up card is an ace, every player in the round is offered insurance. It costs half the bet and pays 2:1 when the dealer has blackjack.
* **Dealer peek.** With an ace or a ten-value card showing, the dealer checks for blackjack before anyone plays. If he has it, the hole card is turned over and the round is settled at once.
* **Your turn.** Hit, stand, double down or split. Only the moves allowed for the hand are offered. A hand that reaches 21 stands on its own, and a hand that does not act within `Config.TurnSeconds` (20 seconds) stands.
* **Double down.** On any first two cards. The bet is doubled and exactly one more card is dealt.
* **Split.** Two first cards of the same value (any two ten-value cards count, such as a king and a queen) become two hands with a bet each. One split per seat, doubling after a split is allowed and split aces get one card each. 21 on a split hand counts as 21, not as blackjack.
* **The dealer.** He stands on all 17s and only draws when at least one player still has a live hand.
* **Surrender** is off. When it is turned on, a player can give up a first two-card hand for half the bet.

## Payouts

| Result                                    | Pays         | Back from a $10 bet            |
| ----------------------------------------- | ------------ | ------------------------------ |
| Blackjack                                 | 3:2          | $25                            |
| Win                                       | 1:1          | $20                            |
| Push (same total, or both have blackjack) | Bet back     | $10                            |
| Insurance when the dealer has blackjack   | 2:1          | $15 back from the $5 insurance |
| Surrender (off by default)                | Half the bet | $5                             |
| Lose or bust                              | Nothing      | $0                             |

The stake comes back together with the winnings at the end of the round. When the dealer has blackjack, a player blackjack is a push and every other hand loses.

## More

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