Skip to content

Installation ​

Requirements ​

  • A recent FiveM server artifact (Lua 5.4)
  • oxmysql
  • np_npchandler 1.1.0+ and np_prophandler, started before np_gangs. np_npchandler spawns Lester, the corner customers and the trial's drivers, cops and gunmen; np_prophandler the crate carried in the trial
  • Node 18+ to build the NUI once

Optional, auto-detected at start (each with a fallback, see Compatibility and Integrations):

Kind Resources Without it
Framework es_extended (first target), qbx_core, qb-core Standalone: no economy, every price is skipped
Inventory np_inventory (first target), ox_inventory, qb-inventory The bandana is virtual and there is no back room
Staff np_admin, np_discord Framework admin groups and Config.Admins (see Permissions)
Stores np_shops The protected shops' stores are inventory shops
Drugs np_drugs No corners, no trade board, no lab rows. See np_gangs + np_drugs
Other np_* siblings np_hud, np_menu, np_phone, np_character, np_identification A built-in fallback for each
Zones np_colshape Distance checks instead of colshapes for turf presence on the client and the server, and the interaction points. Needed on FiveM Legacy only, GTAV Enhanced has the natives built in

Steps ​

  1. Put the folder into your resources as np_gangs. The NUI calls https://np_gangs/rpc and other resources call exports.np_gangs, so keep the name.
  2. Build the UI once:
    sh
    cd web && npm install && npm run build
    The build lands in web/dist, which the manifest ships as the ui_page. web/dist is not committed, so a fresh clone starts with a blank UI until you build it.
  3. Database: the tables (all prefixed gang_) are created on the first start. To create them by hand, run sql/install.sql.
  4. Start order in server.cfg. The framework and the inventory are detected once, at start, so start them first:
    cfg
    ensure oxmysql
    ensure es_extended        # or qbx_core / qb-core
    ensure np_prophandler     # required, before np_gangs
    ensure np_npchandler      # required, before np_gangs
    ensure np_inventory       # or ox_inventory / qb-inventory
    ensure np_hud             # optional siblings before np_gangs
    ensure np_menu
    ensure np_phone
    ensure np_character
    ensure np_identification
    ensure np_discord
    ensure np_shops
    ensure np_admin           # optional; may also start later
    ensure np_drugs           # may also start later: np_gangs attaches and detaches by itself
    ensure np_gangs
  5. Staff: nothing goes into server.cfg. See Permissions.
  6. ox_inventory / qb-inventory: add the items to their item lists (Items). np_inventory gets them at runtime.
  7. With np_inventory: read Robbing and np_inventory's toast and decide how robbing should work on your server.
  8. Open the first gang slots (all slots start sealed) and walk through Before you open it.

Permissions ​

np_gangs never uses ACE. Every staff check is one call, npAdmin.can(src, node), of the np_admin lib that ships in bridge/np_admin.lua (np_admin stays optional: no dependency, no @np_admin include).

With np_admin its permission matrix decides, per staff group or single player, with wildcards (np_gangs.*) and denies. The nodes show up under the category Gangs:

Node Grants
np_gangs.editor The map: territories, shops, back doors, walls, corners, teleport; layout export / import / example seed; np_drugs demand and lookout spots
np_gangs.setup Gang slots (open, schedule, seal, how many) and bandana variants and prices
np_gangs.names The gang name queue (and the toast when a name waits)
np_gangs.audit Read every gang: members, turfs, stash, ledger
np_gangs.moderate Dissolve a gang, switch its stash, kick, grant / revoke turfs, set grip, end a contest, take a bandana

Any of them opens /gangadmin; each tab's actions need their node (Staff editor). While np_admin runs, the lists below count no more.

Without np_admin a player is staff (every node) when one of these says so:

Source Config Default
Framework group Config.AdminGroups.esx against xPlayer.getGroup(); Config.AdminGroups.qb against HasPermission on qb-core / qbx_core ESX admin, superadmin; qb / qbx admin, god
Identifier list Config.Admins: 'license:…', 'discord:…', 'fivem:…' empty
Discord role Config.AdminDiscordRoles (role ids or np_discord role names), only while np_discord runs. Answers are cached for Config.AdminDiscordCacheSeconds (60) empty
lua
-- shared/config/00_core.lua
Config.Admins = {
  'license:0123456789abcdef0123456789abcdef01234567',
  'discord:123456789012345678',
}
Config.AdminDiscordRoles = { '123456789012345678', 'staff' }

