> 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/give-trade-search.md).

# Give, trade and search

Giving items with accept or decline, the two sided trade window with cash, searching and robbing players with hands up, hogtied, cuffed or down, and confiscation for lawmen in CAS Advanced Inventory.

Three ways for riders to pass things between them. Each one is checked by the server at every step, so nothing can be duplicated or lost on the way ([Duplication protection and logs](/script-documentation/cas-advanced-inventory/security.md)).

## Give

1. Right click an item in your satchel and choose **GIVE** (or hover it and press **G**).
2. Pick a rider from the list of riders near you (`Config.Give.Distance`, 3 m by default) and the amount.
3. The other rider gets an offer card with your name, the item and whether they can carry it. They accept with **ENTER** or decline with **BACKSPACE**, even with their satchel closed. They have `Config.Give.AcceptSeconds` (15 s).

**Nothing leaves your satchel until they accept**, and everything is checked again at that moment: if you no longer have it, or they can no longer carry it, the give is called off.

## Money and gold

Click your cash or gold in the satchel header, type the amount and pick a rider near you, then **GIVE**. The money changes hands at once and both riders are told. **DROP** leaves it on the ground as a bundle that anyone nearby can pick up; it is paid out once, even if two riders grab it at the same moment.

## Trade

1. Stand near another rider and type `/trade` (or use your server's radial menu). The trade window opens for both of you.
2. Drag items into your side of the deal, add cash if you like. You see the other side live.
3. Both press **READY**. Any change to either side clears both READY marks, so nobody can swap an item at the last second.
4. When both are ready, everything changes hands at once. If one of you walks away (`Config.Trade.Distance`) or cancels, the deal is called off and nothing moves.

Items you put on the table cannot leave your satchel while the trade is open. You cannot trade while searching or being searched.

## Search and robbery

1. Stand next to a rider and type `/search` (or use the radial menu).
2. The search opens only when the other rider can be searched: hands up, hogtied, cuffed or down (each one can be switched off in `Config.Search`). The inventory has no hands-up key of its own: your hands-up script has to play the game's hands-up task or set the `handsUp` state bag ([Stashes and other scripts](/script-documentation/cas-advanced-inventory/compatibility.md#searching-needs-hands-up)).
3. You see their satchel and what they wear. Take the items you pick, all weapons, or everything. Worn pieces can be pulled off.
4. A timer shows how long the rider has to keep their hands up (`Config.Search.HandsUpSeconds`, 40 s). The search ends when you close it or walk away.

The searched rider is told someone is going through their pockets, and their own satchel stays closed during the search.

## Lawmen and the evidence locker

Riders whose job is in `Config.Search.ConfiscateJobs` (with at least the listed grade) get a **CONFISCATE** button in the search. Confiscated items go to a shared stash, `Config.Search.EvidenceStash` (`evidence_locker` by default), instead of the lawman's satchel. Open it from your police script like any stash: `exports.vorp_inventory:openInventory(source, 'evidence_locker')` on VORP (register it first with `registerInventory` if nothing was confiscated since the start).

```lua
ConfiscateJobs = { sheriff = 0, police = 0, marshal = 0, lawman = 0 }, -- job = minimum grade
```

## Logs

Every give, trade, search and confiscation can be sent to Discord: set the `give`, `trade` and `search` webhooks in `config/config_server.lua`.

## Starting them from other scripts

Radial menus and target scripts can start a trade or a search, see [For developers](/script-documentation/cas-advanced-inventory/developers.md#starting-things-from-other-scripts). The chat commands can be renamed or turned off in `Config.Commands`.
