Skip to content

Lock types & access ​

Opening a door has two stages. Access decides who may open it at all: job, gang, character, an item, a property, a digital key, public hours. The lock chain (door.lockTypes) is what that person still has to pass at the door: a key, a keycard, a code, a fingerprint, a face. A door without a lock chain opens on access alone; a door without access rules but with a chain opens for anybody who holds the factors.

Every toggle is checked again on the server: distance (the door's distance + Config.DistanceTolerance), the routing bucket, the rate limit and access.

At the door ​

Door labels: the near card, a far tile and the prompt variants

A door shows one of three levels of detail, closest first, at most Config.Interaction.maxLabels (12) at once:

Level Range Shows
Far labelRange (25 m) A small lock tile in the door's state colour
Mid midRange (10 m) A chip with the door's name and state
Near nearRange (2 m, or the door's distance) The card: building, door, state, why you may open it (via) and the prompts

The card names the reason ("LSPD · Sergeant", "Key from Mia · 2 h", "Lab card · 1") or the step that comes next (swipe keycard, enter code, scan face). An open door with an auto-lock shows the countdown, and a toast with a timer bar follows every toggle (np_hud, or np_doors' own toast).

Key Action
E Use: unlock or lock, or start the lock chain
G Knock (a sound inside)
H Ring the bell (np_doors:ring, np_housing opens its door cam)
ALT Details
X Breach, when you may try a method on this door (Breach & alarms)

Players rebind the keys in the GTA settings under FiveM. With Config.Interaction.mode = 'target' the same actions are options on np_menu, ox_target or qb-target instead.

Door states: locked, open, timed (open with an auto-lock running), alarm and broken.

Access rules ​

A rule sits on a door (inline in its config, or in npd_access), on its group (group:<slug>) or on its building (building:<slug>).

lua
{ kind = 'job',          -- job | gang | identifier | character | item | property | source | public
  subject = 'police',     -- the job, gang, identifier, character id, item, property id or source name
  allow = true,           -- false = deny (deny wins)
  grade = 2,              -- minimum grade (job) or rank (gang: member 0, trusted 1, og 2)
  onduty = true,          -- job rules: on duty only
  expires = 1790000000,   -- unix seconds (a temporary grant)
  window = { from = '06:00', to = '22:00', days = { 1, 2, 3, 4, 5 } },  -- 1 = Monday
  shop = '247_1',         -- public rules: only while np_shops says this shop is open
  param = 'x' }           -- handed to access sources
Kind Matches Through
job The player has the job with at least grade (and is on duty with onduty) np_faction HasJob over every job of the player; otherwise the framework job
gang Gang member with at least the rank np_gangs GetGang; otherwise qb / qbx PlayerData.gang
identifier The framework identifier –
character The active character np_character; otherwise the framework identifier
item The player carries the item The inventory bridge
property The access source property says yes np_housing registers it
source The custom access source named in subject says yes registerAccessSource
public Everybody, optionally inside window or while the shop is open np_shops IsShopOpen for shop

Resolution order ​

  1. Staff override: np_doors.override opens every door, without access or lock chain.
  2. Building lockdown: only Config.Lockdown.jobs (and staff) get through (lockdown).
  3. Forced-lock hours of the schedule.
  4. Deny rules win over every allow rule.
  5. Allow rules: the door's own, its group's, its building's, the inline config rules, the door owner.
  6. Digital keys (Phone app). With Config.Keys.skipChain a key also skips the lock chain.
  7. Public doors and public schedule hours.
  8. A door without allow rules but with a lock chain: the chain is the gate.

Lock types ​

door.lockTypes is walked in order on the server; each step is a reader on the client and an answer from the server. An evidence room with { 'keycard', 'pin' } asks for the card first, then the code.

Type Reader Passes when
key none The player carries a door_key that fits (Items)
keycard Keycard A keycard of the right group and level, not expired, with uses left
pin Keypad The code is right
finger Fingerprint The character is enrolled, or carries a forged print of an enrolled character, and wears no gloves
face Face ID The character is enrolled and the face is not covered

Addons add more types with registerLockType.

Keypad (pin) ​

Keypad with a wrong code

The code is hashed with sha256 and a per-door salt at load and never leaves the server. Config.Keypad.maxTries (3) wrong codes within window (300 s) lock the keypad for everybody for lockout (120 s), and with alarmOnLockout trip the door's alarm. door.pin = { provider = 'np_passwords', lock = '<id>' } hands the keypad to np_passwords (Prompt and ConsumeUnlock) instead.

With the optional wall devices on, a door whose device is an np_door_keypad is typed on the wall keypad itself instead of this screen (the 3D keypad); the server check is the same.

Keycard ​

Keycard reader

door.keycard = { group = 'mrpd', level = 2 }. The reader takes the first card that fits; a master card (Config.Keycard.masterGroup) fits every group. Each swipe takes one use.

Fingerprint (finger) ​

Enrolled finger Gloves on
Fingerprint Gloves

Prints are enrolled per door and character (in the manager or with /doorenroll). The server reads the arms drawable of the ped: anything not in Config.Finger.bareArms for the model counts as gloves and always fails. A forged_print item counts as the fingerprint of its metadata.identifier. maxTries (5) failed scans lock the reader for that player for 60 s.

Face ID (face) ​

Face clear Mask Glasses
Face clear Mask Glasses

Bound to the character like fingerprints, but fails while the face is covered. The server re-reads the ped before it decides, so a client cannot claim an uncovered face:

Blocker Read from Covers
Mask Component 1 (drawable 0 = none); np_clothing's isMasked counts too Head, mouth
Glasses Prop 1 (-1 = none) Eyes
Helmet Prop 0 in Config.Face.helmets Head, eyes, mouth
Hat Any other prop 0, only when the door sets face.hats = true Head

Config.Face.allow lists see-through drawables (clear lenses, open masks) that never count. The reader shows a head / eyes / mouth checklist, offers Remove mask (through np_clothing once it offers that) and the door's face.fallback (finger, pin or keycard). Liveness (blink) is a short cosmetic step. A denied face asks np_cctv for a clip near the door (Config.Face.snapshot).

Schedules, timers and lockdown ​

  • Weekly schedule: each hour of the week is normal, open to the public or forced lock. Configure it as slots or as a 7 × 24 grid (Configuration); the manager edits the grid by painting. A shop door with public hours from 09:00 to 18:00 opens for everybody then and returns to its rules afterwards.
  • Auto-lock: autoLock seconds after an unlock the door locks itself.
  • Hold-open: a door with holdOpen stays open while somebody is in the doorway.
  • Timed unlock: TimedUnlock(id, seconds) opens a door and relocks it, for "let in" from np_housing or a heist script.
  • Lockdown: /doorlockdown <building>, the manager's Lockdown button or the lockdown export locks every door of a building. Only Config.Lockdown.jobs and staff with np_doors.override open them until the lockdown ends. A lockdown survives restarts.

The schedule follows the server's wall clock, shifted by Config.Clock.hourOffset.