> 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/search-and-evidence.md).

# Search & Evidence

## Search & Evidence

#### Searching a player

Police can search another player and see what they are carrying, as a real container view rather than a printed list. Taking something out of it is a move like any other, and it is written to the ledger with the searcher as the actor.

```lua
Config.Search = { enabled = true }
```

The defaults follow ox\_inventory's `/steal`:

* `/steal` and `/search` both run it; no key is bound (`Config.Search.key`). `exports.aty_inventory:openNearbyInventory()` and ox's `openInventory('player')` run the same search.
* The nearest player in reach is picked, in any direction (`facing = -1.0`).
* Police and sheriff may search anybody without being on duty (`jobs`, `jobsOnDutyOnly = false`). Anyone may search a player who is dead, cuffed or has their hands up.
* No cooldown between searches (`cooldown = 0`), and the target is not told (`notifyTarget = false`).

```
invsearch <playerId> [targetId]   who that player would search, and whether they may
```

#### Evidence

```lua
Config.Evidence = { takeGroups = { 'police', 'sheriff' }, takeGrade = 2 }
```

An evidence locker is a stash with `evidence = true` on its definition. The shipped one, `police_evidence` at Mission Row, is police- and sheriff-only with ox's evidence locker size (100 slots, 100 kg). Any officer who may open it can put something in; taking something out needs one of `takeGroups` at `takeGrade` or above. A locker's own `takeGroups` / `takeGrade` override these.

An item an officer moves into a locker is stamped, in its own metadata, with who put it there and when, and the ledger row reads `evidence_in` (`evidence_out` on the way back). The stamp is never overwritten, so evidence moved between lockers keeps the officer who bagged it, and a stamped item never stacks with an unstamped one.

Because the stamp is metadata on the unit and the move is a ledger row, the chain of custody is answerable later:

```
invtrace <serial>
```

shows the item's whole life including the moment it became evidence.

```
invevidence          evidence locker self-test
invstamp [confirm]   give a serial to every unique item that has none yet
```

#### Corpses

A dead player's body is a container, opened with the same `/steal` or `/search`. Looting it is the same code path as any other container, with the same rules and the same ledger rows. Nothing falls to the ground on death by default (`Config.Death.enabled = false`, as in ox), so the body is where the items are.

{% hint style="info" %}
Because searching, looting and evidence all run through one transaction engine, a rule added in one place holds in all of them. There is no "but the search panel lets you" path.
{% endhint %}
