Skip to content

Installation ​

Requirements ​

  • A recent FiveM server artifact (Lua 5.4)
  • oxmysql
  • np_npchandler 1.1.0+: NPC guards, the Sight post guards, the plug and the intake bus driver
  • np_prophandler 1.1.0+: props held during progress bars, and the cell doors when no np_doors, ox_doorlock or qb-doorlock runs

np_npchandler and np_prophandler must start before np_prison.

  • Node 18+ to build the NUI once

Optional, auto-detected at start:

Kind Resources Used for
Framework es_extended, qbx_core, qb-core Character identifier and name, jobs and duty, cash and bank, admin groups, needs. Without one, np_prison runs standalone with no economy (see Bridges)
Inventory np_inventory, ox_inventory, qb-inventory, the ESX inventory Items, the property bag, hiding spots. Without one, there are no items and the property bag stays empty
HUD np_hud Toasts, progress bars, prompts, HUD zones. Without it, np_prison's own layer
Target ox_target, qb-target, np_menu World options (kiosks, cells, players). Without one, key prompts (E)
Phone np_phone The Corrections app, the sealed phone, collect calls. Without it, /corrections opens the app as a screen
Payments np_payments Fines as invoices; bail, top-ups, stamps and parcels through its checkout. Without it, framework money
Staff np_admin, np_discord Permission nodes, settings, staff tools and the audit log; staff and guards by Discord role
Voice pma-voice, saltychat, yaca-voice The handset at the visit booths and collect calls. Without one, both sides talk by proximity
Doors np_doors (first), ox_doorlock, qb-doorlock Cell doors at lockdown. Without one, np_prophandler doors (needs door models and coordinates)
Others np_character, np_tattoos, np_identification, np_helicam, MDT, np_gangs, np_drugs, np_screens, cd / ps / qs / core dispatch See Integrations
Zones np_colshape Enter and exit of the world points, the area around each facility and the zones of alternative sentences as colshapes. Needed on FiveM Legacy only, GTAV Enhanced has the natives built in. Without it, distance checks as before

At start the server console prints one line per sibling: active, fallback: …, missing export <name>, off in config or not running.

Steps ​

  1. Put the resource in resources/ as np_prison. The NUI callbacks use https://np_prison/… and other resources call exports.np_prison, so keep the name.
  2. Build the NUI:
    sh
    cd web && npm ci && npm run build
    This creates web/dist/index.html (every screen) and web/dist/phone.html (the np_phone Corrections app). web/dist is not committed, so a fresh clone starts with a blank UI until you build it.
  3. Database: the prison_* tables are created at start (Config.AutoCreateTables = true). To create them by hand, run sql/install.sql and the module files next to it (activities, commissary, contraband, escape, jobs, mail, parole, plug, visits).
  4. Add to server.cfg. The framework and the inventory are detected once, at start, so start them before np_prison. np_npchandler and np_prophandler are required and start before it too:
    cfg
    ensure oxmysql
    ensure es_extended        # or qbx_core / qb-core
    ensure np_inventory       # or ox_inventory / qb-inventory
    ensure np_prophandler
    ensure np_npchandler
    ensure pma-voice          # optional siblings before np_prison
    ensure np_hud
    ensure np_menu            # or ox_target / qb-target
    ensure np_phone
    ensure np_payments
    ensure np_admin
    ensure np_character
    ensure np_tattoos
    ensure np_identification
    ensure np_prison
  5. Remove other jail resources (pickle_prisons, esx_jail, qb-prison, …). np_prison answers their events itself, see Bridges → Other jail scripts.
  6. ox_inventory, qb-inventory or the ESX inventory: add the items. np_inventory gets them at start.
  7. Set the staff and job groups, then configure shared/config/ (Configuration) and walk through Before you open it.

Start order of the siblings

