Skip to content

Installation ​

Requirements ​

  • oxmysql, the only hard dependency. The tables are created at start and migrated on updates.
  • Node.js 18+ once, to build the web UI, unless you use a release zip (it already contains web/dist; the repository does not).

Optional, detected at start (each with a fallback, see Integrations):

Kind Resources Without it
Framework es_extended (first target), qbx_core, qb-core Standalone: np_faction keeps the job itself (state bag npFactionJob); every linked faction is registered as a job of its own
Inventory np_inventory (first target), ox_inventory, qb-inventory No armory, stashes, evidence, personal lockers or tablet item
Faction money np_banking (first target) np_faction's own ledger (faction_ledger); balances move into np_banking once it runs (Config.Bank.moveLedger)
Staff np_admin Config.Admins (server-only, step 6 below), the framework's admin groups and Config.AdminDiscordRoles decide; every staff member holds every node
Other np_* siblings np_payments, np_phone, np_hud, np_menu, np_clothing, np_character, np_identification, np_discord, np_gangs, np_environmental, np_cctv, np_npchandler, np_prophandler, np_fuel A built-in fallback each: own ledger, tablet, toasts and prompts

Steps ​

  1. Put the folder into your resources as np_faction. Other resources call exports.np_faction and np_phone loads the app from np_faction/web/dist/phone.html, so keep the name.
  2. Build the web UI (skip this with a release zip, which already contains web/dist):
    sh
    cd np_faction/web && npm ci && npm run build
    Without web/dist the resource still starts, but the console prints a warning and no screen opens (no HQ, no tablet, no phone app).
  3. Start order in server.cfg: after oxmysql, the framework, the inventory and the siblings you use, before the resources that read jobs.
    cfg
    ensure oxmysql
    ensure es_extended          # or qbx_core / qb-core
    ensure np_inventory         # or ox_inventory / qb-inventory
    ensure np_banking           # optional: faction accounts
    ensure np_payments          # optional: invoices, terminals
    ensure np_admin             # optional: staff editor, permissions, settings
    ensure np_phone             # optional: the Faction app
    ensure np_faction
    ensure esx_addonaccount     # optional: the shim from np_faction/compat, see below
    ensure esx_society          # optional: the shim from np_faction/compat
    sql/install.sql holds the same statements as the start-up migration, for databases where the resource may not create tables.
  4. Factions. The shipped files in shared/factions/ (police, ambulance, mechanic, gun club) mirror the usual jobs. Every other framework job shows up automatically (Config.Factions.autoMirror). Make it a faction of its own in the staff editor (/factionadmin or np_admin's resource tools) or write a faction file (Configuration).
  5. Paychecks. es_extended, qbx_core and qb-core pay their own paycheck. Switch one of the two systems off: the framework's paycheck in its own config, or Config.Duty.payroll.enabled = false to keep the framework's (Configuration → Duty and pay).
  6. Permissions: grant the staff nodes in np_admin (Staff editor & np_admin). Without np_admin, list staff identifiers in server/config/admins.lua or in server.cfg:
    cfg
    set np_faction_admins "license:0123456789abcdef0123456789abcdef01234567,discord:123456789012345678"
    Both fill Config.Admins on the server only; the shared config files reach every client, so the list no longer lives there (an old Config.Admins in a shared file still counts, but move it).
  7. Start the server, then open /faction as a member of a job and /factionadmin as staff.

Items ​

Item What it does
faction_tablet Opens the Faction app's pages as a tablet when np_phone is not running (Config.Phone.tablet.item, false = no item)

On np_inventory np_faction registers the item at runtime. On ox_inventory and qb-inventory add an item named faction_tablet to the item list yourself.

Old society money and scripts ​

np_faction replaces esx_addonaccount, esx_society and qb-management. Small standalone shims in compat/ answer their calls from the faction accounts (np_banking while it runs, else np_faction's ledger), so older scripts keep working without a single edit. Each shim provides the original name, so dependencies on it stay satisfied.

Shim Answers
esx_addonaccount esx_addonaccount:getSharedAccount / getAccount / getSharedAccounts, the GetSharedAccount / GetAccount exports. society_<job> accounts of a known job are live proxies on the faction's operating account; every other shared or personal account is kept by the shim itself
esx_society esx_society:getSociety / getSocieties / registerSociety, the GetSociety export, the boss menu's withdrawMoney / depositMoney, the ESX callbacks getSocietyMoney, isBoss, getEmployees, getJob, setJob (through np_faction's nodes, hierarchy and members)
qb-management GetAccount / GetMoney, AddMoney, RemoveMoney, GetGangAccount, AddGangMoney, RemoveGangMoney, qb-bossmenu:server:withdrawMoney / depositMoney. Gangs and unknown jobs are kept by the shim itself
  1. Move the old money first. np_admin staff action Faction money: migrate society money, or Config.Bank.migrate = 'auto' (once per faction at start). It reads addon_account_data (society_<job>) and qb management_funds (and its variants) directly, so it works before or after installing a shim. The old balance moves once into the faction's operating account; the old row is zeroed (Config.Bank.migrateZero) and the move is logged.
  2. Remove (or stop) the original resource.
  3. Copy the shim folder into your resources and ensure it after np_faction.

np_banking's own ESX import

np_banking can import the ESX societies itself (Config.Accounts.esxSociety = 'migrate' in np_banking, see np_banking → Installation). Both move the same money, so run only one of them. np_faction skips the ESX source on its own once np_banking has run its import (np_banking's bank_meta flag). If you let np_banking import, also set Config.Bank.bankingMigrates = true in np_faction so its migration skips the ESX source from the very first start. qb management_funds is never touched by np_banking and always comes through np_faction.

Limits: the boss menu's withdraw and deposit events go through BankWithdraw / BankDeposit, with the same checks as np_faction's own Bank screen: the bank.withdraw / bank.deposit node, the grade's daily budget, two signatures above the threshold, the beforeWithdraw hook and a per-player cooldown (Config.Bank.playerCooldownMs). Withdrawals are paid to Config.Bank.withdrawTo; one that needs a second signature waits in the HQ Bank tab. A deposit takes the player's money first. esx_datastore and esx_addoninventory are not shimmed: use np_faction's stashes.

Framework notes ​

Framework What np_faction does
es_extended Writes the active job with setJob, offline changes into users; create factions are written to jobs / job_grades as whitelisted jobs (not offered by esx_joblisting) unless the faction sets settings.publicJob = true. ESX duty (onDuty on newer ESX) is kept in step
qbx_core Every linked membership is one of qbx's job groups (PlayerData.jobs): hire and grade changes call AddPlayerToJob, a fire RemovePlayerFromJob, a switch SetPlayerPrimaryJob (offline too), duty SetJobDuty. Groups qbx_management, /addjob or other scripts change are adopted. create factions are added with CreateJobs. Set the convar qbx:max_jobs_per_player to at least Config.MultiJob.slots (qbx's default is 1); the start log warns when it is lower
qb-core Player.Functions.SetJob / SetJobDuty; offline changes into players. create factions go into qb's shared jobs with QBCore.Functions.UpdateJob when the job exists, else AddJob, so rank changes reach qb as well
Standalone np_faction keeps the job (Player(src).state.npFactionJob), every linked faction is a job

Config.Jobs.reconcile adopts framework job changes made by other scripts (an admin command, esx_society's boss menu) into the roster; Config.Members.externalUnemployedFires decides whether unemployed set by another script ends the membership.

Duty belongs to np_faction (Config.Jobs.dutyAuthority = true, the default). The framework's duty flag at login is not adopted: characters start off duty and np_faction writes its own state to the framework. A duty flag another script flips at runtime (QBCore:ToggleDuty, SetJobDuty, an ESX setJob with onDuty) goes through the same rules as SetDuty (status, the faction's duty feature, the active job, beforeDuty hooks) and is written back when refused. Suspended members and members on leave are never on duty. dutyAuthority = false reads the framework's flag and never writes it (still never for suspended / on-leave members or factions with duty off).