Skip to content

Installation ​

This guide will walk you through installing prp-security on your FiveM server.

Installation steps

1
Download the resources
Download both prp-sensor and prp-security from the CFX portal and place them in your resources folder.
2
Add to server.cfg
Add both resources to your server.cfg after all dependencies, with the sensor resource before the main script.
ensure ox_lib
ensure prp-bridge
ensure prp-security-assets
ensure prp-sensor
ensure prp-security
3
Database
The devices and device_access tables are created automatically on first run.
4
Add items
Add the required items to your inventory resource — see Items below.
5
Configure shared.lua
Open config/shared.lua to configure device types, route buckets, device models, sensor and camera settings and allowed place materials.
6
Configure server.lua
Open config/server.lua to configure how long devices can be placed for, item names and commands.
7
Optional: route buckets
To use route buckets on devices, call prp-security:client:client:routeChanged when a player's route bucket changes (see client/editable.lua). If you store route bucket in a custom way, edit GetCurrentPlayerRoute in server/editable.lua.
8
Optional: inventory icons
Custom inventory icons are included in the installation/inventory icons folder. Copy them to your inventory resource's image directory if you'd like to use them.

Items ​

Add all required items to your inventory resource using the format appropriate for your setup.

Add items listed below to your ox_inventory into data/items.lua.

lua
["security_camera"] = {
    label = "Security Camera",
    weight = 0,
    stack = false
},
["motion_sensor"] = {
    label = "Motion Sensor",
    weight = 0,
    stack = false
},
["privacy_tool"] = {
    label = "Device Pry Tool",
    weight = 0,
    stack = false
},

Database ​

The resource creates the following tables automatically:

sql
CREATE TABLE IF NOT EXISTS `devices` (
    `id`                int NOT NULL AUTO_INCREMENT,
    `stateId`           varchar(255) NULL,
    `name`              varchar(50) NULL,
    `device_type`       varchar(50) NULL,
    `code`              varchar(50) NOT NULL,
    `transform`         longtext NOT NULL,
    `route`             varchar(50) DEFAULT '0' NULL COMMENT 'This is the routing bucket for the actual entity.',
    `destroyed_at`      int DEFAULT 0 NULL,
    `created_at`        timestamp DEFAULT current_timestamp() NULL,
    PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `device_access` (
    `id`                int NOT NULL AUTO_INCREMENT,
    `device_id`         int NOT NULL,
    `stateId`           varchar(255) NULL,
    `code`              varchar(50) NOT NULL,
    `access_granted`    timestamp DEFAULT current_timestamp() NULL,
    key `device_id` (`device_id`),
    constraint `device_access_ibfk_1` foreign key (`device_id`) references `devices` (`id`) ON DELETE CASCADE
);