The np_* siblings may also start later or restart: np_prison registers its spawn provider, jailed provider, warrant provider and phone app again when np_character, np_tattoos, np_identification or np_phone restart, and seals the phones of online inmates again. When np_prophandler or np_npchandler restarts, np_prison registers its cell doors, guards, post guards and the plug again on np_prophandler:ready and np_npchandler:ready.

Permissions ​

np_prison uses no ACE and puts nothing into server.cfg for staff. Who does what comes from three places:

Roleplay jobs (Config.Jobs, framework job and minimum grade; on duty where the framework knows duty):

Group Default jobs May
guard doc, corrections Book, release, add and reduce time, the console, searches, parole decisions
police police, sheriff, bcso, sast Book (/jail, the sentencing screen), /jailstatus on others
judge judge, doj Trials and "send to judge" sheets, parole decisions
lawyer lawyer, publicdefender Told when a suspect asks for a lawyer; lawyer visits (Config.Visits.lawyerJobs)

Config.Permissions maps each action to a group: jail = 'police', unjail = 'guard', status = 'police', time = 'guard', alert = 'guard' ('police' means guard or police). Standalone servers set jobs in Config.StandaloneJobs by identifier.

Staff nodes. With np_admin running, grant these nodes to an np_admin group or a single player (or np_prison.*). They come on top of the jobs: an officer on duty still books without a grant.

Node Grants
np_prison.admin Every staff tool of np_prison; passes every prison check
np_prison.jail /jail, the sentencing screen, jail events
np_prison.unjail /unjail and release events
np_prison.settime Add and reduce time
np_prison.console Change a facility's alert level

Without np_admin, a player is staff when np_admin's lib fallback says so (the server console, the np_admin_fallback convar, ESX admin groups), or when one of these does:

  1. the framework's admin groups in Config.AdminGroups (admin, superadmin, god): ESX getGroup(), qb-core / qbx_core HasPermission;
  2. one of their identifiers is in Config.Admins ('license:…', 'discord:…', 'fivem:…', 'steam:…');
  3. np_discord runs and they hold a role of Config.AdminDiscordRoles.

Config.GuardDiscordRoles makes Discord roles guards on top of Config.Jobs.guard.

Items ​

np_prison adds 32 items, all prefixed prison_:

Kind Items
Commissary goods prison_noodles, prison_cigarettes, prison_coffee, prison_soap, prison_stamp, prison_phonecard, prison_cards, prison_bandage, prison_toothbrush, prison_snack, prison_chess, prison_pen, prison_photo, prison_idcard
Collectables prison_wood, prison_metal, prison_rope
Contraband prison_shovel, prison_wirecutters, prison_burner, prison_keymould, prison_guardkey, prison_guarduniform, prison_book (hollow book)
Made inside prison_shank, prison_pruno, prison_poster, prison_dummy
Breakouts prison_escape_note, prison_breach, prison_dirt
Release prison_release_paper (metadata { name, number, facility, months, status, date })

The commissary also sells water and radio from your inventory's own items. Items with a kind (goods, collectables, contraband, made inside) are taken away at release (Config.Commissary.stripOnRelease), not at an escape.

np_inventory registers every item at start, with np_prison's use callback. Nothing to paste.

ox_inventory: paste install/items.ox_inventory.lua.txt into ox_inventory/data/items.lua. Usable items carry server = { export = 'np_prison.useItem' }.

qb-core / qbx_core with qb-inventory: paste install/items.qb-inventory.lua.txt into qb-core/shared/items.lua. np_prison registers the use callbacks itself.

ESX inventory: import sql/items.sql (weights in whole kilograms).

