Skip to content

Integrations ​

Every np_* resource np_environmental talks to is optional, except the two handlers (see np_prophandler and np_npchandler). Each optional one has one adapter in integrations/<name>.lua (loaded on both sides) that declares what it uses and wraps it behind a facade with a built-in fallback, so nothing breaks when the sibling is missing, stopped or switched off.

  • At start the server prints one line per sibling: active, fallback (<what runs instead>) or missing export <name> (the sibling runs but an export the adapter declares is gone). A sibling that starts or stops later prints its new status.
  • Config.Integrations.<name> = false (shared/config/00_core.lua) forces the fallback even while the sibling runs.
  • The tuning of each adapter lives in shared/config/integrations.lua (Config.Phone, Config.ItemDetails, Config.Menu, Config.Gangs, Config.Drugs, Config.Banking). See Configuration → Adapters.
  • A test (tests/test_integrations.lua) fails when an export or event an adapter declares no longer exists in the sibling's source; two more suites run every facade with the sibling present and absent.
Sibling Used for Without it
np_inventory Tool items (chainsaw, cones, flares, …) registered at runtime, usable cones / flares ox_inventory / qb-inventory item lists, or no items
np_phone The Scene app, alerts, live island, receipts, 911 / 311 voice reports Toasts and the own report screen
np_hud Toasts, prompts, progress bars The own NUI layer, same look
np_menu Context options on scene objects, radial Report a scene Interaction prompts
np_character Character names in reports and crews Framework names
np_discord Staff by Discord role, staff log channel Config.Admins and framework groups
np_admin Staff permissions, settings, log, staff tools Config.Admins, framework groups, np_discord roles
np_gangs Police attention for dumping in a held turf, bandana clues Nothing happens
np_drugs Chemical scenes near labs, police dispatch fallback No lab bias, no dispatch
np_banking Society payouts The framework's society account
np_minigames Hands-on clean-up tasks as server-checked skill games through profiles + receipts (Clean-up → Skill games) Progress bars

np_payments has no export that pays a society or a player, so it is not used. np_identification is not needed (names come from np_character). np_screens, np_manufacturing, np_tattoos and np_helicam have no adapter.

np_inventory ​

Uses (server): RegisterItem, GetSlot, AddItem, RemoveItem, GetInventoryItems, GetItemCount, CanCarryItem, Items; event np_inventory:server:ready.

At start, and whenever np_inventory (re)starts, every entry of Config.Items is registered with RegisterItem (label, description, weight, Font Awesome icon, tint, category; the chainsaw with durability, so np_inventory keeps metadata.durability per saw). traffic_cone and road_flare are usable: their definition carries server = { export = 'np_environmental.<item>' }, and using one near a scene does one step of a place task there (and removes what the task consumes). Far from a scene the player gets "There is nothing here to report."

Without it: the inventory bridge picks ox_inventory or qb-inventory. They cannot register items at runtime, so add the items to their item lists. With no inventory, tasks that need an item answer needs_item and place tasks are done with the prompt. See Items.

np_phone ​

Uses (server): registerStoreApp, registerAppRpc, sendAppMessage, notify, setBadge, setIsland, clearIsland, sendMail, logTransaction, addPhoto, getPlayer, openApp, getConfig; (client): isCameraActive, openApp, getOpenApp; events np_phone:emergency:location, np_phone:islandAction.

  • The Scene app. Registered at start and again whenever np_phone restarts (its catalogue lives in memory): registerStoreApp({ id = 'scene', name = 'Scene', ui = 'web/dist/phone/index.html', icon = 'fa-solid fa-triangle-exclamation', tint = 'orange', default = true }). np_phone resolves ui to https://cfx-nui-np_environmental/web/dist/phone/index.html. Its app RPCs call the same server handlers as the NUI: mine → scene.mine, nearby → scene.nearby, closures → scene.closures, report → scene.report, board → board.get, accept → board.accept, handover → board.handover, citizen → citizen.get. Everything np_phone checks (phone item, passcode, rate limit) comes on top of np_environmental's own checks.
  • Reports. The report flow opens the app on its report form; photos are picked in the app with the SDK.
  • Faction alerts. A banner plus a Live Activity (Dynamic Island) with Accept (accepts on the board) and Map (waypoint to the pin). It clears itself after Config.Phone.alertIslandSeconds.
  • Live clean-up island. Reporters and the crew of a scene see "2 of 5 tasks done" while it is being cleared; it goes away when the scene is cleared, expires or is removed.
  • Payout receipts. Every participant paid on a clear gets a wallet line (logTransaction) and a mail in the Transactions folder (Config.Phone.receipts).
  • Pushes. Open apps get a message when a scene they know changes or a report reaches their service; the app refetches.
  • Voice reports. When a caller on an np_phone emergency line taps Send location, a vague voice report is added to a live scene the caller knows nearby (Config.Phone.voiceReports). See Voice reports and the 311 line.

Without it: alerts and receipts become toasts, the report flow opens the own report screen, no island, no voice reports. 911 reports also go out through np_drugs' dispatch when it runs (below).

np_hud ​

Uses: Notify (server and client), ShowPrompt, HidePrompt, Progress, CancelProgress (client). Without it: np_environmental's own NUI layer draws toasts, prompts and progress bars in the same look.

np_menu ​

Uses (client): addContextOption, removeContextOption, addRadial, removeRadial, inputDialog.

