Skip to content

Items ​

np_doors uses five items. Their names are in Config.Items (shared/config/30_items.lua), so you can rename them.

Item Use Metadata
door_key Lock type key: no reader, checked on the spot when you open the door { door = id | group = key, label, serial, display }
keycard Lock type keycard: swiped at the reader { group, level, uses?, expires?, label?, serial, display }
door_ram The police ram: using it in front of a locked door starts the ram breach –
door_repair_kit Using it at a broken door repairs it (a timed progress bar) –
forged_print Counts as the fingerprint of metadata.identifier at fingerprint readers { identifier }

Breach tools (lockpick, thermite, drill) belong to your inventory and np_minigames setup. np_doors hands them to the game as opts.item (see Breach & alarms), and np_minigames refuses the start without the tool and uses it up by rule and chance.

Keys and keycards ​

  • A key fits when its door is the door's id, or its group is the door's key.group or its group key (group:<slug>). Config.Key.consume takes it on use.
  • A keycard fits when its group matches the door's keycard.group (or is Config.Keycard.masterGroup), its level is at least the door's, it has not expired and it has uses left. A swipe takes one use (no uses = unlimited); an empty card is taken when Config.Keycard.removeEmpty is on.
  • Hand them out with the exports giveKey(src, id, { kind = 'item' }) and giveKeycard(src, { group, level, uses?, expires?, label? }), or as staff with /doorcard.

np_inventory ​

Nothing to do: np_doors registers the items at runtime (RegisterItem, again after np_inventory restarts) with server = { export = 'np_doors.useItem' }. The definitions are Config.ItemDefs: category tools (the forged print misc), each with an icon and a tint. Key and keycard metadata shows as display rows in the item tooltip.

ox_inventory ​

Add to ox_inventory/data/items.lua:

lua
['door_key'] = { label = 'Door key', weight = 20, stack = false, close = true, description = 'Opens the door it was cut for.' },
['keycard'] = { label = 'Keycard', weight = 10, stack = false, close = true, description = 'Access card for keycard readers.' },
['door_ram'] = { label = 'Battering ram', weight = 8000, stack = false, close = true,
  server = { export = 'np_doors.useItem' } },
['door_repair_kit'] = { label = 'Door repair kit', weight = 2500, stack = true, close = true,
  server = { export = 'np_doors.useItem' } },
['forged_print'] = { label = 'Forged fingerprint', weight = 5, stack = false, close = true },

qb-inventory ​

Add to qb-core/shared/items.lua. np_doors wires the usable ones through QBCore.Functions.CreateUseableItem:

lua
door_key = { name = 'door_key', label = 'Door key', weight = 20, type = 'item', image = 'door_key.png', unique = true, useable = false, shouldClose = true, description = 'Opens the door it was cut for.' },
keycard = { name = 'keycard', label = 'Keycard', weight = 10, type = 'item', image = 'keycard.png', unique = true, useable = false, shouldClose = true, description = 'Access card for keycard readers.' },
door_ram = { name = 'door_ram', label = 'Battering ram', weight = 8000, type = 'item', image = 'door_ram.png', unique = true, useable = true, shouldClose = true, description = 'Police breaching ram.' },
door_repair_kit = { name = 'door_repair_kit', label = 'Door repair kit', weight = 2500, type = 'item', image = 'door_repair_kit.png', unique = false, useable = true, shouldClose = true, description = 'Fixes a broken door.' },
forged_print = { name = 'forged_print', label = 'Forged fingerprint', weight = 5, type = 'item', image = 'forged_print.png', unique = true, useable = false, shouldClose = true, description = 'A latex copy of a fingerprint.' },

Without an inventory ​

With Config.Inventory = 'none' (or no supported inventory started) there are no keys, keycards, rams, repair kits or forged prints. Access rules, PINs, fingerprints, faces, digital keys and staff repairs in the manager still work.