Skip to content

Items ​

np_vending uses two kinds of items: its own tool items (crate, deed, key, tablet, repair kit, skimmer, crowbar) and the stock items its machines sell (Config.Items). Item names are configurable in Config.ItemNames; false switches the feature off.

np_inventory ​

Nothing to do. With Config.RegisterItems = true (the default) np_vending registers every missing item at start with exports.np_inventory:RegisterItem: the tool items from Config.ToolItems (crate, deed and tablet with server.export, so the inventory's use calls np_vending), and every stock item in the category vending with its effect as np_inventory's consume. Items that already exist are left alone, so your own definitions win.

What np_vending registers looks like this:

lua
exports.np_inventory:RegisterItem('ecola', { label = 'eCola', weight = 350, stack = true, close = true,
  icon = 'bottle-droplet', tint = 'red', category = 'vending', consume = { thirst = 25 } })
exports.np_inventory:RegisterItem('vending_tablet', { label = 'Vending tablet', weight = 400, stack = false, close = true,
  icon = 'tablet-screen-button', tint = 'green', description = 'Your machines, routes and sales.',
  server = { export = 'np_vending.vending_tablet' } })

Drink now uses the item through np_inventory's own use flow (UseSlot), so its consume applies thirst and hunger through the framework. See np_inventory → Items.

Tool items ​

Item Label Weight Stack Use Metadata
vending_crate Vending machine crate 25 kg no Starts placement mode for its model { model }
vending_deed Vending machine deed 10 g no Registers the machine to the user's name (see Deeds) { machine, code, serial }
vending_key Vending machine key 20 g no Not used directly. With Config.Keys.requireItem a key only works while its holder carries it (Keys) { machine (0 = all), operator, code }
vending_tablet Vending tablet 400 g no Opens the operator dashboard –
vending_repairkit Vending repair kit 1.5 kg yes Fixes a vandalised machine instead of paying for the repair –
vending_skimmer Card skimmer 100 g yes Optional card skimmer (Crime) –
crowbar Crowbar 2 kg no Prying and smashing machines. WEAPON_CROWBAR in hand counts too –

Crates, deeds and keys need an inventory with metadata (np_inventory, ox_inventory, qb-inventory). The crowbar item usually exists already on your server; np_vending only registers it in np_inventory when it is missing.

Stock items ​

Item Label Default price Limits Effect Animation
sprunk Sprunk Classic $4 2–12 thirst +25 can
sprunk_light Sprunk Light $4 2–12 thirst +20 can
ecola eCola $4 2–12 thirst +25 can
ecola_light eCola Light $4 2–12 thirst +20 can
orang_o_tang Orang-O-Tang $5 2–12 thirst +25 can
raine_water Raine Water $3 1–10 thirst +35 bottle
water Water $2 1–10 thirst +30 bottle
junk_energy Junk Energy $7 3–20 thirst +15, stress −5 can
meteorite Meteorite Bar $3 1–10 hunger +15 bar
egochaser EgoChaser $4 1–10 hunger +25 bar
phat_chips Phat Chips $3 1–10 hunger +20 bar
ps_qs P's & Q's $3 1–10 hunger +10 bar
captains_log Captain's Log $4 1–10 hunger +20 bar
coffee Bean Machine Coffee $5 2–14 thirst +15, stress −10 coffee
cold_brew Bean Machine Cold Brew $6 2–14 thirst +20, stress −10 coffee
hot_chocolate Hot Chocolate $5 2–14 thirst +15, hunger +5 coffee
redwood Redwood Cigarettes $12 6–30 18+ –
debonaire Debonaire Cigarettes $14 6–30 18+ –
lighter Lighter $3 1–10 – –
gumball Gumball $1 1–5 hunger +1 bar
capsule_toy Capsule Toy $2 1–20 – –

Limits are the floor and ceiling an owner can't leave when setting prices. Another resource can change what Drink now does with an item through RegisterItemEffect.

ox_inventory ​

Add to data/items.lua:

lua
['vending_crate']     = { label = 'Vending machine crate', weight = 25000, stack = false, close = true, server = { export = 'np_vending.vending_crate' } },
['vending_deed']      = { label = 'Vending machine deed', weight = 10, stack = false, close = true, server = { export = 'np_vending.vending_deed' } },
['vending_key']       = { label = 'Vending machine key', weight = 20, stack = false, close = true },
['vending_tablet']    = { label = 'Vending tablet', weight = 400, stack = false, close = true, server = { export = 'np_vending.vending_tablet' } },
['vending_repairkit'] = { label = 'Vending repair kit', weight = 1500, stack = true, close = true },
['vending_skimmer']   = { label = 'Card skimmer', weight = 100, stack = true, close = true },
['ecola']             = { label = 'eCola', weight = 350, client = { status = { thirst = 250000 } } },
-- ... every name of the stock item table above (`water` and `crowbar` usually exist already)

qb-inventory ​

Add the same names to qb-core/shared/items.lua, with useable = true for vending_crate, vending_deed and vending_tablet. np_vending registers those three with CreateUseableItem.

No inventory ​

With Config.Inventory = 'none' nobody carries stock: purchases with an effect are used right away, everything else waits in the tray and is lost. Machines can only be restocked by the city or by staff.