Installation ​
Requirements ​
- A recent FiveM server artifact (Lua 5.4)
- oxmysql
- np_prophandler 1.1.0+: streams the placed machines, shows the placement ghost and the can in the hand during Drink now. It must start before np_vending
- Node 18+ to build the NUI once
Optional, auto-detected at start:
| Kind | Resources | Used for |
|---|---|---|
| Framework | es_extended, qbx_core, qb-core | Identifiers, names, cash and bank, jobs, admin groups, status for Drink now. Without one, np_vending runs standalone: no economy, every price is skipped |
| Inventory | np_inventory, ox_inventory, qb-inventory | Stock items, crates, deeds, keys, the tablet, Drink now, the wholesale shop. Without one there is no carried stock (see Bridges) |
| Staff | np_admin, np_discord | Permission nodes, Resource settings, staff tools, the audit log and the server theme. Without them, a fallback decides who is staff |
| Payments | np_payments | Card payments (quick pay) and phone tap. Without it, both charge the framework bank |
| Phone | np_phone | The Vending app, alerts, texts to offline owners |
| Other np_* siblings | np_hud, np_menu, np_identification, np_character, np_gangs, np_shops, np_drugs | A built-in fallback for each. See Bridges & integrations |
| Zones | np_colshape | Enter and exit of the machine points as colshapes. Needed on FiveM Legacy only, GTAV Enhanced has the natives built in. Without it, distance checks as before |
Steps ​
- Put the folder into your resources as
np_vending. The NUI callshttps://np_vending/rpc, np_phone loadsweb/dist/phone.htmlfrom it and other resources callexports.np_vending, so keep the name. - Build the UI once:shThis creates
cd web && npm ci && npm run buildweb/dist/index.html(machine, service door, placement, dashboard, staff screen) andweb/dist/phone.html(the np_phone app).web/distis not committed, so a fresh clone starts with a blank UI until you build it. - Database: the tables (all prefixed
vend_) are created on start. To create them by hand, runsql/install.sql. - Start order in
server.cfg. The framework and the inventory are detected once, at start, so start them first. np_prophandler is a dependency and starts before np_vending. The order among the optional np_* siblings doesn't matter: they are picked up at start and whenever they start later.cfgensure oxmysql ensure np_prophandler ensure es_extended # or qbx_core / qb-core ensure np_inventory # or ox_inventory / qb-inventory ensure np_hud # optional siblings, any order ensure np_phone ensure np_payments ensure np_identification ensure np_admin # optional; may also start later ensure np_vending - Items: with np_inventory nothing to do, they are registered at start when missing
(
Config.RegisterItems). With ox_inventory or qb-inventory add them to the item list, see Items. - Staff: nothing goes into
server.cfg. See Permissions. - Check
shared/config/: at least the zones, the wholesale depot and, for companies,Config.Business.jobs.
At start the console prints one line per sibling (active, fallback (…), missing export <name> or
no adapter), the np_admin state and a ready line.
Permissions ​
np_vending 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 alone, per staff group or single player, with
wildcards (vending.admin.*) and denies. The nodes show up under the category Vending:
| Node | Grants |
|---|---|
vending.admin |
Open /vendingadmin, Export config.lua |
vending.admin.rules |
Change the spacing rules, limits and fees |
vending.admin.zones |
Create, edit and delete zones |
vending.admin.machines |
Teleport to, reset, remove, repair, restock and sell machines (screen and np_admin staff tools) |
Without np_admin a player is staff when one of these says so:
- their FiveM identifier is in
Config.Admins('license:…','discord:…'); - the framework's admin groups in
Config.AdminGroups(ESXxPlayer.getGroup():admin,superadmin; qb-core / qbx_coreHasPermission:admin,god); - np_discord runs and they hold one of
Config.AdminDiscordRoles(role ids or np_discord role names, cached forConfig.AdminDiscordCacheSeconds).
In the fallback every staff member may use every staff tool. np_admin's own fallback convars (np_admin_fallback,
np_admin_fallback_groups) are not read by np_vending: it replaces that fallback with the list above. See
Concepts → Permissions.
Tables ​
| Table | Holds |
|---|---|
vend_meta |
Schema version, the staff screen's rule overrides and zones |
vend_machines |
One row per machine: code (VM-0142), model, coords, zone, world (map prop), operator, status, cash box, pending card sales, settings, upgrades, rent, traffic, listing, 7-day sales |
vend_slots |
Slots per machine: item, amount, capacity, price, offer, locks, capsule mix |
vend_keys |
Keys per machine (or 0 = all machines of the operator) with restock / collect / price rights |
vend_ledger |
The business log: sales, refills, collections, listings, bids, break-ins (pruned after Config.LedgerKeepDays) |
vend_stamps |
Stamp card count per player and operator |
vend_watch |
Notify me subscriptions for sold-out slots |
vend_jobs |
Paid restock jobs |
vend_timers |
Scheduled work: auctions, rent, jobs |
vend_accounts |
Company and gang balances, and money held for player owners who were offline |
vend_inbox |
Alerts for offline players while np_phone isn't running, shown at the next login |
City machines have no row until somebody first walks up to one; then it is registered as operator city.
Check it works ​
- Walk up to any vending machine on the map. The prompt shows
E Use vending machine;Eopens the slot grid with the city's stock. - Buy something with cash. It lands in your pockets, or in the tray when they are full.
/vending placeopens placement mode with the model picker. Walk somewhere and watch the checklist and rings.- As staff,
/vendingadminopens the spacing rules screen.
Troubleshooting ​
| Problem | Fix |
|---|---|
| Blank screen, nothing visible | Build the NUI (web/dist missing) |
| Prices are skipped, nobody pays | No framework was found at start, so np_vending runs standalone. Start the framework before np_vending |
| Items have no label or can't be used (ox / qb) | Add the items to the inventory's item list |
| No prompt at a map machine | Config.World.enabled is off, the prop is in Config.World.ignore, or the prop model isn't in any Config.Models[*].props |
/vendingadmin says Staff only |
Grant vending.admin in np_admin. Without np_admin: add your identifier to Config.Admins, or use a group from Config.AdminGroups |
| Card payments open no sheet | np_payments isn't running or Config.Integrations.np_payments = false: card and phone charge the framework bank directly |
A sibling line says missing export <name> |
That sibling's version lacks an export np_vending uses; the fallback runs. Update the sibling |