> 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-advanced-gang/getting-started/installation.md).

# Installation

Install CAS Advanced Gang System: add the resource after oxmysql, check the config settings you cannot skip, start the server and update safely.

{% stepper %}
{% step %}

### Add the resource

Put the `cas-advanced-gang` folder in your server's `resources` folder. Ensure it after oxmysql and your framework.

{% tabs %}
{% tab title="VORP" %}
{% code title="server.cfg" %}

```
ensure oxmysql
ensure vorp_core
ensure vorp_inventory
# your other VORP resources
ensure cas-advanced-gang
```

{% endcode %}
{% endtab %}

{% tab title="RSG Core" %}
{% code title="server.cfg" %}

```
ensure oxmysql
ensure ox_lib
ensure rsg-core
ensure rsg-inventory
# your other RSG resources
ensure cas-advanced-gang
```

{% endcode %}
{% endtab %}

{% tab title="RedEM:RP" %}
{% code title="server.cfg" %}

```
ensure oxmysql
ensure redemrp
ensure redemrp_inventory
# your other RedEM:RP resources
ensure cas-advanced-gang
```

{% endcode %}
{% endtab %}

{% tab title="Standalone" %}
{% code title="server.cfg" %}

```
ensure oxmysql
ensure cas-advanced-gang
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Copy the whole folder, including **`web/dist`**. That is the built interface the manifest loads. Without it the ledger opens blank.
{% endhint %}
{% endstep %}

{% step %}

### Check the settings you can't skip

Everything in `config.lua` belongs to your server, and each entry has a comment saying what it must match. These four need a look before the first start:

| Setting                    | Why                                                                                                     |
| -------------------------- | ------------------------------------------------------------------------------------------------------- |
| `Config.Framework`         | Leave it on `'auto'` unless more than one framework is installed.                                       |
| `Config.StashItems`        | Every `name` must exist in your inventory's items table. An item that doesn't exist can't be laid in.   |
| `Config.Structures` models | Each `model` must be a prop that exists in RDR3. A missing one is named in the client console on start. |
| Prices                     | `Config.FoundingCost`, the `cost` of each tier and `Config.Upkeep`. Set them to fit your economy.       |

Every option is covered in [Configuration](/script-documentation/cas-advanced-gang/configuration.md).
{% endstep %}

{% step %}

### Start the server

The database tables are created on the first start. If your database user can't create tables at runtime, run `sql/bearclaw.sql` by hand first. It holds the same statements.

The console names the framework in use:

```
[bearclaw] framework: vorp
```

{% endstep %}
{% endstepper %}

{% hint style="info" %}
With `Config.Framework = 'auto'`, a framework that starts after CAS Advanced Gang System still works. It waits up to a minute for it, and a framework that starts even later takes over from standalone. Starting the framework first is still the cleanest setup.
{% endhint %}

## Updating

Replace the folder and restart. Columns added in newer versions are added to your tables on start, and the same `ALTER TABLE` lines sit next to each table in `sql/bearclaw.sql`. Gangs, members, stashes and ledgers are kept.

If you removed a rank or changed a rank's `id` in `Config.Ranks`, members on the old id move to the nearest remaining rank on start. The console prints one line per member moved.
