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

# Installation

Install CAS Poker 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 Poker 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-poker` folder in your server's `resources` folder. Keep the folder name as it is: the server export and the saved stacks 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-poker
```

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

```
[cas-poker] 5 poker table(s) ready on vorp.
```

4. Go to the Valentine, Blackwater, Saint Denis, Flatneck Station or Tumbleweed saloon (the tables have map blips), walk up to a free chair and hold **E**. The buy-in panel opens.

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

After any change in the `config` folder, run `restart cas-poker` (or restart the server). Every seated player is paid out: a hand in play is called off and each player in it gets back the stack they had when it started.

## 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 `/pokeradmin owed` (see [Admin and exports](/script-documentation/cas-poker/admin-and-exports.md)).

## Money

Buy-ins are taken from and cash-outs 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 buy-ins are taken from and cash-outs paid to. |
| `Config.CurrencySymbol` | `"$"`    | Both      | The symbol in front of amounts on the prompts, HUD and panel.    |

The stakes are written in that money, so with the default cash setting `minBuyIn = 10` means $10. See [Tables and stakes](/script-documentation/cas-poker/tables-and-stakes.md).

## Notifications

Table messages (the buy-in range, not enough money, the cash-out, 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 stakes, the house players and every word the players read.

The buy-in panel in the `web` folder (`index.html`, `style.css`, `app.js`, its fonts and images) ships as plain files, as every NUI does. The rest of the code is protected and works the same.

## More

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