Agency Docs
QBESXStandalone

Agency-Vehiclekeys V2 配置

适用于 QBCore、Qbox、ESX 或完全独立运行的 FiveM 通用车辆钥匙。按 G 可用手中的钥匙遥控器锁定或解锁你有钥匙的最近车辆,并伴有短促的喇叭声和车灯闪烁,按 U 可启动引擎。按 F5.

v2.0.0付费5 页面

01配置

快速安装 · config.lua · Agency-Vehiclekeys V2

下载 config.lua

--[[ ============================================================================ AGENCY VEHICLEKEYS V2 · config.lua ---------------------------------------------------------------------------- Universal keys for every vehicle: owned cars, shared keys, job vehicles and rentals. Finds QBCore, Qbox or ESX by itself and runs fully standalone without any of them. Everything a server owner may want to change is here. Admins change the look and the most used switches live in the menu (/keys, tab with the gear). Those values are saved for the whole server and win over this file until "Reset to config.lua" is pressed. ============================================================================ ]] Config = {} -- ============================================================================= -- 1. GENERAL -- ============================================================================= Config.Framework = 'auto' -- 'auto' | 'qbcore' (also Qbox) | 'esx' | 'standalone' Config.Locale = 'en' -- en de fr es it pt nl pl cs sv da fi ro hu hr bg el tr ru uk ar hi ja ko zh -- Debug mode: every request in the server console (who, what, result), extra -- lines in F8, and /vkdebug in game shows everything about the car in front -- of you. Admins can switch it in the menu as well. Config.Debug = false -- Where the keys are saved. 'auto' uses oxmysql when it runs (table -- agency_vehiclekeys, created by itself) and otherwise the server's own key -- value store, so a server without a database works as well. Config.Storage = 'auto' -- 'auto' | 'mysql' | 'kvp' -- Where your framework keeps the owned vehicles. 'auto' knows QBCore and Qbox -- (player_vehicles, citizenid) and ESX (owned_vehicles, owner). Change it only -- for a garage or framework fork with its own table. Config.OwnedVehicles = { table = 'auto', -- e.g. 'owned_vehicles' owner = 'auto', -- column with the owner: citizenid (QB) / owner (ESX) plate = 'plate', -- column with the plate } -- The inventory that holds lockpicks. 'auto' finds ox_inventory and -- qs-inventory, otherwise the framework's own (qb-inventory and its forks, -- ESX). 'none' never asks for an item. Config.Inventory = 'auto' -- 'auto' | 'ox' | 'qs' | 'framework' | 'none' -- How messages are shown (the V1 look and messages from the server): -- 'auto' = Agency-Notify when it runs, then your framework, then the GTA feed. Config.Notify = 'auto' -- 'auto' | 'agency' | 'framework' | 'gta' -- ============================================================================= -- 2. LOOK -- ============================================================================= Config.UI = { -- 'v2' is the Agency-Housing look: gold, solid cards, pills. -- 'v1' is the classic look of Vehiclekeys V1: every message as a -- notification (Agency-Notify, your framework or the GTA feed) and the menu -- in the old Agency style. design = 'v2', position = 'bottom', -- where the key fob card shows up: 'bottom' | 'right' | 'top' scale = 1.0, -- 0.8 to 1.3 } -- In the V2 look lock and engine messages use the key fob card; everything -- else follows Config.Notify above. false skips Agency-Notify in 'auto'. Config.UseAgencyNotify = true -- ============================================================================= -- 3. CONTROLS -- ============================================================================= -- Players can change every key in the GTA settings (Key Bindings > FiveM). -- The defaults stay clear of the other Agency scripts: Agency Phone opens -- with M, Agency Pad and Agency-Seatbelt use K, Agency Watch Z, Housing F7. -- (V1 used M for the engine: set engine = 'M' for the old key.) Config.Controls = { lock = 'G', -- lock or unlock the nearest vehicle you have a key for engine = 'U', -- engine on or off in the driver seat menu = 'F5', -- the key ring lockpick = 'H', -- pick a lock on foot, hotwire in the driver seat indicators = true, -- arrow keys for the indicators (as in V1) indicatorLeft = 'LEFT', indicatorRight = 'RIGHT', hazards = 'DOWN', } Config.Commands = { menu = 'keys', -- opens the key ring (admins get the admin tabs there) -- V1 commands, kept for everyone who is used to them: giveKey = { 'givekey', 'gibschluessel' }, -- /givekey [id]: key of the vehicle you sit in or stand next to removeKey = { 'removekey', 'nimm_schluessel' }, -- /removekey [id] } -- ============================================================================= -- 4. LOCKING -- ============================================================================= Config.Lock = { range = 25.0, -- metres the remote reaches (V1 used 100) anim = true, -- key fob in hand and the click animation chirp = true, -- short horn beep and flashing indicators -- Vehicle classes without doors to lock: motorcycles, cycles, boats, -- helicopters, planes and trains. They still need a key for the engine -- when Config.Engine.needKey is on. noLockClasses = { 8, 13, 14, 15, 16, 21 }, } -- ============================================================================= -- 5. ENGINE AND TRUNK -- ============================================================================= Config.Engine = { -- false (as in V1): everyone can start and stop any engine, keys decide -- who locks. true: the engine only runs with a key, after hotwiring or in -- an ignored vehicle. needKey = false, keepRunning = true, -- the engine keeps running when you get out remote = true, -- start and stop the engine from the key ring } Config.Trunk = { remote = true, -- open and close the trunk from the key ring } -- ============================================================================= -- 6. SHARING KEYS -- ============================================================================= Config.Share = { enabled = true, distance = 5.0, -- metres to the other player; 0 = any online player by ID maxPerVehicle = 6, -- keys an owner can hand out per vehicle tempHours = 0, -- temporary keys last until the next restart (0) or this many hours showNames = false, -- character names in the list of nearby players (off: ID and distance) } -- ============================================================================= -- 7. JOB VEHICLES -- ============================================================================= -- Players with the job can lock and drive these vehicles without a key. -- models: spawn names. grade: lowest job grade. onDuty: only while on duty -- (QBCore, Qbox, and ESX forks with duty). -- ace: standalone servers have no jobs; give the ACE instead, for example -- add_ace group.police agency.vehiclekeys.police allow Config.JobKeys = { police = { label = 'Police', models = { 'police', 'police2', 'police3', 'police4', 'policeb', 'policet', 'sheriff', 'sheriff2', 'fbi', 'fbi2', 'pranger', 'riot', 'nightshark', 'svolito', 'polmav', 'predator' }, grade = 0, onDuty = true, ace = 'agency.vehiclekeys.police', }, ambulance = { label = 'EMS', models = { 'ambulance', 'firetruk', 'lguard', 'blazer2' }, grade = 0, onDuty = true, ace = 'agency.vehiclekeys.ambulance', }, mechanic = { label = 'Mechanic', models = { 'towtruck', 'towtruck2', 'flatbed' }, grade = 0, onDuty = false, ace = 'agency.vehiclekeys.mechanic', }, } -- ============================================================================= -- 8. IGNORED VEHICLES -- ============================================================================= -- Nobody needs a key for these, nobody can lock them. Spawn names. Config.IgnoredModels = { 'pbus', 'bus', 'coach', 'airbus', 'rentalbus', 'tourbus', 'trash', 'trash2', 'stockade', 'taxi', 'tiptruck2', 'mixer', 'guardian', 'boxville', 'bmx', 'cruiser', 'fixter', 'scorcher', 'tribike', 'tribike2', 'tribike3', } -- ============================================================================= -- 9. LOCKPICKING AND HOTWIRING -- ============================================================================= Config.Lockpick = { enabled = true, -- The first item the player carries is used. difficulty: 'easy' | 'medium' | 'hard'. items = { { name = 'advancedlockpick', difficulty = 'easy', breakChance = 10 }, { name = 'lockpick', difficulty = 'medium', breakChance = 35 }, }, -- Standalone servers without an inventory cannot carry items. 'auto' -- needs an item wherever an inventory runs and none without one. needItem = 'auto', -- 'auto' | true | false rounds = 3, -- skill check rounds alarmChance = 60, -- percent: the car alarm goes off policeChance = 40, -- percent: police get a dispatch alert notifyOwner = true, -- the owner gets a message when someone breaks in cooldown = 10, -- seconds between two tries alarmSeconds = 30, -- Classes that cannot be picked (18 = emergency vehicles). blockedClasses = { 18 }, } Config.Hotwire = { -- Only matters with Config.Engine.needKey = true: without a key the player -- can hotwire the car from the driver seat. Success gives a temporary key. enabled = true, needItem = false, -- true: needs one of the lockpick items rounds = 4, difficulty = 'medium', alarmChance = 35, policeChance = 25, cooldown = 15, } -- ============================================================================= -- 10. POLICE ALERTS -- ============================================================================= Config.Police = { jobs = { 'police', 'sheriff', 'lspd', 'bcso' }, onDutyOnly = true, -- 'auto' finds ps-dispatch, cd_dispatch, qs-dispatch, rcore_dispatch, -- core_dispatch, tk_dispatch or lb-tablet; 'notify' messages every -- officer; 'none' switches alerts off. dispatch = 'auto', code = '10-60', blip = { sprite = 225, color = 1, scale = 1.0, seconds = 60 }, } -- ============================================================================= -- 11. STANDALONE -- ============================================================================= Config.Standalone = { -- A player who drives off first in a vehicle that nobody has a key for -- and that a script spawned (vMenu, admin menus, job scripts) gets a -- temporary key for it. Ambient traffic never counts. claimSpawned = true, -- Admins: ACE 'agency.vehiclekeys.admin' or group.admin / group.superadmin. adminAce = 'agency.vehiclekeys.admin', -- Items without a framework: fill in these three functions to connect an -- inventory of your own (return numbers / true). itemCount = nil, -- function(source, item) return 0 end removeItem = nil, -- function(source, item, amount) return true end } -- On QBCore also usable in framework mode: a script spawned vehicle nobody -- owns goes to the first driver (admin cars, events). Off by default. Config.ClaimSpawnedWithFramework = false -- ============================================================================= -- 12. ADMINS -- ============================================================================= Config.AdminGroups = { 'admin', 'god', 'superadmin' } -- ============================================================================= -- 13. OWN TEXTS -- ============================================================================= -- Any key from locales/en.lua can be given your own wording here. It wins over -- every language and survives updates, for example: -- Config.Text = { locked = 'Car locked', ui_title = 'My keys' } Config.Text = {}

