Bridges ​
np_shops never calls a framework, inventory, dispatch or fuel resource directly. Each kind has a bridge with a fixed
contract and one file per supported resource. Every file starts with
NpShops.Bridge.shouldLoad('<kind>', '<name>', '<resource>') and returns early unless its resource is started and
selected. The 9_* files are the fallbacks. Bridges are picked once, at start. See
Common concepts → Bridges.
| Kind | Config | Auto order | Files |
|---|---|---|---|
| Framework | Config.Framework |
es_extended → qbx_core → qb-core → standalone | bridge/framework/{client,server}/ 1_esx 2_qbx 3_qb 9_standalone |
| Inventory | Config.Inventory |
np_inventory → ox_inventory → qb-inventory → ESX → none | integrations/server/np_inventory.lua, bridge/inventory/server/ 1_ox 2_qb 3_esx 9_none |
| Dispatch | Config.Dispatch |
np_mdt → np_drugs → ps → cd → qs → builtin | integrations/server/np_mdt.lua, np_drugs.lua, bridge/dispatch/server/ 1_ps 2_cd 3_qs 9_builtin |
| Fuel | Config.Fuel.bridge |
np_fuel → ox_fuel → LegacyFuel → cdn-fuel → state bag → none | integrations/client/np_fuel.lua, bridge/fuel/client/ 1_ox 2_legacy 3_cdn 8_statebag 9_none |
Framework ​
Server contract (NpShops.Framework): getIdentifier(src), getName(src),
getJob(src) -> { name, label, grade, gradeLabel, onduty },
getMoney / addMoney / removeMoney(src, account, amount, reason) with 'cash' | 'bank' | 'black_money',
getSociety / addSociety / removeSociety(job, amount), getSourceByIdentifier(id), isAdmin(src),
isDowned(src), hasLicense(src, type), getDob(src), onPlayerLoaded(cb), onPlayerUnloaded(cb),
loadedPlayers(). Client: isLoaded(), isDead(), isCuffed(), getJob(), onLoaded(cb), onUnloaded(cb).
| Framework | Notes |
|---|---|
| es_extended | The first target. black_money is an account. Society accounts through esx_addonaccount (society_<job>). Licenses from user_licenses. Admins by getGroup() |
| qbx_core / qb-core | Society accounts through qb management. Licenses from the metadata licences. Admins by HasPermission |
| Standalone | The identifier is the FiveM license (or the np_character id). Cash is the inventory item Config.Money.cashItem, black money the item blackItem. Jobs come from Config.StandaloneJobs. No society accounts |
Without np_identification, licenses use the framework names in Config.Licenses (weapon_license → weapon,
driver_license → drive, business_license → business, hunting_license → hunting), and the age check uses
the framework date of birth.
Inventory ​
Server contract (NpShops.Inventory): flags metadata, stashes, hasWeight; count, canCarry, maxCarry,
addItem, removeItem, itemDef(name) -> { label, weight, icon?, tint?, image?, weapon? }, weight(src),
registerStash, openStash, stashItems, stashRemove, stashAdd, hasItemDef.
| Inventory | Stashes | Notes |
|---|---|---|
| np_inventory | yes | The first target. Item images, weapon metadata, extra tooltip rows (serial, engraving), CanCarryAmount for the "fits in your pockets" count |
| ox_inventory | yes | Item images through Config.ImagePath |
| qb-inventory | no | No pickup stash, owners restock through wholesale only |
| ESX inventory | no | Same as qb-inventory |
| none | no | Standalone without an inventory resource |
The client also sets the ox-style busy flag (LocalPlayer.state.invBusy) during timed actions, so the inventory can't
open over a robbery or a nozzle.
Dispatch ​
NpShops.Dispatch.report(alert) tries the providers in order until one answers:
| Order | Provider | What it does |
|---|---|---|
| 10 | np_mdt | A call in the MDT (ReportCall, resolved with ResolveCall). See below |
| 20 | np_drugs | np_drugs' witness reports, through its own dispatch adapters |
| 30 / 40 / 50 | ps-dispatch, cd_dispatch, qs-dispatch | Their alert exports |
| 99 | builtin | An np_hud toast and a blip (Config.Robbery.alertBlipSeconds) for police on duty (Config.Jobs.police) |
alert = { shopId, kind = 'robbery', code = '10-90', title, message, coords, street?, source?, priority?, caller? }.
priority is 1 (most urgent) to 3 (Config.Robbery.dispatch.priority), caller the shop's label.
np_mdt's ReportCall validates strictly and refuses anything else, so the adapter (NpShops.Dispatch.mdtCall) sends:
kind alarm for a robbery, a numeric priority (the words high / medium / low map to 1 / 2 / 3),
caller = { name } with the shop's label, an externalId of [A-Za-z0-9._:-] (at most 80 characters), a title of at
most 120 and a message of at most 500 characters. A refused call is logged and the next provider is tried.
Fuel ​
Client: NpShops.Fuel.get(vehicle) -> 0..100, set(vehicle, level), statebag (true for ox_fuel and the state bag
bridge). Server: NpShops.Fuel.statebag(), get(netId), set(netId, level, payer, delta).
The server mirrors the client's bridge choice to know whether Entity(vehicle).state.fuel holds the real level:
Config.Fuel.bridge is ox_fuel or statebag, or auto with ox_fuel running and none of np_fuel, LegacyFuel or
cdn-fuel.
- State bag is the level (ox_fuel,
statebag): the server reads the level from the state bag and writes the new one (Config.Fuel.serverStateBag = true, the default). The payer's client setslevelthrough its bridge. - Otherwise (np_fuel, LegacyFuel, cdn-fuel, natives): the state bag is stale, so the server neither reads nor
writes it (
getreturnsnil). The client's level only sizes the quote. After the payment the server sendsnp_shops:fuel:apply (netId, level, delta)to the payer, whose bridge addsdelta(the percent points paid for) to the level it reads now. A level reported at quote time never decides how full the tank gets. - np_fuel's client exports
GetFuel(vehicle)/SetFuel(vehicle, percent)are the bridgenp_fuel. np_fuel'sSetFuelonly lowers a level unless itsConfig.Vehicles.compatCanAddallows more, and np_shops' pump shops step aside while np_fuel runs anyway (Config.Fuel.yieldToNpFuel): np_fuel serves the pumps then.
np_* adapters ​
Every np_* sibling has one adapter file under integrations/. Each declares the exports it needs, the optional ones
and its fallback, and is checked again when the sibling starts or stops. The test suite reads the sibling repos and
fails when a declared export is gone. np_npchandler and np_prophandler are hard dependencies without an adapter: the
clerks module and the prop helper call their exports directly, and the tests check those exports too.
| Sibling | Required exports | Optional |
|---|---|---|
| np_inventory (server) | AddItem, RemoveItem, CanCarryItem, GetItemCount, Items |
CanCarryAmount, GetPlayerWeight, GetPlayerMaxWeight, RegisterStash, OpenInventory, … |
| np_inventory (client) | isOpen, closeInventory, setBusy |
displayMetadata |
| np_payments | Request, Charge, GetMethods, Refund |
Invoice, CanAfford, GetPayment, IsBusy |
| np_identification | hasValidDocument |
registerWeapon, getDocuments |
| np_hud | Notify, NotifyAll |
Announce |
| np_menu (client) | addContextOption, removeContextOption |
isOpen |
| np_phone | registerStoreApp, registerAppRpc, sendAppMessage, notify |
hasPhone, unregisterStoreApp, setBadge, logTransaction, sendMail, setIsland, clearIsland |
| np_discord | HasAnyRole |
Log |
| np_character | getActiveCharacter |
getCharacter, openStore |
| np_tattoos | openParlour |
— |
| np_gangs | ReportShopRobbery |
— |
| np_mdt | ReportCall |
ResolveCall |
| np_drugs | Dispatch |
— |
| np_fuel (server) | GetLinkedStation, GetLinkBalance, MoveLinkBalance, SetLinkStaff, OpenStationScreen |
GetFuelBills, PayFuelBill (fuel bills) |
| np_fuel (client) | GetFuel, SetFuel |
— |
np_admin is not an adapter: its lib is vendored byte-identical as bridge/np_admin.lua, and every np_* resource uses
the same copy.