OrigenNetwork
Docs

Installation · origen_vendings


1. Add to server.cfg

Place origen_vendings after all its dependencies:

cfg
ensure ox_lib
ensure oxmysql
ensure qb-core        # or qbx_core / es_extended
ensure ox_inventory   # or your active inventory
 
ensure origen_vendings

2. Database

origen_vendings creates and maintains its own tables automatically on first start. You do not need to run any SQL manually.

On every restart, the resource checks for missing tables and missing columns, and applies them automatically using the schema defined in database.sql.

If you are upgrading from a previous version, the resource will detect and add any new columns automatically. No manual migration needed.

The complete schema is provided below for reference:

sql
CREATE TABLE `origen_vendings_groups` (
    `id`          INT          NOT NULL AUTO_INCREMENT,
    `name`        VARCHAR(100) NOT NULL,
    `category`    ENUM('drinks','snacks','coffee','cigarettes','custom') NOT NULL DEFAULT 'drinks',
    `enabled`     TINYINT(1)   NOT NULL DEFAULT 1,
    `created_at`  TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at`  TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    KEY `idx_category` (`category`),
    KEY `idx_enabled`  (`enabled`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 
CREATE TABLE `origen_vendings_group_props` (
    `id`         INT          NOT NULL AUTO_INCREMENT,
    `group_id`   INT          NOT NULL,
    `prop_model` VARCHAR(100) NOT NULL,
    `prop_label` VARCHAR(150) NOT NULL DEFAULT '',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uq_group_prop` (`group_id`, `prop_model`),
    KEY `idx_group` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 
CREATE TABLE `origen_vendings_group_items` (
    `id`         INT           NOT NULL AUTO_INCREMENT,
    `group_id`   INT           NOT NULL,
    `item_name`  VARCHAR(100)  NOT NULL,
    `label`      VARCHAR(150)  NOT NULL,
    `price`      INT           NOT NULL DEFAULT 0,
    `use_stock`  TINYINT(1)    NOT NULL DEFAULT 0,
    `stock`      INT           DEFAULT NULL,
    `created_at` TIMESTAMP     NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at` TIMESTAMP     NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `uq_group_item` (`group_id`, `item_name`),
    KEY `idx_group`    (`group_id`),
    KEY `idx_item`     (`item_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 
CREATE TABLE `origen_vendings_machines` (
    `id`          INT           NOT NULL AUTO_INCREMENT,
    `group_id`    INT           NOT NULL,
    `name`        VARCHAR(150)  NOT NULL,
    `prop_model`  VARCHAR(100)  NOT NULL,
    `x`           FLOAT         NOT NULL DEFAULT 0,
    `y`           FLOAT         NOT NULL DEFAULT 0,
    `z`           FLOAT         NOT NULL DEFAULT 0,
    `heading`     FLOAT         NOT NULL DEFAULT 0,
    `spawn_prop`  TINYINT(1)    NOT NULL DEFAULT 1,
    `enabled`     TINYINT(1)    NOT NULL DEFAULT 1,
    `created_at`  TIMESTAMP     NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at`  TIMESTAMP     NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    KEY `idx_group_id` (`group_id`),
    KEY `idx_enabled`  (`enabled`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

3. Initial configuration

Open config.lua and set your framework and inventory before starting the resource:

lua
-- Framework: 'qb-core' | 'qbx_core' | 'esx'
Config.Framework = 'qb-core'
 
-- Inventory: 'auto' detects the active inventory automatically
Config.Inventory = 'auto'
 
-- Admin groups (ACE-based)
Config.GroupPermissions = { 'god', 'admin', 'superadmin' }

If you want Discord logging, open svconfig.lua and replace each 'YOUR_WEBHOOK_URL' with your Discord webhook URLs:

lua
return {
    enabled = true,
    webhooks = {
        ['group-created'] = 'https://discord.com/api/webhooks/...',
        ['group-updated'] = 'https://discord.com/api/webhooks/...',
        ['group-deleted'] = 'https://discord.com/api/webhooks/...',
        ['item-added']    = 'https://discord.com/api/webhooks/...',
        ['item-updated']  = 'https://discord.com/api/webhooks/...',
        ['item-removed']  = 'https://discord.com/api/webhooks/...',
        ['machine-created'] = 'https://discord.com/api/webhooks/...',
        ['machine-updated'] = 'https://discord.com/api/webhooks/...',
        ['machine-deleted'] = 'https://discord.com/api/webhooks/...',
    },
}

Set enabled = false in svconfig.lua to disable all Discord logging without removing the webhooks.


4. Verify the installation

After starting the resource, check the server console. You should see a startup summary similar to:

text
========================================================
[origen_vendings]
* Framework: qb-core
* Inventory: ox_inventory
* Language:  en
* Version:   1.0.0 Latest Version
========================================================

If you see Can't get version info!, this is not an error — it just means the server could not reach the GitHub version endpoint.