np_admin also gets the settings page Gangs (Configuration → Editable in np_admin), every staff action in its audit log (category np_gangs) and three staff tools for its quick menu, panel and Ctrl K palette: Open the gang editor, Open a gang's audit and Open a gang slot.

The example layout ​

On an empty installation the example layout is inserted: five South Los Santos turfs (Davis, Grove Street, Chamberlain Hills, Strawberry, Rancho), each with shops, spray walls and corners, and one no-gang area (Mission Row). They are rough rectangles at approximate street positions, meant to be replaced in the editor.

  • Set Config.Turf.seedExample = false before the first start to skip them.
  • sql/seed.sql has the same data, and the editor's Setup tab loads it again (Example seed).

All gang slots start sealed. Open them in the editor (/gangadmin → Map or Setup → Slots).

Playtime and clothing ​

Playtime. Config.Lester.eligibility.minPlaytimeHours (default 10) is counted by np_gangs from the day it is installed, so on an old server everybody starts at 0 hours. If your server tracks playtime already, return it:

lua
Config.Lester.eligibility.playtime = function(src, identifier)
  return exports.my_playtime:GetHours(identifier)   -- hours as a number; nil falls back to np_gangs' own count
end

Clothing. The bandana's wear styles set one clothing component each. The drawable numbers in Config.Bandana.styles and the texture per colour in Config.Bandana.colors are placeholders for the stock peds: point them at the bandana pieces of your clothing pack.

Check it works ​

  1. The console prints np_gangs ready, the framework and inventory bridges and one line per sibling: active, fallback (…) or missing export <name>. A sibling that starts or stops later is attached or detached by itself.
  2. As staff, run /gangadmin: the editor opens on the Map tab with the example turfs.
  3. Open a slot in Setup → Slots, then find Lester (Config.Lester.locations) with two more eligible players.

Before you open it ​

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

  1. Trial coordinates (shared/config/trial.lua): walk every job and move spots that end up in a wall, on a roof or behind a fence; check that the NPC routes (convoy truck, tailing car) drive and that the hold spot's waves spawn on the ground.
  2. Lester's locations (13_lester.lua): the ped stands on the floor, the "room" radius covers the room.
  3. Bandana clothing: the drawables per gender in Config.Bandana.styles and the texture per colour in Config.Bandana.colors match your clothing pack; putting it on and off restores the previous piece.
  4. Natives that differ per build: the trial's vehicle spawn (CreateVehicleServerSetter), NPC driving tasks, GetSelectedPedWeapon for robbing, hands-up animations (Config.Rob.handsUpAnims) and the downed state bags your death script sets (Config.Rob.downedStates, Config.Trial.downStates).
  5. The example layout: replace the rough rectangles with your own turfs, shop counters and back doors; check that the dumpster props of Config.Corner.drop.props exist where your corners are.
  6. Your shop robbery script: list its event in Config.Protection.robbery.events or call ReportShopRobbery. np_shops is covered already.
  7. Item icons: gang_bandana, spray_can and lester_note need a picture in your inventory's icon folder.
  8. Staff: with np_admin, grant a test group np_gangs.*; without it, one test account in Config.Admins. Open /gangadmin, open a slot.

Known limitations ​

  • Wear styles beyond face and neck wait for np_clothing's component slots.
  • A running corner shift and a running trial job are not kept across a restart (a crew in the middle of the trial may run another job). Contests, cooldowns, protection, saturation, heat and the drops are.
  • Members' prices need np_shops, np_inventory or ox_inventory. The pickup crate when dissolving needs np_inventory or ox_inventory (otherwise the stash goes into the OG's pockets).

Troubleshooting ​

Symptom Fix
Blank UI, nothing opens web/dist is missing. Build the UI
Lester never talks about gangs He needs three eligible people in the room (Config.Lester.minPresent). Check playtime, other gangs and blocked jobs per person on his board
The board shows no open slot All slots start sealed. Open one in /gangadmin → Setup → Slots
/gangadmin does nothing The player has no np_gangs.* node in np_admin, or (without np_admin) isn't in Config.AdminGroups, Config.Admins or the Discord roles
A sibling shows missing export <name> That resource is older than the export np_gangs calls; the fallback runs until it is updated
The victim of a robbery sees the robber's name np_inventory's own toast, see Configuration → Robbing
ox / qb: the bandana can't be used Add gang_bandana to the inventory's item list with the use export (Items)