QB / ESX
Agency-Vehiclekeys
Advanced vehicle key system with lock/unlock, remote engine start, blinkers/indicators, job vehicle support, key sharing, and Agency-Notify integration. Supports QBCore and ESX with oxmysql persistence.

01 Configuration
Complete config.lua for Agency-Vehiclekeys. All options documented via inline comments.
-- config.lua
Config = {}
-- Set to 'true' to use your custom 'Agency:Notify:Send' event.
-- Set to 'false' to use your framework's default notification system (qb-core or esx).
Config.UseAgencyNotifications = false
-- Select the script language. Options: 'en' or 'de'
Config.Locale = 'de'
-- [[ NEW: UNIVERSAL ENGINE START ]]
-- Set to 'true' to allow anyone to start any vehicle's engine (regardless of ownership).
-- Locking/unlocking will still be restricted to the vehicle owner.
-- Set to 'false' to keep the original behavior (only owner can start engine).
Config.AllowUniversalEngineStart = true
-- [[ NEW: IGNORE LIST ]]
-- Vehicles in this list will be completely ignored by the key script.
-- Anyone can drive them at any time without needing keys or a specific job.
-- Use the vehicle's spawn name (e.g., 'trash', 'postop').
Config.IgnoredVehicles = {
'pbus',
'trash',
'stockade',
'taxi',
'taxi1',
'taxi2',
'taxi3',
'taxi4',
'taxi5',
'premier',
'pcj',
'tailgate',
'rhinehart',
'tiptruck2',
'mixer',
'guardian',
'boxville',
'emperor',
-- Add more public service vehicles here
}
-- === Keybinds ===
Config.LockKey = 47 -- 'G' Key (Default)
Config.EngineKey = 244 -- 'M' Key (Default)
-- Blinker / Indicator Keybinds
Config.IndicatorLeftKey = 174 -- Left Arrow
Config.IndicatorRightKey = 175 -- Right Arrow
Config.IndicatorHazardKey = 173 -- Down Arrow
-- === Distances ===
Config.LockMaxDistance = 100.0 -- Range for Lock/Unlock in milliseconds
----------------------------------------------------------------
-- SECTION FOR JOB VEHICLES
-- These vehicles can be used by anyone with the specified job, without needing keys.
----------------------------------------------------------------
Config.JobVehicles = {
['police'] = {
'police', 'police1', 'police2', 'police3', 'police4', 'police5', 'nightshark', 'svolito',
},
['medic'] = {
'ambulance',
}
}
----------------------------------------------------------------
-- Translations / Messages
----------------------------------------------------------------
Config.Messages = {
['en'] = {
unlocked = 'Vehicle unlocked',
locked = 'Vehicle locked',
not_your_car = 'This is not your vehicle!',
remote_starting = 'Hold [M] for remote start...',
engine_on = 'Engine started',
engine_off = 'Engine stopped',
no_keys_in_ignition = 'No matching key in ignition.',
no_vehicle_nearby = 'No vehicle nearby.',
specify_player_id = 'You must specify a player ID.',
player_not_found = 'Player with this ID not found.',
key_given = 'You gave the keys for [ %s ] to player [ %s ].',
key_received = 'You received the keys for [ %s ] from player [ %s ].',
key_removed = 'You removed the second key for [ %s ] from player [ %s ].',
key_taken_back = 'The second key for [ %s ] was taken from you.',
player_has_no_key = 'This player does not have a second key for this vehicle.',
cannot_give_keys = 'You cannot manage keys for this type of vehicle.', -- [[ NEW ]]
},
['de'] = {
unlocked = 'Fahrzeug aufgeschlossen',
locked = 'Fahrzeug abgeschlossen',
not_your_car = 'Das sind nicht deine Schlüssel!',
remote_starting = 'Halte [M] für Fernstart gedrückt...',
engine_on = 'Motor gestartet',
engine_off = 'Motor abgestellt',
no_keys_in_ignition = 'Kein passender Schlüssel im Zündschloss.',
no_vehicle_nearby = 'Kein Fahrzeug in der Nähe.',
specify_player_id = 'Du musst eine Spieler-ID angeben.',
player_not_found = 'Spieler mit dieser ID nicht gefunden.',
key_given = 'Du hast die Schlüssel für [ %s ] an Spieler [ %s ] übergeben.',
key_received = 'Du hast die Schlüssel für [ %s ] von Spieler [ %s ] erhalten.',
key_removed = 'Du hast die Schlüssel für [ %s ] von Spieler [ %s ] entfernt.',
key_taken_back = 'Die Schlüssel für [ %s ] wurden dir entzogen.',
player_has_no_key = 'Dieser Spieler hat keinen Schlüssel für dieses Fahrzeug.',
cannot_give_keys = 'Für diesen Fahrzeugtyp können keine Schlüssel verwaltet werden.', -- [[ NEW ]]
}
}