On the objects of a scene you know: Inspect and Report, and Work on it on the object of a task you can do right now (it starts the task, same checks as the prompt). A radial entry Report a scene (context global) opens the report flow. Options come back when np_menu restarts. Switch them off with Config.Menu.context = false / Config.Menu.radial = false.

Without it: interaction prompts at the scene (np_hud or the own ones) do the same.

np_character ​

Uses: getActiveCharacter, getCharacter. Reports, crews and boards show character names. Without it: the framework's character name, then the FiveM name.

np_discord ​

Uses: HasAnyRole, Log. Members holding one of Config.AdminDiscordRoles count as staff while np_admin is not running; rolls, spawns and clears can go to a staff log channel (Config.Director.logChannel). Without it: staff come from Config.Admins and the framework's admin groups only.

np_admin ​

Uses: can, isStaff, registerPermissions, registerSettings, registerAction, log, notifyStaff through the vendored lib (bridge/np_admin.lua, Lua global npAdmin). np_admin decides the staff nodes np_environmental.admin / director / editor / cleanup, staff edit the director, radii, payout and citizen settings live, staff actions are logged, and the staff tools (roll now, pause, clear all, editor, director) show in np_admin. The UI follows np_admin's server theme (npAdmin.onTheme). Without it: staff = Config.Admins identifiers, framework admin groups, np_discord staff roles. No ACE. See Staff.

np_gangs ​

Uses (server): GetTurfAt, AddPoliceAttention.

The first report that counts on a scene inside a turf a gang holds raises that turf's police attention by Config.Gangs.attention (reason np_environmental). It counts when the template's kind is in Config.Gangs.kinds (default hazard: illegal dumping, chemical drums) or the report kind is in Config.Gangs.reportKinds. Clue objects can get a line such as "A green bandana lies in the dirt nearby." in the holder's colour (Config.Gangs.clue).

lua
Config.Gangs = { attention = 2, kinds = { 'hazard' }, reportKinds = { 'hazard' }, clue = true }

Without it: no turfs, nothing happens. See np_gangs → Turfs.

np_drugs ​

Uses (server): GetLabs, Dispatch.

  • Spawn points near a placed lab (Config.Drugs.labRadius) count Config.Drugs.labBias times when the director picks a spot for a template of Config.Drugs.kinds (or a template with meta.nearLabs = true). Labs are read once a minute.
  • A 911 report while np_phone is not running goes to the police through np_drugs' dispatch (its built-in toast and blip, or ps-dispatch / cd_dispatch / qs-dispatch / core_dispatch, whatever np_drugs is set to): Dispatch({ kind = 'environmental', code = Config.Drugs.dispatchCode, coords = <pin>, title = <scene label>, note = <report text>, describe = false }).
lua
Config.Drugs = { kinds = { 'hazard' }, labRadius = 400.0, labBias = 3, dispatchFallback = true, dispatchCode = '10-15' }

Without it: every spawn point weighs the same; 911 reports reach on-duty members of the routed factions through np_environmental's own alert only.

np_prophandler and np_npchandler ​

Both are required at 1.1.0+ (dependencies in the fxmanifest, start them before np_environmental). They have no adapter in integrations/, no fallback and no Config.Integrations switch.

Uses np_prophandler (server): registerProps, removeProps, event np_prophandler:ready; (client): getPropEntity, createLocal, getLocalEntity, deleteLocal, attach, getAttachedEntity, detach; events np_prophandler:spawned, np_prophandler:despawned. np_npchandler (server): registerNpcs, removeNpc, event np_npchandler:ready; (client): getNpcEntity, createLocalPed, getPedEntity, deleteLocalPed; events np_npchandler:spawned, np_npchandler:despawned.

  • The static objects of every live scene (of the stages reached and not removed yet) are registered as np_environmental:<scene>:<object>: object kinds prop, hazard and block with a model as np_prophandler streamed props, kind ped as np_npchandler local NPCs (animals, a_c_* models or animal = true, with ped type 28 and wander = { radius }; people with their scenario, otherwise standing). They follow stage changes and removed objects, disappear with the scene and are registered again when a handler restarts and fires np_prophandler:ready or np_npchandler:ready.
  • The editor's preview copies are np_prophandler local props and np_npchandler immediate peds; vehicle ghosts stay with np_environmental.
  • The tool in the hand while working (chainsaw, shovel, the carried box) is an np_prophandler attachment with synced = true, so the other players see it. A dropped box lies there as a local prop for a moment.
  • Fires, particles, sounds, the road block itself and vehicle wrecks stay with np_environmental's client.

np_banking ​

Uses (server): GetSocietyAccount, Credit.

With Config.Payout.society = true, a faction's pay goes to np_banking's society account of the job (GetSocietyAccount(job), created on first use, then Credit(account, amount, { reason })).

lua
Config.Payout.society = true
Config.Banking = { society = true }   -- false: always the framework's society account

Without it (or when the account cannot be credited): the framework's society account: ESX esx_addonaccount society_<job>; qb / qbx qb-banking, Renewed-Banking or qb-management; standalone has none.

What other resources get ​

  • Exports: scenes, templates, reports, the citizen record, SpawnScene, ClearScene, RegisterTemplate, RegisterFaction.
  • Events and hooks: every roll, spawn, discovery, report, stage change, task, clear and removal, and vetoes on spawn, task, clear and payout.