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

# Frameworks

How CAS Advanced Gang System works with VORP, RSG Core, RedEM:RP or no framework through one bridge file: detection, characters, money, items and guns.

Everything CAS Advanced Gang System needs from a framework goes through one file, **`server/bridge.lua`**:

* who the player is and which character they're on,
* reading, adding and removing money,
* counting, adding and removing items and guns,
* notices.

The rest of the resource calls one small API and doesn't care which framework is behind it.

## Finding the framework

With `Config.Framework = 'auto'`:

1. On start, CAS Advanced Gang System looks for `vorp_core`, `rsg-core` and `redemrp_main` or `redemrp`.
2. If one is running, it's used.
3. If one is installed but hasn't started, CAS Advanced Gang System waits up to a minute for it.
4. If none turns up, it runs standalone. A framework that starts later still takes over.
5. If the framework restarts, the bridge reconnects to it.

The framework in use is printed once:

```
[bearclaw] framework: rsg
```

With a framework named in `Config.Framework`, CAS Advanced Gang System waits for that one and never falls back to standalone.

## Characters, not accounts

Gangs belong to **characters**. A player with two characters can ride with a different gang on each.

| Framework  | Character key        |
| ---------- | -------------------- |
| VORP       | `charIdentifier`     |
| RSG Core   | `citizenid`          |
| RedEM:RP   | `charid`             |
| Standalone | the player's license |

## When a framework call fails

A failed framework call never stops the resource. It's caught, and the first failure of each call is printed:

```
[bearclaw] framework call "vorp:addItem" failed: ...
[bearclaw] framework is "vorp". Check that resource is started and its version matches the signature in server/bridge.lua
```

Each call in `server/bridge.lua` follows the documented signature of that framework. If your version differs, that file is the only one to change.

## Framework pages

* [VORP](/script-documentation/cas-advanced-gang/frameworks/vorp.md)
* [RSG Core](/script-documentation/cas-advanced-gang/frameworks/rsg.md)
* [RedEM:RP](/script-documentation/cas-advanced-gang/frameworks/redemrp.md)
* [Standalone](/script-documentation/cas-advanced-gang/frameworks/standalone.md)
