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

# Stashes and other scripts

How CAS Advanced Inventory works with other RedM scripts. Stashes, horse saddlebags, wagons, houses, bank safe boxes, car trunks, old syn windows, hands up for searches, metabolism meters, Steam portr

Other scripts keep calling the inventory the way they always did. This page lists what that looks like in game, and the few things your server needs for some features.

## Stashes

A chest, saddlebag, wagon, house, safe box, shop or clan storage from another script opens **on the right of the satchel**:

* Drag items across, or press **STORE ALL** / **TAKE ALL**.
* The header shows the stash's name, its weight (when it has a weight limit) and how many slots are used.
* **Last changes:** who stored or took what ("Rider stored Panther Skin x1").
* **Access:** some stashes are used by one rider at a time and show who has access.
* A long stash shows five rows and scrolls the rest.
* With more than one open at once (saddlebags and the ground, for example) they are tabs at the top of the panel.

Stashes keep their contents in the stock tables (`character_inventories` on VORP, `inventories` on RSG) under the stash id, so stashes filled with the stock inventory keep their items. A stash registered as `shared` has one content for everyone; otherwise each character has their own.

## Scripts that work as they are

Checked against the official VORP recipe scripts and our CAS scripts: every export, event and old API call they make is answered.

| Script                                                                                                                                                                                                 | What uses the inventory                                                                                                                 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| vorp\_stables                                                                                                                                                                                          | Horse saddlebags and wagon storage (**U** next to the horse or wagon), through the old API object                                       |
| vorp\_housing                                                                                                                                                                                          | House and room storage, through the old API `OpenInv`                                                                                   |
| vorp\_banking, CAS Banking                                                                                                                                                                             | Bank safe boxes                                                                                                                         |
| vorp\_police                                                                                                                                                                                           | Police storage                                                                                                                          |
| vorp\_stores, vorp\_crafting, vorp\_hunting, vorp\_fishing, vorp\_herbs, vorp\_mining, vorp\_lumberjack, vorp\_crawfish, vorp\_lootnpcs, vorp\_admin, vorp\_billing, vorp\_doorlocks, vorp\_metabolism | Item and weapon exports, usable items                                                                                                   |
| vorp\_weaponsv2                                                                                                                                                                                        | Ammo boxes, weapon parts from its own bench (see [Weapons](/script-documentation/cas-advanced-inventory/weapons.md#vorp_weaponsv2))     |
| syn\_clan, syn\_Container, syn\_stores, syn\_search, syn\_underground                                                                                                                                  | The old syn windows (see [For developers](/script-documentation/cas-advanced-inventory/developers.md#old-syn-windows))                  |
| CAS Motor Cars                                                                                                                                                                                         | Car trunks (`Config.Trunks`, see [Configuration](/script-documentation/cas-advanced-inventory/configuration.md#car-trunks-cas-car1910)) |
| CAS Gunsmith                                                                                                                                                                                           | Parts taken off at the bench land in the satchel                                                                                        |
| Murphy's Clothing (murphy\_clothing)                                                                                                                                                                   | Outfit pieces come off and go on through its own toggle (see [Outfit](/script-documentation/cas-advanced-inventory/outfit.md))          |
| jo\_libs (and the scripts built on it)                                                                                                                                                                 | Found as the VORP inventory, every inventory call of its framework bridge answered                                                      |
| xakra\_weapons                                                                                                                                                                                         | Parts and condition put on at every equip; one change in its framework file for its parts menu (see [below](#xakra_weapons))            |
| CAS Owned Shop, CAS Shop V2, CAS Banking, CAS Radial Menu                                                                                                                                              | Exports, item pictures, the `vorp_inventory:OpenInv` event                                                                              |

## xakra\_weapons

xakra\_weapons hears the satchel at every equip (`syn_weapons:weaponused`, as with stock VORP) and puts its parts and the gun's condition on. Its ammo items fill the gunbelt through `addBullets`.

Its parts menu saves through the `Updates` functions in `xakra_weapons/framework/server.lua`, which its own docs ask you to point at your inventory. Out of the box they write straight into the `loadout` table; the satchel keeps each weapon in memory and would put the old parts back with its next save. Change `Updates.Comps` to:

```lua
Comps = function(source, weaponId, oldComps, newComps)
    exports.vorp_inventory:setWeaponComponents(source, weaponId, newComps)
end,
```

`Updates.Condition` can stay as it is: the satchel reads the condition from the gun in game and saves it itself.

## Restarting

Scripts tell the inventory about their usable items and their stashes **when they start**. The inventory keeps those in memory. If you restart only the inventory while the server runs, usable items stop working and stashes that were registered at a script's start (houses, for example) no longer open, until those scripts restart too.

**Restart the whole server** after you change or update the inventory.

## Searching needs hands up

`/search` opens only when the other rider can be searched (each one can be turned off in `Config.Search`):

* hands up,
* hogtied,
* cuffed,
* down or dead.

The inventory has no hands-up key of its own. Use your server's hands-up script; it works when it plays the game's hands-up task, or when it sets the `handsUp` state bag on the player (`LocalPlayer.state:set('handsUp', true, true)`).

## Hunger and thirst meters

The meters on the Outlaw Poster read the metabolism your server runs, with no setup:

| Script                                              | Read on |
| --------------------------------------------------- | ------- |
| CAS Metabolism                                      | client  |
| BLN HUD                                             | client  |
| Outsider Needs                                      | client  |
| VORP Metabolism                                     | client  |
| bcc-corehud                                         | server  |
| RSG Core (player metadata)                          | server  |
| Any script that sets `hunger` / `thirst` state bags | client  |

Something else? Change `Config.Metabolism` in `config/config.lua` (client) or `ServerConfig.Metabolism` in `config/config_server.lua` (server) to return hunger and thirst from 0 to 1. Without a metabolism script the meters stay hidden.

## Rider portraits

The small WANTED poster, the give list, gift cards, trades and searches show each rider's **Steam avatar** (`Config.SteamAvatars = true`):

* With `set steam_webApiKey "..."` in `server.cfg` the avatar comes from the Steam Web API; without it, from the rider's public Steam profile.
* Riders without Steam, and pictures that do not load, show the engraving.
* Your own picture service instead: `Config.PortraitUrl = 'https://example.com/portraits/{id}.png'` (`{id}` is the server id).

## Item pictures

Pictures are looked up by item name in `html/img/items/` (VORP) or `html/images/` (RSG). Scripts that add items (shops, crafting, CAS scripts) put their pictures there, so **copy that folder from your old inventory** when you install, and add new pictures there later.
