01安装
- 1将 agency-vending 复制到 resources 文件夹
- 2在 server.cfg 中加入 ensure agency-vending
- 3在数据库中执行 installation/database.sql
- 4按框架注册物品(ESX/QBCore/ox_inventory)
- 5从 installation/inventory-images/ 复制背包图片
- 6可选:添加免费的 Agency-Companion 资源以统一所有 Agency 脚本的强调色。config.lua 的第 1 节为 Agency Companion,默认开启
- 7更新:替换资源文件夹,并将你的配置值迁移到新的 config.lua 中。旧密钥继续生效,数据库中的数据保持不变
- 8配置 config.lua
- 9Open Edition:你可以自由编辑客户端代码、共享代码、界面与配置,服务端代码保持加密。请保留文件夹名称,并先删除常规版本。
02依赖项
oxmysql(必需)ESX 或 QBCore(可选,支持独立运行)ox_target / qb-target(可选)agency-phone(可选,用于 AgencyPay)Agency-Companion (可选,免费:所有 Agency 脚本共用统一强调色)
03SQL 文件
在启动资源之前,将此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
);
