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

# Installation

Install CAS Blackjack on a RedM server: requirements, ensure order, VORP and RSG detection, cash or gold, notifications and the editable config folder in the Escrow edition.

CAS Blackjack is a single resource. It needs no SQL, no items and no stream assets.

## Requirements

| Requirement           | Notes                                                                                             |
| --------------------- | ------------------------------------------------------------------------------------------------- |
| RedM server           | The resource runs on Lua 5.4, which RedM already ships with.                                      |
| VORP Core or RSG Core | One of the two must be running. The script finds it on its own.                                   |
| `cas-notification`    | Optional. Used for the table messages when it is started.                                         |
| `ox_lib`              | Optional, RSG only. Used for the table messages when it is started and `cas-notification` is not. |

## Install

1. Put the `cas-blackjack` folder in your server's `resources` folder. Keep the folder name as it is: the server export and the saved bets are kept under the resource name.
2. Add it to `server.cfg` after your framework:

```
ensure vorp_core
# or: ensure rsg-core

# ...your other resources

ensure cas-blackjack
```

3. Restart the server. When the tables are ready, the console shows:

```
[cas-blackjack] 3 blackjack table(s) ready on vorp.
```

4. Go to the Blackwater, Rhodes or Van Horn saloon (the tables have map blips), walk up to a free chair and hold **E** to sit down.

{% hint style="info" %}
If that line ends with `no framework yet`, the framework had not started when CAS Blackjack did. The script asks again the next time it needs it, so the tables still work once the framework is up. Keep `ensure cas-blackjack` after your framework all the same.
{% endhint %}

After any change in the `config` folder, run `restart cas-blackjack` (or restart the server). A round in play is called off and every bet goes back to its player.

## Framework

`Config.Framework` in `config/config.lua` decides where the money and the character come from.

| Value              | What happens                                               |
| ------------------ | ---------------------------------------------------------- |
| `"auto"` (default) | Uses `vorp_core` when it is started, otherwise `rsg-core`. |
| `"vorp"`           | Forces VORP Core.                                          |
| `"rsg"`            | Forces RSG Core.                                           |

If you force a framework that is not running while the other one is, the console prints a warning and the script uses the one that is running.

Each character is tracked by its framework id with a prefix: `vorp:<charIdentifier>` on VORP and `rsg:<citizenid>` on RSG. You need this id for `/blackjackadmin owed` (see [Admin and exports](/script-documentation/cas-blackjack/admin-and-exports.md)).

## Money

Bets are taken from and paid to the character through the framework's own money functions.

| Option                  | Default  | Framework | Meaning                                                     |
| ----------------------- | -------- | --------- | ----------------------------------------------------------- |
| `Config.VorpCurrency`   | `0`      | VORP      | `0` plays with cash, `1` plays with gold.                   |
| `Config.RsgMoneyType`   | `"cash"` | RSG       | The RSG money type bets are taken from and paid to.         |
| `Config.CurrencySymbol` | `"$"`    | Both      | The symbol in front of amounts on the prompts and messages. |

The bet limits are written in that money, so with the default cash setting `minBet = 5` means $5. See [Tables and rules](/script-documentation/cas-blackjack/tables-and-rules.md).

## Notifications

Table messages (the bet range, not enough money, the result of a round, money paid back) go to the first of these that is available:

1. `cas-notification`, when it is started.
2. On VORP: VORP's right-side tip.
3. On RSG: `ox_lib` notify when `ox_lib` is started, otherwise RSG Core's own notify.

Nothing has to be set up for this.

## Escrow edition

The whole `config` folder stays open in the Escrow edition: `fxmanifest.lua` lists `escrow_ignore 'config/*.lua'`, so `config/config.lua`, `config/tables.lua` and `config/locale.lua` can be edited freely. That covers every option, the tables, the bet limits, the house rules and every word the players read. The rest of the code is protected and works the same.

## More

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