One Studios
Guides

Search Players

Configure who can search other players, and when a target is vulnerable enough to be searched.

One Inventory lets a player search another player's inventory (the police "frisk" feature). There are two ways someone is allowed to search a target:

  1. By job - anyone whose job is in the allowed-jobs list can search anyone.
  2. By vulnerability - everyone else can only search a target that is in an enabled "vulnerable" state (dead or in last stand, cuffed, hands up, or otherwise marked searchable).

Configuration

Configure it in the admin panel under Config -> Gameplay -> Search:

Enabled
Turns the whole player-search system on or off.
Distance
How close the searcher must be to the target.
Allowed jobs
Jobs that bypass the vulnerability check and can search anyone. Leave it empty so nobody gets the bypass (search then only works against vulnerable targets).
Allow searching on
Toggles deciding when someone without an allowed job may search a target: dead (or in last stand), cuffed, hands up, or searchable. Enable the states you want to count as "vulnerable".
With the section disabled, no one can search anyone. With allowed jobs empty, only vulnerable-target searches work. With every vulnerability toggle off, only allowed-jobs players can search.

Vulnerable states

A target counts as vulnerable when an enabled state is active. One Inventory tracks each state itself and reacts; you don't set our own dead / cuffed statebags. Each state is sourced differently:

StateHow One Inventory knows
Dead (or in last stand)Tracked internally from your framework's death and last-stand metadata / events, with the "fatally injured" native (IsPedFatallyInjured) as a fallback.
CuffedTracked internally from your framework's cuff events. Also reads an external state.cuffed statebag (so other police scripts keep working), and falls back to the cuffed native (IsPedCuffed).
Hands upExternal input: your hands-up script sets state.handsup, or the target plays a configured hands-up animation.
SearchableExternal input: any script sets state.searchable to mark a target "vulnerable for any reason".

Dead, cuffed, and hands up are also matched against per-state search animations, which are configured in the admin panel (see Option 2).

Integrating a custom hands-up or vulnerability script

If you run a hands-up, restrain, or minigame script that should make a player searchable, you have two options. Use whichever fits your script.

Option 1: set the statebag

Set the matching state when your script makes the player vulnerable, and clear it when they're no longer vulnerable.

-- Generic "vulnerable for any reason" (any script):
-- Server
Player(src).state:set('searchable', true, true)
-- Client
LocalPlayer.state:set('searchable', true, true)

-- Hands-up specifically, if your script doesn't already set it:
LocalPlayer.state:set('handsup', true, true)
The state you set only enables searching if its matching toggle is on under Allow searching on (for example, set searchable and enable the "searchable" toggle).

Option 2: play a recognised animation

One Inventory also matches a set of animations per state. If your script plays a configured animation for that state, the target is flagged automatically, with no statebag to set. Manage these per state in the admin panel's Search config; the matching toggle under Allow searching on still has to be enabled.

Sensible defaults are seeded, and you can add or remove animations in the panel:

Cuffed

  • mp_arresting / idle
  • anim@move_m@prisoner_cuffed / idle

Dead

  • dead / dead_a

Hands up

  • missminuteman_1ig_2 / handsup_base
  • missminuteman_1ig_2 / handsup_enter
  • random@mugging3 / handsup_standing_base
The statebag route is best when your script already tracks the state. The animation route just works if your hands-up or restrain script already plays one of the configured animations above.