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

# VORP, RSG Core and Standalone

How the RedM duel script works with VORP Core, RSG Core and standalone servers. Character profiles, money, revive, VORP inventory ammo, rsg-medic and storage.

The duel system talks to your framework in one place only: character identity, money and revive. Everything else is the same on every server.

## Detection

```lua
Config.Framework = 'auto'   -- 'auto' | 'vorp' | 'rsg' | 'standalone'
```

With `'auto'` the resource looks for `vorp_core` first, then `rsg-core`. If neither is running it runs standalone. If the framework resource exists but is still starting, the duel system waits up to 15 seconds for it. If the framework is restarted later, the duel system detects it again on its own.

## What each framework provides

|                                  | VORP Core                        | RSG Core                                 | Standalone                      |
| -------------------------------- | -------------------------------- | ---------------------------------------- | ------------------------------- |
| **Profile belongs to**           | The character (`charIdentifier`) | The character (`citizenid`)              | The player license              |
| **Name shown**                   | Character first and last name    | Character first and last name            | Player name                     |
| **Wagers, fees and prizes**      | Character cash                   | `cash` money type                        | Duel ledger inside the resource |
| **Gold shown in the menu**       | Character gold                   | `gold` money type, if your server has it | Not shown                       |
| **Revive after dying in a duel** | VORP Core revive                 | rsg-medic, or a plain revive             | Plain revive                    |

Each character has its own rating, history and achievements. A player with three characters has three duel profiles.

## Standalone money

Without a framework, every profile starts with a duel balance:

```lua
Config.Standalone = { startingCash = 250 }
```

Admins can add or remove balance with `/duel_admin cash <playerId> <amount>`. This command only works in standalone mode. On VORP and RSG use your framework's own money tools.

## Switching characters in the middle of a duel

If a player picks another character (VORP) or logs out (RSG) while in a duel, the duel is treated as a forfeit. The opponent wins and is paid, the player's routing bucket is restored, and their client is cleaned up without being teleported. Queue entries and board posts belonging to the old character are removed.

Money is always paid to the character that earned it. If that character is not the one currently loaded, the money is kept as owed and paid the next time that character opens the menu.

## VORP inventory and duel ammo

The duel weapon and its ammo are lent for the match and taken back afterwards. `vorp_inventory` normally saves ped ammo to the database every few seconds, which could otherwise record the temporary duel ammo.

While a player is in a duel, the duel system pauses `vorp_inventory` ammo saving and resumes it when the duel ends. The player's real ammo is restored from the database at that point. Nothing needs to be configured.

## rsg-medic

rsg-medic opens its death screen as soon as it sees a player die. During a duel the duel system tells rsg-medic to ignore the player, so a round never ends in a medic screen. If rsg-medic did register a death, the duel system revives through rsg-medic's own revive so its state stays correct.

## Dead Eye

Dead Eye is always blocked during a duel so every draw is decided by the player's hand. VORP Core also disables Dead Eye by default (`ActiveDeadEye` in the VORP Core config).

## Storage

```lua
Config.Storage = 'auto'   -- 'auto' | 'oxmysql' | 'kvp'
```

| Mode      | Where data lives                                                              |
| --------- | ----------------------------------------------------------------------------- |
| `oxmysql` | Tables `duel_profiles`, `duel_history` and `duel_meta`, created automatically |
| `kvp`     | The resource's own KVP store on the server                                    |
| `auto`    | oxmysql when it is running, KVP otherwise                                     |

{% hint style="warning" %}
Data is not copied between the two stores. If you start on KVP and add oxmysql later, the duel system starts reading from the empty tables. Pick one before your players start duelling.
{% endhint %}

Match history keeps the latest 30 duels per profile (`Config.History.keep`). Older rows are removed automatically.

## Steam avatars for offline players

With `steam_webApiKey` set, profile pictures are fetched from Steam. On VORP with oxmysql, pictures are also refreshed on startup for players who are offline, using the `characters` table, so the leaderboard and match history show real faces.
