Skip to content

Events, commands & keys ​

Server events ​

server

Server-local (AddEventHandler), never sent over the network: clients never receive them. The payload carries only the keys listed here. target, operator, src and owner are server ids; zones are lists of zone indexes (1 head, 2 shoulders, 3 chest, 4 waist, 5 thighs, 6 knees, 7 ankles).

Event Payload
np_metal-scanner:ready none
np_metal-scanner:scanned { target, scanner, venue, alarm, zones }: every gate pass of an open venue, bypass passes included (alarm = false)
np_metal-scanner:alarm { target, scanner, venue, zones, class }: a gate alarmed, or Hold & call backup raised it again (target may be nil)
np_metal-scanner:wanded { session, operator, target, coverage }: a wand run finished
np_metal-scanner:revealed { session, operator, target, zone }: a pat-down revealed a zone
np_metal-scanner:seized { session, case, operator, target, items } (items are summaries { kind, name, label, count })
np_metal-scanner:returned { session, operator, target, items }: items returned to the visitor, or a case released
np_metal-scanner:lockerStored { venue, locker, owner, items }
np_metal-scanner:lockerReturned { venue, locker, owner, items }
np_metal-scanner:declared { target, venue, item, permit }: a visitor declared a weapon on the tray
np_metal-scanner:caseCreated { case, venue, target }
np_metal-scanner:shiftStarted { src, venue, post }
np_metal-scanner:shiftEnded { src, venue, post }
np_metal-scanner:xrayFlagged { venue, scanner, bag, owner }
np_metal-scanner:watchlistMatch { venue, target, reason }
np_metal-scanner:queueLeft { venue, scanner, target }: a visitor left the queue (ran from the wand, walked away from a tray)
np_metal-scanner:scannerState { scanner, venue, state, reason }: idle, clear, alarm or offline
np_metal-scanner:tamper { src, kind }: the server and the client disagree about a weapon (loadout_mismatch, selected_mismatch), at most once a minute per kind and player
np_metal-scanner:find { src, area, find }: a ground detector find (find = { item, quality, value })
np_metal-scanner:evidenceFound { src, kind, coords }: police dug up a casing or weapon
lua
AddEventHandler('np_metal-scanner:seized', function(e)
  print(('case %d: %d item(s) taken from %d by %d'):format(e.case, #e.items, e.target, e.operator))
end)

To forward alarms to a dispatch resource, listen to np_metal-scanner:alarm. np_drugs' witness dispatch already covers gate holds and seizures when it runs.

np_metal-scanner listens to np_prison:jailed (it closes the open sessions of the jailed player), the np_inventory onDrop hook and np_inventory:server:ready. Its own net events (np_metal-scanner:rpc, rpcResult, ask, askResult, clientReady, init, nui, notify, sync, venues, venueDelta, scanners, scannerDelta, gateLight, gateOperator, wandStart, wandConsent, wandPose, wandStop, wandUse and the ground and placement events) are internal and may change; use the exports and server events above.

State bags ​

Bag On Meaning
npmsHold the player true while a visitor must wait for a gate decision, a wand run or a hold. Use it to freeze other interactions of the player
npCharacter (read) the player Standalone only: a character resource may set a character id that np_metal-scanner then uses as the identifier
job (read) the player Standalone only: { name, label, grade, onduty } set by another script

Commands ​

Command Who What
/securityconsole Operators in a venue The security console. The name is Config.Console.command ('' removes it)
/scannerplace Staff with place or configure The placement panel (also from np_admin's staff tools)

np_admin staff actions: Place scanners (np_metal-scanner.place) and Configure venues (np_metal-scanner.configure) both open the placement panel.

Keys ​

Every key is a RegisterKeyMapping entry named np_metal-scanner: … in Settings → Key Bindings → FiveM, so players can rebind it. The defaults come from the config files.

Key Where Action
E At a prompt Interact: open the tray, clock in, collect a locker, sell finds (Config.Keys.interact)
X While a progress bar runs Cancel (Config.Keys.cancel, with np_hud)
E / G / R / H Gate alarm Wave through / secondary / walk again / hold
F6 Near a gate Open the newest undecided alarm
Hold left mouse Wand Sweep
E / F / Z / Backspace Wand Pat down / turn / sensitivity / finish
Y / N / B Wand, as the target Comply / refuse / run
F7 Anywhere Equip or put away the ground detector
Q / 1 / 2 / E / J Ground detector Pinpoint / mute iron / mute foil / dig and tap / journal
Tab Placement Back to the panel
Z Placement Edit the trigger box
Mouse wheel Placement Rotate (Shift for 15°)
(none) Anywhere Console keybind (Config.Console.key)

The gate and wand keys are in Config.Gate.keys and Config.Wand.keys. With np_menu (or ox_target / qb-target) the people and props also get context options: Wand this person, Request pat-down on players and Open console on gate and pole props, plus a radial Security entry.