02SQL 文件

可选:资源启动时会自动创建这些数据表。只有在手动配置数据库时才需要导入此文件:

-- Agency Vehiclekeys V2 -- Optional: the script creates this table by itself on the first start when -- oxmysql runs. Run it by hand only if your database user may not create tables. CREATE TABLE IF NOT EXISTS `agency_vehiclekeys` ( `plate` VARCHAR(16) NOT NULL, `identifier` VARCHAR(96) NOT NULL, `kind` VARCHAR(12) NOT NULL DEFAULT 'shared', `holder` VARCHAR(64) NULL DEFAULT NULL, `granted_by` VARCHAR(96) NULL DEFAULT NULL, `model` VARCHAR(32) NULL DEFAULT NULL, `created` INT UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (`plate`, `identifier`), KEY `identifier` (`identifier`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

+值得了解

config.lua 中的每个选项都有实际作用,分为 13 个部分,涵盖框架设置到自定义文案。最常用的开关也可以在游戏内钥匙圈的 Settings 选项卡中更改,并对整个服务器生效。

常规与外观
Config.Framework、Config.Locale、Config.Debug、Config.Storage、Config.Inventory 和 Config.Notify 用于选择脚本的运行方式。Config.UI 用于设置界面设计(v2 或 v1)、钥匙卡的显示位置和尺寸。
控制和命令
Config.Controls 用于设置 G、U、F5 和 H,以及控制转向灯的方向键。Config.Commands 用于设置 /keys,以及 V1 命令 /givekey 和 /removekey 及其德语别名。
上锁、发动机和后备箱
Config.Lock 用于设置遥控器的范围、动画和喇叭提示音,以及没有车门、无法上锁的车辆类别。Config.Engine 用于设置发动机是否需要钥匙、是否保持运转,以及能否通过钥匙圈启动。Config.Trunk 用于通过遥控器打开后备箱。
分享钥匙
Config.Share 用于设置与其他玩家之间的距离、每辆车的钥匙数量、临时钥匙的有效时长,以及附近玩家列表是否显示角色名称。
工作车辆
Config.JobKeys 用于列出警察、EMS 和技工的车辆,设置最低工作等级、玩家是否必须处于值勤状态,以及独立服务器使用的 ACE。
撬锁和热线启动
Config.Lockpick 用于设置撬锁物品及其难度和损坏概率、尝试回合数、触发警报和通知警方的概率、冷却时间,以及无法撬锁的车辆类别。Config.Hotwire 用于设置热线启动的相同选项。
警方警报
Config.Police 用于设置警察职业、是否仅向值勤警员发送警报、派遣系统(会自动检测其中七种)、代码和地图标记。
独立模式
Config.Standalone 用于在通过脚本生成的车辆没有任何人拥有钥匙时,为第一位驾驶员提供临时钥匙、设置管理员 ACE,并通过两个函数接入你自己的物品栏。

?常见问题

菜单中的设置会改变什么?

设计、卡片位置和尺寸、遥控范围、引擎规则、喇叭和车灯、共享、生成的车辆、撬锁、热线启动、警报和调试模式。这些设置会保存到整个服务器中,并优先于 config.lua,直到按下 Reset to config.lua 或在控制台运行 vehiclekeys reset。

如何使用自定义文本?

将 locales/en.lua 中的键及对应文本放入 Config.Text,例如 Config.Text = { locked = 'Car locked' }。它会覆盖所有语言设置,并且在更新后仍会保留。

看完本页仍未解决?接下来由我们的支持团队接手。