Integrations ​
np_gangs requires np_npchandler and np_prophandler (below). Every
other np_* resource is optional. Each optional sibling has one file in integrations/ that declares
the exports and events it uses and wraps them behind a function with a built-in fallback. At start (and whenever a
sibling starts or stops) the console prints one line per sibling: active, fallback (…), missing export <name> or
no adapter. Config.Integrations.<name> = false forces the fallback.
A test (tests/test_integrations.lua) reads the sibling repositories next to np_gangs and fails when a declared
export or event no longer exists in their source.
| Sibling | With it | Without it |
|---|---|---|
| np_inventory | The bandana and spray can registered at runtime, guarded back rooms (beforeOpen hook), the members' store, pickup crates, robbing opens the pockets |
ox_inventory / qb-inventory bridge, or none (Compatibility) |
| np_hud | Toasts, prompts and progress bars | np_gangs' own NUI layer draws them |
| np_menu | An entry in the radial, target options on players, server actions for staff | Radial items become extra rows of the street menu; target options go to ox_target / qb-target; /gangadmin |
| np_phone | Lester texts people who are offline (sendSystemMessage, no location in it) |
The text waits in gang_inbox and is shown as a toast at the next login |
| np_character | Character names, the bandana as an appearance component (setAppearance) |
Framework names, native components |
| np_identification | Strangers stay anonymous until they have seen each other's ID (np_gangs keeps its own "has seen their ID" list from the np_identification:shown event) |
Names are always shown |
| np_drugs | Stamp, corners, trade board, labs and permits, grip per sale, outsider rule | Grip is walls and shops; the corner, trade and lab rows don't exist. See np_gangs + np_drugs |
| np_shops | The protected shop's store is an np_shops storefront (or the np_shops shop it is linked to) with the members' price; its robberies hurt the protection | Stores through the inventory (np_inventory / ox_inventory) |
| np_minigames | The trial's skill steps (and, opt-in, spraying and painting over) are server-validated games instead of timed bars. See below | The timed progress bars, unchanged |
| np_admin | The staff system: permission nodes per staff group, the settings page Gangs, the audit log (category np_gangs), staff tools in its menu |
Config.Admins, framework admin groups and np_discord roles; every staff member may use every tool |
| np_discord | Staff by Discord role (Config.AdminDiscordRoles, HasRole, only while np_admin is not running) |
Staff by framework groups and Config.Admins |
| np_prison | Calls np_gangs (no street actions while jailed, members told about bookings and breakouts) | – |
| np_environmental | Calls np_gangs: the first report of a dumping or chemical scene inside a held turf raises its police attention (AddPoliceAttention, reason np_environmental); clue objects can name the holder's bandana colour |
– |
| np_clothing | Not yet: more wear styles (head, wrist, back pocket) wait for its component slots | Face and neck, one component each |
np_npchandler / np_prophandler (required) ​
Both are dependencies in fxmanifest.lua (np_npchandler 1.1.0+) and must start before np_gangs. np_gangs spawns no ped or prop itself:
there is no fallback and no Config.Integrations toggle for them.
| What | Handler |
|---|---|
| Lester | np_npchandler local NPC on each nearby client, with its E option (talk), shown only while he has something for you and you can act; added again on np_npchandler:ready |
| Corner customers | np_npchandler local peds that walk up to the seller and walk off when served or waved away |
| Trial: the driver, the patrol cops, the gunmen | np_npchandler networked mission peds (driver and cops created in their vehicle seat); the patrol car is np_gangs' own vehicle |
| Trial: the carried crate | np_prophandler attachment, synced (Config.Trial.carryProp) |
np_inventory in detail ​
| Need | np_inventory piece |
|---|---|
| Bandana as an item with colour and print | Item metadata, onCreate and beforeUse hooks |
| Back room, guarded | RegisterStash, beforeOpen hook |
| Move the stash, takeover loot | GetInventoryItems, AddItem, RemoveItem, server-side |
| Protection money as dirty cash | black_money item |
| Member's price in a protected shop | RegisterShop and a second, members-only shop at the member's price, guarded by beforeBuy |
| Robbing a player | The player opener; its own victim toast names the robber (Compatibility) |
np_shops in detail ​
The adapter is integrations/np_shops.lua (checked against np_shops' code by tests/test_np_shops.lua).
- The public store of a protected shop is the np_shops shop
npg_store_<shop id>: registered by np_gangs, hidden, no blip, with np_shops' own counter prompt at the shop. A shop staff linked (linkin the editor) to an np_shops shop id uses that shop instead; a link to an id np_shops does not know is an inventory shop. - The members' price is a
priceModifierhook on those shops (Config.Protection.store.memberDiscountoff for players in the colours of the gang the shop pays); abeforeBuyhook keeps the store rules of thenpg_store_shops. The members' key (Y) callsOpenShop. Hooks and stores are registered again after np_shops restarts. np_shops:server:robbed({ shopId, coords, robber, amount }) counts as a robbery of the protected shop whose store or linked shopshopIdis (else the one withinConfig.Protection.robbery.radiusofcoords);robbernames the colours in the alert. np_shops also callsReportShopRobbery; the cooldown makes both one robbery.
np_admin in detail ​
np_gangs vendors np_admin's lib byte-identical in bridge/np_admin.lua. When np_admin runs:
- Permission nodes (category Gangs):
np_gangs.editor,.setup,.names,.audit,.moderate(Installation → Permissions).np_gangs.*grants all of them. - Resource settings → Gangs: the tunables of
Config(Configuration → Editable in np_admin).fxmanifest.luadeclares the settings file and every config file, so np_admin lists them while np_gangs is stopped. - Audit log category
np_gangs: every staff action, next to np_gangs' own staff log in the editor. - Staff tools:
np_gangs.editor.open,np_gangs.audit.open(argumentgang, the list is registered again when gangs come and go),np_gangs.slot.open(argumentslot,0= the first sealed one).
The lib registers everything again whenever np_admin (re)starts.
np_drugs in detail ​
The adapter is integrations/np_drugs.lua. It only runs while np_drugs is started, and np_drugs has no gang code.
| np_drugs offers | np_gangs does with it |
|---|---|
Hook stampSource |
Supplies the gang's stamp: its tag, in its bandana colour, to members with the bandana on |
Hook beforeProduce |
Checks lab slots and permits in the turf, takes the permit share of the yield |
Hook beforeSale |
Sets the turf price, applies the outsider rule, names who gets paid |
Event sold |
Counts grip, raises heat on the corner, alerts on a rival stamp, fills the back room |
Event badBatch |
Lowers the owners' mood in protected shops, shows on the trade board |
Event seized |
Raises police attention on the turf |
Hook describe |
Adds the bandana colour to np_drugs' witness reports about a member in colours |
Exports GetPrice, GetLabs, GetProductionLines, GetSubstances, Dispatch |
Prices on the corner card and the trade board, lab rows, supply lines, units and portions, patrols and raids |
Events produced, labStarted, labStopped, ready |
Lab rows on the trade board (re-read on each), attach again after np_drugs restarts |
The whole picture, from both sides, is on np_gangs + np_drugs.
np_minigames in detail ​
With np_minigames started and Config.Minigames.enabled on (the default), a step that has a game
mapped is played as that game, started and judged on the server (exports.np_minigames:Play). np_gangs keeps its own
checks around it: the token, the role, the spot (checked again when the game is won), going down. A lost game is what
breaking off the bar was: in the trial the step's heat cause, then the step can be tried again; on the street nothing
happens and no can is used. Reasons that are nobody's fault (np_minigames busy, or the game switched off there) cost
nothing.
| Where | Step | Game |
|---|---|---|
| Lester's trial | Junction box (paper) |
wires |
| The convoy's back doors | lockpick |
|
| Camera feed, jammer, tracker | skillcheck |
|
The photo (shadow) |
sway (scope) |
|
| Graffiti | Spraying (uses.spray, off) |
sway, easy, 2 shots |
Painting over (uses.paintOver, off) |
power, easy |
A trial step's game is set on the step in shared/config/trial.lua:
{ id = 'box', type = 'work', ..., minigame = { game = 'wires', difficulty = 'hard', opts = { cuts = 4 } } } -- or 'wires', or false
-- shared/config/minigames.lua
Config.Minigames = {
enabled = true,
difficulty = 'medium', -- when a mapping names none
maxMove = 2.5, -- metres a player may move during a game before it fails ('moved'); 0 = off
timeoutSeconds = 300, -- a game the server never heard back from is forgotten after this
trial = true, -- false: every trial step stays a progress bar
uses = { -- street actions, off by default: a game that can fail changes how easily walls are won
spray = { enabled = false, game = 'sway', difficulty = 'easy', opts = { shots = 2 } },
paintOver = { enabled = false, game = 'power', difficulty = 'easy' },
},
}
The np_admin settings page has the switches, the default difficulty, maxMove and the street games' game and
difficulty (category np_minigames). Without np_minigames every step keeps its progress bar.