QB / ESX
Agency-Vending
Vending machine script with 4 machine types (Soda, Coffee, Snacks, Water Cooler) and automatic detection of GTA V vending props. Modern NUI with numpad selection (A1, B3), drag-and-resize capability, and a full player ownership system where players can buy machines, adjust prices, manage stock, and earn profits. Supports cash and AgencyPay card payments.

01 Configuration
Complete config.lua for Agency-Vending. All options documented via inline comments.
--[[
╔══════════════════════════════════════════════════════════════════╗
║ AGENCY VENDING CONFIG ║
║ ║
║ All settings for the vending system. ║
║ Changes require a script restart. ║
╚══════════════════════════════════════════════════════════════════╝
]]
Config = {}
-- ┌──────────────────────────────────────────────────────────────────┐
-- │ LANGUAGE / LOCALE │
-- └──────────────────────────────────────────────────────────────────┘
Config.Locale = 'fr'
-- Available languages:
-- 'en' English 'de' Deutsch 'fr' Français
-- 'esm' Español 'it' Italiano 'nl' Nederlands
-- 'pl' Polski 'pt' Português 'ro' Română
-- 'ru' Русский 'sv' Svenska 'tr' Türkçe
-- 'cs' Čeština
-- ┌──────────────────────────────────────────────────────────────────┐
-- │ FRAMEWORK │
-- └──────────────────────────────────────────────────────────────────┘
Config.Framework = 'auto'
-- 'auto' Automatically detects whether ESX or QBCore is present
-- 'esx' Force ESX
-- 'qb' Force QBCore
-- 'standalone' No framework (custom money logic)
Config.StandaloneMoneyAccount = 'money'
-- Only relevant if no framework is detected
-- 'money' Cash
-- 'bank' Bank account
-- ┌──────────────────────────────────────────────────────────────────┐
-- │ INTERACTION │
-- └──────────────────────────────────────────────────────────────────┘
Config.InteractionDistance = 2.0 -- Distance to the machine (in meters)
Config.UseAnimation = true -- Play purchase animation?
Config.UIPosition = 'center' -- UI position: 'center', 'left', 'right'
Config.Notification = 'default'-- Notifications: 'default', 'ox', 'custom'
-- Target System
Config.UseTarget = false -- true = ox_target/qb-target, false = 3D text + E key
Config.TargetResource = 'auto' -- 'auto', 'ox_target' or 'qb-target'
-- ┌──────────────────────────────────────────────────────────────────┐
-- │ PAYMENT │
-- └──────────────────────────────────────────────────────────────────┘
Config.PaymentMethods = {
cash = true, -- Insert cash (credit system)
card = true, -- AgencyPay / Card payment (bank)
}
Config.CardFee = 0 -- Card fee in % (e.g. 5 = 5% surcharge)
Config.DepositAmounts = { 1, 5, 10, 20 } -- Deposit amounts in the UI
-- ┌──────────────────────────────────────────────────────────────────┐
-- │ PLAYER-OWNED MACHINES │
-- └──────────────────────────────────────────────────────────────────┘
--
-- Ownership Mode:
-- 'hybrid' State machines usable AND purchasable (default)
-- 'restricted' All machines must be purchased first
-- 'none' State-owned only, no player ownership
--
-- ⚠️ WARNING: Switching to 'none' DELETES ALL player-owned machines
-- from the database! Purchase prices are automatically refunded.
-- This action CANNOT be undone!
Config.OwnershipMode = 'hybrid'
-- Purchase prices per machine type
Config.MachinePurchasePrices = {
['drinks'] = 5000,
['coffee'] = 6000,
['snacks'] = 5500,
['water'] = 3000,
}
Config.MaxMachinesPerPlayer = 5 -- Max. machines per player
Config.MaxStockPerSlot = 50 -- Max. stock per item slot
Config.ManagementDistance = 2.0 -- Distance for management menu
-- Price adjustment by owner
Config.AllowPriceChange = true
Config.MinPricePercent = 50 -- Min. 50% of default price
Config.MaxPricePercent = 200 -- Max. 200% of default price
-- Automatic profit payout
Config.AutoPayoutInterval = 60 -- In minutes (0 = disabled, manual only)
-- ┌──────────────────────────────────────────────────────────────────┐
-- │ ADMIN SPAWNER │
-- └──────────────────────────────────────────────────────────────────┘
--
-- Who can use the Vending Spawner?
-- 'everyone' Every player (⚠️ Not recommended!)
-- 'ace' Only with ACE permission (see AdminAce)
-- 'group' Only specific admin groups (see AdminGroups)
Config.AdminPermission = 'group'
Config.AdminAce = 'agency-vending.admin'
Config.AdminGroups = { 'admin', 'superadmin', 'god' }
Config.SpawnerCommand = 'vendingspawn'
Config.PlacementMaxDistance = 50.0 -- Max. distance when placing
Config.PlacementSnapToGround = true -- Automatically snap to ground
-- ┌──────────────────────────────────────────────────────────────────┐
-- │ MACHINE TYPES │
-- │ │
-- │ All machine types with their products are defined here. │
-- │ Each type has: │
-- │ label Display name in the UI │
-- │ icon Emoji for the UI │
-- │ color Primary color (HEX) │
-- │ colorAccent Accent color (HEX) │
-- │ models GTA V prop models (as hash) │
-- │ items Products with slot, name, item, price, image │
-- │ │
-- │ Slot system: Letter = row, Number = column │
-- │ (e.g. A1, A2, B1, B2, C1...) │
-- │ │
-- │ Image: Filename without extension from html/images/ │
-- └──────────────────────────────────────────────────────────────────┘
Config.MachineTypes = {
-- ╔══════════════════════════════════════╗
-- ║ SODA MACHINE ║
-- ╚══════════════════════════════════════╝
['drinks'] = {
label = 'Soda Machine',
icon = '🥤',
color = '#e74c3c',
colorAccent = '#c0392b',
models = {
`prop_vend_soda_01`,
`prop_vend_soda_02`,
},
items = {
-- Slot Label Item Name Price Image
{ slot = 'A1', label = 'Cola', item = 'cola', price = 3, image = 'cola' },
{ slot = 'A2', label = 'Sprunk', item = 'sprunk', price = 3, image = 'sprunk' },
{ slot = 'A3', label = 'eCola', item = 'ecola', price = 3, image = 'ecola' },
{ slot = 'B1', label = 'Orange Juice', item = 'orange_juice', price = 4, image = 'orange_juice' },
{ slot = 'B2', label = 'Energy Drink', item = 'energy_drink', price = 5, image = 'energy_drink' },
{ slot = 'B3', label = 'Water', item = 'water', price = 2, image = 'water' },
},
},
-- ╔══════════════════════════════════════╗
-- ║ COFFEE MACHINE ║
-- ╚══════════════════════════════════════╝
['coffee'] = {
label = 'Coffee Machine',
icon = '☕',
color = '#8B4513',
colorAccent = '#6B3410',
models = {
`prop_vend_coffe_01`,
},
items = {
{ slot = 'A1', label = 'Espresso', item = 'espresso', price = 4, image = 'espresso' },
{ slot = 'A2', label = 'Cappuccino', item = 'cappuccino', price = 5, image = 'cappuccino' },
{ slot = 'A3', label = 'Latte Macchiato', item = 'latte', price = 5, image = 'latte' },
{ slot = 'B1', label = 'Americano', item = 'americano', price = 4, image = 'americano' },
{ slot = 'B2', label = 'Hot Chocolate', item = 'hot_choco', price = 4, image = 'hot_choco' },
{ slot = 'B3', label = 'Tea', item = 'tea', price = 3, image = 'tea' },
},
},
-- ╔══════════════════════════════════════╗
-- ║ SNACK MACHINE ║
-- ╚══════════════════════════════════════╝
['snacks'] = {
label = 'Snack Machine',
icon = '🍫',
color = '#e67e22',
colorAccent = '#d35400',
models = {
`prop_vend_fridge01`,
`prop_vend_snak_01`,
`prop_vend_snak_01_tu`,
},
items = {
{ slot = 'A1', label = 'Chocolate Bar', item = 'chocolate_bar', price = 3, image = 'chocolate_bar' },
{ slot = 'A2', label = 'Chips', item = 'chips', price = 3, image = 'chips' },
{ slot = 'A3', label = 'Cookies', item = 'cookies', price = 3, image = 'cookies' },
{ slot = 'B1', label = 'Sandwich', item = 'sandwich', price = 5, image = 'sandwich' },
{ slot = 'B2', label = 'Donut', item = 'donut', price = 4, image = 'donut' },
{ slot = 'B3', label = 'Granola Bar', item = 'granola_bar', price = 4, image = 'granola_bar' },
},
},
-- ╔══════════════════════════════════════╗
-- ║ WATER COOLER ║
-- ╚══════════════════════════════════════╝
['water'] = {
label = 'Water Cooler',
icon = '💧',
color = '#3498db',
colorAccent = '#2980b9',
models = {
`prop_watercooler`,
`prop_watercooler_dark`,
},
items = {
{ slot = 'A1', label = 'Water (Cold)', item = 'water_cold', price = 1, image = 'water_cold' },
{ slot = 'A2', label = 'Water (Regular)', item = 'water', price = 1, image = 'water' },
{ slot = 'A3', label = 'Sparkling Water', item = 'sparkling', price = 2, image = 'sparkling' },
},
},
}
-- ┌──────────────────────────────────────────────────────────────────┐
-- │ CUSTOM LOCATIONS (Optional) │
-- │ │
-- │ Force machines at fixed positions. │
-- │ These exist in addition to the default GTA props. │
-- └──────────────────────────────────────────────────────────────────┘
Config.CustomLocations = {
-- Example:
-- { coords = vector3(25.7, -1347.3, 29.5), type = 'drinks', heading = 270.0 },
}