Agency-Vehiclekeys V2 Конфигурация
Универсальные ключи от транспорта для FiveM на QBCore, Qbox, ESX или полностью standalone.

01Конфигурация
Быстрая установка · config.lua · Agency-Vehiclekeys V2
--[[
╔══════════════════════════════════════════════════════════════════════╗
║ AGENCY VEHICLEKEYS - CONFIGURATION ║
║ (c) Agency Scripts ║
╚══════════════════════════════════════════════════════════════════════╝
CONTENTS
1. Agency Companion The free app for your players, accent colour
2. Core Language, framework, storage, inventory
3. Integrations Agency-Notify, Agency-Progressbar
4. Look Design and position of the key fob card
5. Controls Keys and commands
6. Locking Remote range, animation, chirp
7. Engine and trunk Who may start the engine, remote engine and trunk
8. Sharing keys Give keys to other players
9. Job vehicles Police, EMS and mechanic cars without a key
10. Ignored vehicles Buses, bikes and other cars without keys
11. Lockpicking Lockpicks, hotwiring, alarms
12. Police alerts Dispatch scripts and blips
13. Standalone Servers without a framework
14. Admins Admin groups
15. Own texts Your own wording for any text
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.
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.
Discord: https://discord.gg/RTax3aBMUs · Shop: https://shop.agencyg.de
]]
Config = {}
--==============================================================================
-- 1 · AGENCY COMPANION
--==============================================================================
-- Agency-Companion (free): https://shop.agencyg.de/en/product/agency-companion
-- One resource for every Agency script: your players link them with the free
-- Agency Companion app (iPhone, Android, web), and your admins pick one accent
-- colour for all Agency scripts in game (/app, admin page). Drop it into your
-- resources and Agency Vehiclekeys follows it by itself. Nothing else to set up.
Config.Companion = {
Enabled = true, -- follow Agency-Companion (accent colour)
}
-- ── Accent colour ────────────────────────────────────────────────────────────
-- false = the colour from Agency-Companion, gold without it
-- { r,g,b } = a fixed colour for this script only, e.g. { 0, 190, 255 }
-- Only the V2 look uses the accent colour, the V1 look keeps its classic blue.
Config.AccentColor = false
--==============================================================================
-- 2 · CORE
--==============================================================================
-- ── Language ─────────────────────────────────────────────────────────────────
-- en bg cs da de el es fi fr hr hu it ja ko nb nl pl pt ro ru sk sv tr uk zh (also ar hi)
Config.Locale = 'en'
-- ── Framework ────────────────────────────────────────────────────────────────
Config.Framework = 'auto' -- 'auto' | 'qbcore' (also Qbox) | 'esx' | 'standalone'
-- ── Debug ────────────────────────────────────────────────────────────────────
-- 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
-- ── Storage ──────────────────────────────────────────────────────────────────
-- 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'
-- ── Owned vehicles ───────────────────────────────────────────────────────────
-- 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
}
-- ── Inventory ────────────────────────────────────────────────────────────────
-- 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'
--==============================================================================
-- 3 · INTEGRATIONS
--==============================================================================
-- ── Notifications ────────────────────────────────────────────────────────────
-- Agency-Notify (free): https://shop.agencyg.de/en/product/notify
-- 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'
-- 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
-- ── Progress bar ─────────────────────────────────────────────────────────────
-- Agency-Progressbar (free): https://shop.agencyg.de/en/product/progressbar
-- Used for connecting the wires after a successful hotwire (see section 11,
-- Config.Hotwire.wireTime). 'auto' = Agency-Progressbar when it runs, the
-- animation alone otherwise. 'none' = never.
Config.Progressbar = 'auto' -- 'auto' | 'none'
--==============================================================================
-- 4 · LOOK
--==============================================================================
-- The key ring, the key fob card and the skill check fit every screen
-- resolution by themselves (laid out for 1080p, from small windows up to 4K).
Config.UI = {
-- 'v2' is the Agency-Housing look: accent colour, 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, -- not used any more (automatic), kept for older configs
}
--==============================================================================
-- 5 · 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]
}
--==============================================================================
-- 6 · 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 },
}
--==============================================================================
-- 7 · 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
}
--==============================================================================
-- 8 · 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)
}
--==============================================================================
-- 9 · 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',
},
}
--==============================================================================
-- 10 · 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',
}
--==============================================================================
-- 11 · 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,
-- After the last skill check round the player connects the wires for this
-- many milliseconds (Agency-Progressbar when it runs, see section 3).
-- 0 = the engine starts at once, as in 2.0.
wireTime = 2500,
}
--==============================================================================
-- 12 · 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 },
}
--==============================================================================
-- 13 · 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
--==============================================================================
-- 14 · ADMINS
--==============================================================================
Config.AdminGroups = { 'admin', 'god', 'superadmin' }
--==============================================================================
-- 15 · 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 для standalone-серверов.
- Взлом замка и подключение зажигания
- Config.Lockpick задаёт предметы, сложность и вероятность их поломки, количество раундов, вероятность срабатывания сигнализации и вызова полиции, время перезарядки и классы автомобилей, замки которых нельзя взломать. Config.Hotwire задаёт те же параметры для подключения зажигания.
- Оповещения полиции
- Config.Police задаёт полицейские работы, необходимость для получения оповещений находиться на смене, систему диспетчеризации (автоматически определяет семь таких систем), код и метку на карте.
- Standalone
- Config.Standalone выдаёт временному водителю скриптового автомобиля, у которого нет ключа, временный ключ, задаёт ACE администратора и подключает вашу систему инвентаря с помощью двух функций.
?Частые вопросы
На что влияют настройки в меню?
Дизайн, положение и размер карточки, радиус действия пульта, правила работы двигателя, сигнал, фары, передача ключей, появившиеся машины, взлом замков, подключение зажигания, сигнализация и режим отладки. Эти настройки сохраняются для всего сервера и имеют приоритет над config.lua, пока не будет нажата кнопка Reset to config.lua или не будет выполнена команда vehiclekeys reset в консоли.
Как использовать собственные тексты?
Добавьте ключ из locales/en.lua со своим текстом в Config.Text, например Config.Text = { locked = 'Car locked' }. Он имеет приоритет над любым языком и сохраняется после обновлений.