Inicio › Documentación › Instalación · origen_vendings
Coloca origen_vendings después de todas sus dependencias:
ensure ox_lib
ensure oxmysql
ensure qb-core # or qbx_core / es_extended
ensure ox_inventory # or your active inventory
ensure origen_vendingsorigen_vendings crea y mantiene sus propias tablas automáticamente en el primer arranque. No necesitas ejecutar ningún SQL manualmente.
En cada reinicio, el recurso comprueba si faltan tablas o columnas y las aplica automáticamente con el esquema definido en database.sql.
Si actualizas desde una versión anterior, el recurso detectará y añadirá automáticamente las columnas nuevas. No hace falta ninguna migración manual.
A continuación tienes el esquema completo como referencia:
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;Abre config.lua y define tu framework y tu inventario antes de arrancar el recurso:
-- 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' }Si quieres logs en Discord, abre svconfig.lua y sustituye cada 'YOUR_WEBHOOK_URL' por las URL de tus webhooks de Discord:
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/...',
},
}Pon enabled = false en svconfig.lua para desactivar todos los logs de Discord sin quitar los webhooks.
Tras arrancar el recurso, revisa la consola del servidor. Deberías ver un resumen de arranque parecido a este:
========================================================
[origen_vendings]
* Framework: qb-core
* Inventory: ox_inventory
* Language: en
* Version: 1.0.0 Latest Version
========================================================Si ves Can't get version info!, no es un error: solo significa que el servidor no pudo contactar con el endpoint de versiones de GitHub.