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.

v1.0.0Paid4 Pages
Agency-Vending

01 Installation

Copy agency-vending to resources folder
Add ensure agency-vending to server.cfg
Execute installation/database.sql in database
Register items per framework (ESX/QBCore/ox_inventory)
Copy inventory images from installation/inventory-images/
Configure config.lua

Dependencies

  • oxmysql — required
  • ESX or QBCore — optional, supports standalone
  • ox_target / qb-target — optional
  • agency-phone — optional (for AgencyPay)

SQL File

Import this SQL file into your database before starting the resource:

⬇ vending.sql
-- =============================================
-- Agency Vending - Database Setup
-- =============================================
-- Execute this SQL in your database
-- The tables are required for the player-owned machines system
--
-- NOTE: The tables are also created automatically on first
-- resource start. This SQL is optional for manual setup.
-- =============================================

CREATE TABLE IF NOT EXISTS `agency_vending_machines` (
    `id` INT AUTO_INCREMENT PRIMARY KEY,
    `owner` VARCHAR(50) NOT NULL,
    `type` VARCHAR(50) NOT NULL,
    `coords` TEXT NOT NULL,
    `heading` FLOAT NOT NULL DEFAULT 0,
    `earnings` FLOAT NOT NULL DEFAULT 0
);

CREATE TABLE IF NOT EXISTS `agency_vending_stock` (
    `machine_id` INT NOT NULL,
    `slot` VARCHAR(10) NOT NULL,
    `stock` INT NOT NULL DEFAULT 0,
    `price` FLOAT NOT NULL DEFAULT 0,
    PRIMARY KEY (`machine_id`, `slot`)
);

CREATE TABLE IF NOT EXISTS `agency_vending_spawned` (
    `id` INT AUTO_INCREMENT PRIMARY KEY,
    `type` VARCHAR(50) NOT NULL,
    `model` VARCHAR(100) NOT NULL,
    `coords` TEXT NOT NULL,
    `heading` FLOAT NOT NULL DEFAULT 0,
    `spawned_by` VARCHAR(50) NOT NULL,
    `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Need help? Join our Discord community for support!

Join Discord