Skip to content

Installation ​

Requirements ​

  • A recent FiveM server artifact (Lua 5.4)
  • oxmysql
  • np_prophandler and np_npchandler, both 1.1.0+: the scene props and peds, the editor's preview objects and the tools in the hand go through them. Both must start before np_environmental
  • Node 18+ to build the NUI once

Optional, auto-detected at start:

Kind Resources Used for
Framework es_extended (first-class), qbx_core, qb-core Character identifier and name, jobs, grades and duty (factions), money for payouts, society accounts. Without one, np_environmental runs standalone: everybody is a civilian and there is no economy, so nothing is paid
Inventory np_inventory (items registered at runtime), ox_inventory, qb-inventory Tool items (chainsaw, cones, flares, …) and usable cones / flares. Without one, tasks that need an item answer needs_item ("You need the right tool for this.") and place tasks are done with the prompt. See Items
np_* siblings np_hud, np_phone, np_menu, np_admin, np_discord, np_character, np_gangs, np_drugs, np_banking See Integrations. None of them is required
Zones np_colshape Enter and exit of the interaction points and the hazard zones as colshapes. Needed on FiveM Legacy only, GTAV Enhanced has the natives built in. Without it, distance checks as before

Steps ​

  1. Put the folder in resources/ as np_environmental. The NUI callbacks use https://np_environmental/…, the np_phone app page is served from https://cfx-nui-np_environmental/…, and other resources call exports.np_environmental, so keep the name.
  2. Build the NUI once:
    sh
    cd web && npm install && npm run build
    This creates web/dist/index.html (markers, scene card, clean-up HUD, report form, board, editor, director) and web/dist/phone/index.html (the np_phone Scene app). Without it, the resource starts with a blank UI.
  3. Add to server.cfg. Start np_environmental after oxmysql, the framework, the inventory, np_prophandler, np_npchandler and every np_* sibling you use:
    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 np_hud           # optional
    ensure np_phone         # optional: the Scene app, alerts, 911 / 311 voice reports
    ensure np_menu          # optional
    ensure np_admin         # optional: permissions, settings, staff tools
    ensure np_banking       # optional: society payouts
    ensure np_environmental
    There are no add_ace lines: staff get the np_environmental.* nodes in np_admin (see Staff).
  4. The tables are created on the first start (sql/install.sql has the same SQL). An empty installation is seeded with the 20 starter templates and 52 example spawn points.
  5. Map the factions to your job names in shared/config/00_core.lua (Config.Factions, see Configuration → Factions).
  6. ox_inventory / qb-inventory: add the items from Items. np_inventory needs nothing.
  7. Optional, with np_phone: add a 311 line for the city services (see Reporting → A 311 line).

Start order

Siblings may also start or stop later. np_environmental registers its phone app, its items and its np_menu options again when they come back, and prints the new status of the sibling.

Check the example spawn points

The 52 example spawn points sit on real roads, piers, beaches and fields of the vanilla map. Check them on your map before going live, or skip them with Config.Catalogue.seedSpawns = false and add your own in the editor.

Permissions ​

np_environmental uses no ACE. With np_admin running, the nodes np_environmental.admin, .director, .editor and .cleanup appear in its permission matrix. Without np_admin, staff are the identifiers in Config.Admins, the framework groups in Config.AdminGroups and the np_discord roles in Config.AdminDiscordRoles. See Staff.

Tables ​

Table Holds
env_meta Schema version, seed flags, the director's next roll, pause state and rule overrides
env_templates Templates (JSON), enabled, weight
env_spawns Spawn points: a point or a zone, for one template or for kinds of template
env_scenes Scenes, live ones included (loaded again after a restart), with their tasks, shares, units and a snapshot of the template
env_reports Every report: caller, service, text, precise or vague, the pin and its extras (voice, hurt, photo, kind)
env_rolls Every director roll, hit or miss (director screen, stats)
env_citizens The good citizen record: reports, useful, false reports, tips
env_payouts Pay owed to people who were offline, paid on their next join
env_known Who discovered or inspected which scene
env_timers Timers and cooldowns that survive restarts (template and area cooldowns, follow-up scenes)

Check it works ​

  1. The server console prints one line per sibling (active, fallback (…) or missing export <name>) and ready (framework …, inventory …, … rpc methods).
  2. As staff, open the director with /envdirector and press Spawn a pick, or open the editor with /envadmin, pick a template and press Test spawn here.
  3. Walk up to the scene: the markers and the scene card appear once you can see it. Press E to inspect and G to call it in. A member of a faction on the template's list, on duty, now sees it on /scenes (F6).

Troubleshooting ​

Problem Fix
Blank UI, no markers or card Build the NUI (web/dist missing)
The director never hits Look at the reasons in the director's history. nobody_on_duty: no faction on any eligible template has minOnDuty members on duty (Config.Director.clearableOnly); no_spawn: no free spawn point (somebody within the no-witness radius, another scene too close, the area cooldown)
A faction never sees reports The job is not in Config.Factions[key].jobs, the member is off duty (needsDuty), or the callers picked the other service. Reports only reach factions on the template's list whose service was called
"You need the right tool for this." with the item in the inventory ox_inventory / qb-inventory: the item name must match Config.Items (add the snippets from Items)
Nobody gets paid Standalone has no economy. With Config.Payout.society = true the faction pay goes to the society account, not the workers
Staff commands say no permission Grant np_environmental.admin (or .director / .editor) in np_admin. Without np_admin: add your identifier to Config.Admins, or use a group from Config.AdminGroups
The Scene app is missing on the phone np_phone must run; the app is registered at start and again whenever np_phone restarts. Config.Integrations.np_phone = false switches it off