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, 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, 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. Each state is driven differently:

StateHow it becomes active
DeadOne Inventory sets state.dead from your framework (ESX death / QB metadata.isdead).
CuffedOne Inventory sets state.cuffed from your framework (QB metadata.ishandcuffed).
Hands upYour hands-up script sets state.handsup, or the target plays a recognised hands-up animation.
SearchableAny script sets state.searchable for "vulnerable for any reason".

Dead, cuffed and hands up are also detected automatically when the target plays one of the built-in animations listed in 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 detects a built-in set of animations. If your script plays one of these, the target is flagged automatically, with no statebag to set. These animations are fixed (not configurable); the matching toggle under Allow searching on still has to be enabled.

Cuffed

  • mp_arresting / 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 uses one of the standard animations above.