Skip to content

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 ​

  1. Put the folder into your resources as np_vending. The NUI calls https://np_vending/rpc, np_phone loads web/dist/phone.html from it and other resources call exports.np_vending, so keep the name.
  2. Build the UI once:
    sh
    cd web && npm ci && npm run build
    This creates web/dist/index.html (machine, service door, placement, dashboard, staff screen) and web/dist/phone.html (the np_phone app). web/dist is not committed, so a fresh clone starts with a blank UI until you build it.
  3. Database: the tables (all prefixed vend_) are created on 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. 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.
    cfg
    ensure 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
  5. 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.
  6. Staff: nothing goes into server.cfg. See Permissions.
  7. 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:

  1. their FiveM identifier is in Config.Admins ('license:…', 'discord:…');
  2. the framework's admin groups in Config.AdminGroups (ESX xPlayer.getGroup(): admin, superadmin; qb-core / qbx_core HasPermission: admin, god);
  3. np_discord runs and they hold one of Config.AdminDiscordRoles (role ids or np_discord role names, cached for Config.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 ​

  1. Walk up to any vending machine on the map. The prompt shows E Use vending machine; E opens the slot grid with the city's stock.
  2. Buy something with cash. It lands in your pockets, or in the tray when they are full.
  3. /vending place opens placement mode with the model picker. Walk somewhere and watch the checklist and rings.
  4. As staff, /vendingadmin opens 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