Commands#
Vending Machine Creator registers a single in-game command. There are no console commands: to see what the script is doing, turn on Config.Debug and read the F8 and server consoles.
Command | Where | Description |
|---|---|---|
| In game | Opens the creator: place, edit, teleport to and delete machines. Framework admins and the jobs in |
Keys#
Key | Where | Does |
|---|---|---|
| Within 2 m of a machine | Uses it, buys it when it is for sale, or manages it when it is yours. |
| Within 2 m of a robbable machine, with the lockpick | Forces it open. Set by |
| Placement mode | Places the machine. |
| Placement mode | Turns it 15° per notch, or slowly while held. |
| Placement mode | Cancels and returns to the creator. |
Exports#
Vending Machine Creator registers no exports. Other resources drive it through the event and the server callbacks below — the same ones its own interface and the VendGo app use — and every check behind them still runs on the server.
Events#
Start a robbery from your own lockpick
When another resource already makes the lockpick usable — vehicle lockpicking scripts usually do — leave Config.Robbery.useItem off and send this event from that resource's handler. The player forces the closest robbable machine within 3 m.
-- server side, inside your lockpick's usable-item handler
TriggerClientEvent('vendingmachine:robbery:useItem', source)The lockpick, the distance, the cooldown and the owner are all checked again on the server. With no machine close enough, the player is told they are too far — so send it only when your script found nothing of its own to pick.
Server Callbacks#
ox_lib callbacks the VendGo app is built on. Call them from the client to make your own phone app, tablet or laptop shop. They follow Config.Phone: with enabled = false each answers phone_disabled, and with allowRemotePurchase = false the two purchase callbacks answer remote_disabled.
vending:phone:getSnapshot
Everything the app shows: the player's balances, every placed machine sorted by distance from the coordinates you send, and every machine type.
local c = GetEntityCoords(cache.ped)
local data = lib.callback.await('vending:phone:getSnapshot', false, {
coords = { x = c.x, y = c.y, z = c.z },
})
-- data.ok, data.cashBalance, data.bankBalance
-- data.customMachines[i] = { id, label, coords, distance, account, items }
-- data.machineTypes[i] = { id, label, account, items }
-- items[i] = { slot, item, label, price }vending:phone:purchase
Buys one unit, either from a placed machine (custom) or from a machine type, the city catalog (world).
-- from placed machine 12, product slot 1
local result = lib.callback.await('vending:phone:purchase', false, {
source = 'custom', machineId = 12, slot = 1,
})
-- from the 'drinks' machine type, product slot 2
local result = lib.callback.await('vending:phone:purchase', false, {
source = 'world', machineTypeId = 'drinks', slot = 2,
})
-- { ok = true, item, label, price } or { ok = false, error = 'not_enough_money' }vending:phone:purchaseCart
Several products from one machine, in one payment. The stock and the money are checked for the whole cart before anything is charged.
local result = lib.callback.await('vending:phone:purchaseCart', false, {
source = 'custom',
machineId = 12,
lines = {
{ slot = 1, quantity = 2 },
{ slot = 3, quantity = 1 },
},
})
-- { ok = true, total, purchased = { { item, label, quantity, price }, ... } }Purchases made this way are silent: no notification is sent, so show the result yourself. Stock, the owner's earnings and the money check work exactly as they do at the machine.
About the Errors#
The purchase callbacks answer with a code rather than a sentence, so your interface can word it in its own language:
Code | Means |
|---|---|
| The machine's payment account cannot cover the price. |
| The player cannot carry it. |
| An owned machine has fewer units than were asked for. |
| The machine is for sale and nobody has bought it yet — it sells nothing until then. |
| No machine or machine type with that id. |
| That machine has no product in that slot. |
| The cart has no lines, or mixes products paid from different accounts. |
| Turned off in |
| The framework has no character for that player yet — usually still loading. |
| The request was malformed: no table, or a |



