Items ​
np_cctv uses eight items. Cameras, recorders, monitors and USB sticks are unique (they never stack): the item carries what makes it that unit in its metadata.
The items ​
| Item | Label | Weight | What it is | Metadata |
|---|---|---|---|---|
cctv_camera |
Security camera | 800 g | Fixed camera | serial |
cctv_camera_ptz |
PTZ camera | 800 g | PTZ camera: pan, tilt, zoom, patrol sweep | serial |
cctv_camera_dome |
Dome camera | 800 g | Dome camera | serial |
cctv_doorbell |
Doorbell camera | 800 g | Doorbell camera | serial |
cctv_recorder |
Recorder | 2500 g | 48 hour buffer, 8 cameras | serial; recorderId while carried (the footage is still on it) |
cctv_recorder_pro |
Recorder Pro | 2500 g | One week buffer, 16 cameras | The same |
cctv_monitor |
CCTV monitor | 1500 g | A laptop that opens the monitor anywhere | |
cctv_usb |
USB stick | 20 g | One saved clip on a stick | clipId, serial, networkId, description |
Camera types and recorder items are data (shared/config/cameras.lua, exports.np_cctv:registerCameraType), so a server
may add more. Every type with an item needs that item in the inventory's list.
What using an item does ​
| Item | On use |
|---|---|
cctv_camera, cctv_camera_ptz, cctv_camera_dome, cctv_doorbell |
Starts the placement preview: ghost prop, view cone, coverage and recorder choice. Enter places it |
cctv_recorder, cctv_recorder_pro |
Starts the placement preview for a recorder: a new site, or one of your sites. A carried recorder (metadata recorderId) is set up again with its footage |
cctv_monitor |
Opens the monitor on every network the player may watch |
cctv_usb |
Opens the monitor in viewer mode on the clip. Works for anybody who holds the stick |
Placing a camera or recorder uses up the item; removing a camera gives the same item back with its serial. Item images:
inventories show the Font Awesome icon from the definition; for ox and qb name image files <item>.png.
np_inventory ​
Nothing to do. At start np_cctv registers every item with RegisterItem and registers them again whenever np_inventory
restarts. Usable items carry server = { export = 'np_cctv.useItem' }. To change an item, change its entry in the config
(camera types in Config.Cameras.types, recorders in Config.Recorder.items).
ox_inventory ​
Items cannot be registered at runtime. Paste this into ox_inventory/data/items.lua (inside the returned table) and add
images named <item>.png to ox_inventory/web/images. Used items call np_cctv.useItem; np_cctv answers false to
usingItem, so ox never consumes an item (np_cctv removes what it uses).
return {
-- ... your items ...
['cctv_camera'] = { label = 'Security camera', weight = 800, stack = false, close = true, server = { export = 'np_cctv.useItem' } },
['cctv_camera_ptz'] = { label = 'PTZ camera', weight = 800, stack = false, close = true, server = { export = 'np_cctv.useItem' } },
['cctv_camera_dome'] = { label = 'Dome camera', weight = 800, stack = false, close = true, server = { export = 'np_cctv.useItem' } },
['cctv_doorbell'] = { label = 'Doorbell camera', weight = 800, stack = false, close = true, server = { export = 'np_cctv.useItem' } },
['cctv_recorder'] = { label = 'Recorder', weight = 2500, stack = false, close = true, server = { export = 'np_cctv.useItem' } },
['cctv_recorder_pro'] = { label = 'Recorder Pro', weight = 2500, stack = false, close = true, server = { export = 'np_cctv.useItem' } },
['cctv_monitor'] = { label = 'CCTV monitor', weight = 1500, stack = false, close = true, server = { export = 'np_cctv.useItem' } },
['cctv_usb'] = { label = 'USB stick', weight = 20, stack = false, close = true, server = { export = 'np_cctv.useItem' } },
}
Evidence for a case is a stash evidence:<case> that np_cctv registers before adding the stick.
qb-inventory ​
For qb-inventory and its ps / lj forks. Paste this into qb-core/shared/items.lua (or your fork's items file). np_cctv
wires the use callbacks itself through QBCore.Functions.CreateUseableItem.
QBShared.Items = {
-- ... your items ...
cctv_camera = { name = 'cctv_camera', label = 'Security camera', weight = 800, type = 'item', image = 'cctv_camera.png', unique = true, useable = true, shouldClose = true, description = '' },
cctv_camera_ptz = { name = 'cctv_camera_ptz', label = 'PTZ camera', weight = 800, type = 'item', image = 'cctv_camera_ptz.png', unique = true, useable = true, shouldClose = true, description = '' },
cctv_camera_dome = { name = 'cctv_camera_dome', label = 'Dome camera', weight = 800, type = 'item', image = 'cctv_camera_dome.png', unique = true, useable = true, shouldClose = true, description = '' },
cctv_doorbell = { name = 'cctv_doorbell', label = 'Doorbell camera', weight = 800, type = 'item', image = 'cctv_doorbell.png', unique = true, useable = true, shouldClose = true, description = '' },
cctv_recorder = { name = 'cctv_recorder', label = 'Recorder', weight = 2500, type = 'item', image = 'cctv_recorder.png', unique = true, useable = true, shouldClose = true, description = '' },
cctv_recorder_pro = { name = 'cctv_recorder_pro', label = 'Recorder Pro', weight = 2500, type = 'item', image = 'cctv_recorder_pro.png', unique = true, useable = true, shouldClose = true, description = '' },
cctv_monitor = { name = 'cctv_monitor', label = 'CCTV monitor', weight = 1500, type = 'item', image = 'cctv_monitor.png', unique = true, useable = true, shouldClose = true, description = '' },
cctv_usb = { name = 'cctv_usb', label = 'USB stick', weight = 20, type = 'item', image = 'cctv_usb.png', unique = true, useable = true, shouldClose = true, description = '' },
}
Item metadata is stored in qb's info.
No inventory ​
With Config.Inventory = 'none' (or no supported inventory started) there are no items. Config.Install.noInventory
decides who may go on:
| Value | Who places and picks up gear with commands |
|---|---|
'staff' (default) |
Only staff |
'free' |
Everybody |
'off' |
Nobody |
Staff (or everybody on 'free') use /cctvcamera [fixed\|ptz\|dome\|doorbell], /cctvrecorder [item] and /cctvmonitor.
See Commands, keys & staff. USB sticks and the evidence hand-over need an inventory.