The three install files list every np_prison item, including the breakout and release items. At start, np_prison prints every item the inventory does not know. Item images are read from Config.ImagePath (nui://np_inventory/web/images/), named <item>.png.

What each inventory can do:

np_inventory ox_inventory qb-inventory ESX
Item metadata yes yes yes (info) no
Property bag ConfiscateInventory / ReturnInventory ConfiscateInventory / ReturnInventory a list (items removed and given back) a list
Stashes yes yes no no

Tables ​

Table Holds
prison_inmates One row per character: facility, cell, security, months, behaviour, account, flags, status, inmate number, and current custody booking ID
prison_records Every booking, release, time change, search, bribe, shift and so on (the inmate's record)
prison_property The property bag: stash, items, seized items, cash
prison_kv Small persistent state (alert levels, flags, voicemail, burner numbers, …)
prison_timers Timers that survive restarts (solitary, release desk, bail, mail call, pruno, …)
prison_migrations Applied schema migrations
prison_commissary_limits, prison_commissary_topups, prison_commissary_packages Weekly limits, top-ups from outside, care packages
prison_plug_spots, prison_plug_trust, prison_contraband_stashes Where the plug stands, trust per inmate, hidden items
prison_job_stats, prison_skills Job stats per week, skill XP and certificates (kept after release)
prison_tunnels, prison_escapes Tunnels and escapees
prison_parole, prison_visits, prison_mail Hearings, booked visits, letters and packages

Convars ​

np_prison reads no convars of its own. With np_discord, the prison log channel uses np_discord's discord_webhook_prison; without np_admin, np_admin's lib reads np_admin_fallback.

Check it works ​

  1. The console prints np_prison ready with the framework, the inventory and one line per sibling.
  2. As police or staff, stand next to a player and run /jail without arguments: the sentencing screen opens.
  3. /jail <id> 5 books a player straight into a cell; /jailstatus <id> shows the sentence; /unjail <id> lets them out.
  4. As a guard, run /prisonconsole for the console.

Before you open it ​

What the test harness cannot check. Walk through these once on your server:

  1. Coordinates: the facilities, cells, areas, kiosks, job spots, escape places, visit booths and console computers are set for the vanilla map. Walk every cell and point at Bolingbroke, Mission Row and Paleto, and move them for your interiors or MLOs (shared/config/*.lua).
  2. Cell doors: list your doors in Config.Routine.doors (np_doors ids, ox_doorlock names, qb-doorlock ids, or model and coordinates for np_doors or np_prophandler doors) and watch a lockdown close them.
  3. Intake: book a player from the sentencing screen with transport on. Check the bus route, the mugshot spot, the jumpsuit components for both genders and that the own outfit comes back at release.
  4. A full day: a roll call, chow, one shift of each job, a workout, a table game, the commissary.
  5. Contraband: collect, trade with the plug, hide in the mattress, let a guard search the cell and pat you down.
  6. Breakouts: every route once, with enough police on duty (Config.Escape.minPolice). Check the exits, the siren sound and the dispatch call.
  7. Visits and phone: book a visit from the Corrections app, check in, talk through the handset; a collect call from a wall phone; a letter through guard review.
  8. NPC guards: with no guard on duty, the NPC officers appear at their posts, run a count and a shakedown.
  9. Staff: one account with the np_admin nodes (or in Config.Admins): jail, release and add time from np_admin's staff tools.

Troubleshooting ​

Problem Fix
Blank screens, nothing visible Build the NUI (web/dist missing)
/jail says no permission The player's job is not in Config.Jobs.police / guard (or off duty), or grant np_prison.jail in np_admin
Items are missing, nothing to buy The inventory does not know the items: see Items; the console lists the missing ones
The property bag is empty after release No inventory runs, or Config.Property.enabled = false
Cash was not moved to the account Standalone has no economy; otherwise Config.Account.takeCash
Breakouts are locked Fewer police on duty than Config.Escape.minPolice (2; outside job 6), or the facility is already at siren
Cell doors stay open at lockdown No doors listed in Config.Routine.doors
Visitors cannot hear the inmate No voice resource runs: they talk by proximity across the glass, so the booth positions must be close
The Corrections app is missing from the phone np_phone did not start, or Config.PrisonPhone.app.default = false (install it from the App Store)