π Adding a New Police Unit
This step-by-step guide walks you through adding a new police faction (e.g. SASP, FIB, Rangers) to the XR-MDT system.π Prerequisites
Before you begin, make sure you have:- β
A job defined in your framework (
qb-core/shared/jobs.luaor ESXjobstable) - β
A logo file ready (
.webpformat recommended,256Γ256px) - β
Access to
configs/config.police.luaandconfigs/config.main.lua
π§ Step 1 β Define the Faction in config.police.lua
Open configs/config.police.lua and add a new entry to the Config.PoliceJobs table. The key must match the job name from your framework.
Config.PoliceJobs = {
['police'] = { ... }, -- existing LSPD
['sheriff'] = { ... }, -- existing LSSD
-- ========================================================
-- SASP β San Andreas State Police (NEW UNIT)
-- ========================================================
['sasp'] = {
-- 1. DISPLAY DATA
DisplayName = 'San Andreas State Police',
ShortName = 'SASP',
LogoFile = 'images/sasp.webp', -- place file in web/dist/
Theme = 'sasp', -- CSS theme class
Colors = {
primary = '#7c3aed', -- main accent color (purple)
primaryDark = '#5b21b6', -- darker variant
bg = 'rgba(124, 58, 237, 0.1)' -- element background
},
-- 2. COMMAND / KEYBIND
TabletCommand = 'saspmdt', -- /saspmdt opens the tablet
OpenKey = 'F8', -- keyboard shortcut
-- 3. PREFIXES
CamPrefix = 'SASP', -- Bodycam ID: SASP-XXXXXXXXX
PlatePrefix = 'SASP', -- License plate: SASP 123
-- 4. GPS
BlipColor = 27, -- Blip color on map (FiveM Blip Color ID)
-- 5. STATUS CODES (THREAT LEVEL)
Codes = {
{ id = 'green', label = 'CODE GREEN', color = '#22c55e', description = 'Stable situation.' },
{ id = 'yellow', label = 'CODE YELLOW', color = '#eab308', description = 'Heightened awareness.' },
{ id = 'red', label = 'CODE RED', color = '#ef4444', description = 'Active threat.' },
{ id = 'black', label = 'CODE BLACK', color = '#0f172a', description = 'Critical state.' },
},
-- 6. DOCUMENT LINKS
Documents = {
{ title = 'SASP Handbook', url = 'https://docs.google.com/document/d/YOUR-ID' },
{ title = 'SASP Database', url = 'https://docs.google.com/spreadsheets/d/YOUR-ID' },
},
-- 7. PERMISSIONS PER GRADE
Grades = {
['0'] = {
label = 'Trooper',
permissions = {
dashboard_view = true,
profiles_view = true,
profiles_edit = false,
reports_view = true,
reports_create = true,
reports_delete = false,
warrants_view = true,
warrants_create = false,
warrants_delete = false,
vehicles_view = true,
vehicles_edit = false,
convictions_create = false,
employees_view = true,
employees_manage = false,
dispatch_view = true,
cameras_view = false,
admin = false,
code_change = false,
custom_fine = false,
custom_sentence = false,
weapons_view = true,
units_view = true,
units_manage = false,
}
},
['1'] = {
label = 'Senior Trooper',
permissions = {
dashboard_view = true,
profiles_view = true,
profiles_edit = true,
reports_view = true,
reports_create = true,
reports_delete = false,
warrants_view = true,
warrants_create = true,
warrants_delete = false,
vehicles_view = true,
vehicles_edit = true,
convictions_create = true,
employees_view = true,
employees_manage = false,
dispatch_view = true,
cameras_view = true,
admin = false,
code_change = false,
custom_fine = true,
custom_sentence = true,
weapons_view = true,
units_view = true,
units_manage = false,
}
},
['2'] = {
label = 'Corporal',
permissions = {
dashboard_view = true, profiles_view = true, profiles_edit = true,
reports_view = true, reports_create = true, reports_delete = true,
warrants_view = true, warrants_create = true, warrants_delete = false,
vehicles_view = true, vehicles_edit = true, convictions_create = true,
employees_view = true, employees_manage = false, dispatch_view = true,
cameras_view = true, admin = false, code_change = true,
custom_fine = true, custom_sentence = true, weapons_view = true,
units_view = true, units_manage = true,
}
},
['3'] = {
label = 'Sergeant',
permissions = {
dashboard_view = true, profiles_view = true, profiles_edit = true,
reports_view = true, reports_create = true, reports_delete = true,
warrants_view = true, warrants_create = true, warrants_delete = true,
vehicles_view = true, vehicles_edit = true, convictions_create = true,
employees_view = true, employees_manage = true, dispatch_view = true,
cameras_view = true, admin = false, code_change = true,
custom_fine = true, custom_sentence = true, weapons_view = true,
units_view = true, units_manage = true,
}
},
['4'] = {
label = 'Lieutenant',
permissions = {
dashboard_view = true, profiles_view = true, profiles_edit = true,
reports_view = true, reports_create = true, reports_delete = true,
warrants_view = true, warrants_create = true, warrants_delete = true,
vehicles_view = true, vehicles_edit = true, convictions_create = true,
employees_view = true, employees_manage = true, dispatch_view = true,
cameras_view = true, admin = true, code_change = true,
custom_fine = true, custom_sentence = true, weapons_view = true,
units_view = true, units_manage = true,
}
},
['5'] = {
label = 'Colonel',
permissions = {
dashboard_view = true, profiles_view = true, profiles_create = true,
profiles_edit = true, reports_view = true, reports_create = true,
reports_delete = true, warrants_view = true, warrants_create = true,
warrants_delete = true, vehicles_view = true, vehicles_edit = true,
convictions_create = true, employees_view = true, employees_manage = true,
dispatch_view = true, cameras_view = true, admin = true,
code_change = true, custom_fine = true, custom_sentence = true,
weapons_view = true, units_view = true, units_manage = true,
}
},
},
-- 8. FACTION VEHICLES (MDT GARAGE)
Vehicles = {
{ model = 'saspstanier', label = 'SASP Stanier', price = 50000, category = 'patrol' },
{ model = 'saspbuffalo', label = 'SASP Buffalo', price = 65000, category = 'patrol' },
{ model = 'saspgranger', label = 'SASP Granger', price = 75000, category = 'suv' },
{ model = 'saspmustang', label = 'SASP Dominator', price = 90000, category = 'sport' },
{ model = 'saspmav', label = 'SASP Helicopter', price = 0, category = 'air' },
},
-- 9. VEHICLE CATEGORIES
VehicleCategories = {
['patrol'] = 'Patrol',
['sport'] = 'Interceptors',
['suv'] = 'SUV / Offroad',
['air'] = 'Aircraft',
},
-- 10. CUSTOM VEHICLE IMAGES (optional)
CustomVehicleImages = {
-- ['saspstanier'] = 'https://link.to/image.png',
},
-- 11. PENAL CODE (optional, can copy from LSPD)
PenalCode = {
traffic = {
label = 'Traffic Violations',
options = {
{ name = 'speed', label = 'Speeding', jail = 0, fine = 1000 },
{ name = 'noLicense', label = 'Driving w/o License', jail = 0, fine = 500 },
{ name = 'dui', label = 'DUI', jail = 15, fine = 5000 },
}
},
weapons = {
label = 'Weapons',
options = {
{ name = 'illegalWeapon', label = 'Illegal Weapon', jail = 15, fine = 5000 },
{ name = 'armedRobbery', label = 'Armed Robbery', jail = 30, fine = 10000 },
}
},
},
},
}
π§ Step 2 β Activate the Faction
In the same file (configs/config.police.lua), add the new job to Config.EnablePoliceJobs:
Config.EnablePoliceJobs = {
'police', -- LSPD
'pd', -- PD Alias
-- 'sheriff', -- LSSD
-- 'bcso', -- BCSO
'sasp', -- β NEW UNIT: San Andreas State Police
}
[!IMPORTANT] If you donβt add the job toConfig.EnablePoliceJobs, the faction will not register any commands or tablet keybinds β even if itβs defined inConfig.PoliceJobs.
π§ Step 3 β Logo & Assets
- Prepare a logo in
.webpformat (recommended256Γ256px) - Place the file in:
web/dist/images/sasp.webp - The filename must match the
LogoFilevalue in your config:LogoFile = 'images/sasp.webp'
π§ Step 4 β Bodycam Access (optional)
To allow your SASP officers to use bodycams, add'sasp' to the lists in configs/config.main.lua:
Config.Cameras = {
AllowedJobs = { "police", "pd", "ambulance", "sasp" }, -- β add here
ViewerJobs = { "police", "pd", "ambulance", "sasp" }, -- β and here
JobPrefixes = {
police = "POLICE",
ambulance = "AMBULAN",
sasp = "SASP", -- β new prefix
},
-- ...
}
π§ Step 5 β Helicopter Spawn (optional)
To add a helicopter spawn point for SASP, add an entry inconfigs/config.main.lua:
Config.HeliSpawns = {
LSPD = { ... },
EMS = { ... },
SASP = { -- β new spawn
PedCoords = vector4(x, y, z, heading), -- NPC position
PedModel = 's_m_y_cop_01', -- NPC model
SpawnCoords = vector4(x, y, z, heading), -- helicopter spawn
MinGrade = 4, -- minimum grade
VehicleModel = 'polmav', -- vehicle model
Livery = 2, -- livery ID
Job = 'sasp' -- job name
},
}
π§ Step 6 β Map Blips (optional)
Add a blip for the SASP headquarters:Config.Blips = {
-- ... existing blips ...
{
Coords = vector3(x, y, z), -- station coordinates
Sprite = 60, -- blip icon
Color = 27, -- color (should match BlipColor in the faction)
Scale = 0.8,
Label = 'SASP HQ'
},
}
π§ Step 7 β Printer (optional)
Config.Printers = {
-- ... existing printers ...
{
Coords = vector3(x, y, z), -- printer coordinates at SASP base
Label = 'SASP Printer',
Distance = 20.0
},
}
π§ Step 8 β Restart & Verify
ensure xr-mdt
[!WARNING] You must fully restart the resource (ensure xr-mdt), a simplerefreshis not enough. Config files are loaded at startup.
β Checklist
| Step | Status |
|---|---|
| Job defined in framework (qb/esx) | β |
Entry in Config.PoliceJobs['sasp'] | β |
Added to Config.EnablePoliceJobs | β |
Logo .webp placed in web/dist/images/ | β |
| Grades and permissions configured | β |
Vehicles added (Vehicles) | β |
Penal code configured (PenalCode) | β |
| Bodycam jobs updated (optional) | β |
| HeliSpawn added (optional) | β |
| Blips and printers added (optional) | β |
| Resource restarted | β |
π Permissions Reference
| Permission | Description |
|---|---|
dashboard_view | View the dashboard with statistics |
profiles_view | Browse citizen profiles |
profiles_edit | Edit profiles (notes, photos) |
profiles_create | Create new profiles |
reports_view | Browse reports |
reports_create | Create reports |
reports_delete | Delete reports |
warrants_view | Browse warrants |
warrants_create | Issue warrants |
warrants_delete | Remove warrants |
vehicles_view | Browse the vehicle registry |
vehicles_edit | Edit vehicle data |
convictions_create | Issue sentences (jail + fine) |
employees_view | Browse the employee list |
employees_manage | Manage employees (promote, demote) |
dispatch_view | Access the dispatch panel |
cameras_view | Access the cameras tab |
admin | Full administrative permissions |
code_change | Change the status code (threat level) |
custom_fine | Issue fines with a custom amount |
custom_sentence | Issue sentences with custom jail time |
weapons_view | Browse the weapon registry |
units_view | View units |
units_manage | Manage units |
Β© XR-Core Systems | Professional FiveM Resources
