> For the complete documentation index, see [llms.txt](https://atiysus-organization.gitbook.io/aty-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://atiysus-organization.gitbook.io/aty-scripts/inventory/features/trading.md).

# Trading

## Trading

Two players, one shared table.

#### How a trade runs

One player invites another, from an item's **Trade** entry and a list of the players nearby. The invitation arrives unasked — it is not a menu the other player opened. On accept, both see the **same table** in place of the right-hand panel: your half on top, theirs below, updating live as either side adds or removes.

Both sides confirm. Only when both confirmations stand does anything move, and it moves as one transaction.

#### The oldest scam, made impossible

Change anything on the table after the other side has confirmed and **their confirmation is withdrawn**. They have to look again and confirm the new contents.

This is not moderated, it is structural: the confirmation is bound to the exact contents it was given for. There is no window in which a swap can land against a stale agreement.

#### What cannot be traded

* **Pinned items.** A pinned item cannot be put on the table at all — see below
* **Bound items.** An item whose definition says `bind = { trade = false }` (the shipped ID card does)
* Anything that would breach the receiver's weight or slot limits — checked before the commit, not after

#### Giving

A gift, not a trade: one item goes one way. By default it works as in ox\_inventory — **Give** hands the item to the player straight in front of you, or, in a vehicle, to the person in the seat beside you. A stack asks how many first; a single item goes at once. Nobody there, nothing is given and the panel says so.

```lua
Config.Give = { playerList = true }   -- pick from a list of nearby players instead
```

The same switch is on the admin panel's **Settings** tab (**Giving → Pick from a list**) and takes effect for every connected player at once, no reconnect.

Either way the server re-checks both players are online and in reach before anything moves.

#### Pinning

A player can pin a slot. A pinned item cannot be dropped, given, thrown or traded. It is a guard against fat-fingering away something that matters, and it is enforced in the transaction engine rather than in each interface — so there is no path, including a drag onto the ground panel, that bypasses it.

#### Commands

Trades and gives are started from the inventory, not from the console. The console has:

```
invtrade                                        self-test of the trade rules
invgive <playerId|inventoryId> <item> [count]   put an item into a player or container
```
