Config
-- ██╗ ██████╗██████╗ ██████╗ ██╗ ██╗███████╗██╗ ██╗██╗ ██████╗██╗ ███████╗██╗ ██╗███████╗██╗ ██╗███████╗
-- ██║██╔════╝╚════██╗██╔══██╗ ██║ ██║██╔════╝██║ ██║██║██╔════╝██║ ██╔════╝██║ ██╔╝██╔════╝╚██╗ ██╔╝██╔════╝
-- ██║██║ █████╔╝██║ ██║ ██║ ██║█████╗ ███████║██║██║ ██║ █████╗ █████╔╝ █████╗ ╚████╔╝ ███████╗
-- ██║██║ ╚═══██╗██║ ██║ ╚██╗ ██╔╝██╔══╝ ██╔══██║██║██║ ██║ ██╔══╝ ██╔═██╗ ██╔══╝ ╚██╔╝ ╚════██║
-- ██║╚██████╗██████╔╝██████╔╝███████╗╚████╔╝ ███████╗██║ ██║██║╚██████╗███████╗███████╗██║ ██╗███████╗ ██║ ███████║
-- ╚═╝ ╚═════╝╚═════╝ ╚═════╝ ╚══════╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═════╝╚══════╝╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝
Vehiclekey = {}
-- todo: if try to open locked, start beeping and flashing lights (the alarm goes off).
Vehiclekey.Lang = 'EN' -- ES/EN/PL/FR/IT/PT
-- Key type: 'Modern', 'Futuristic', 'Normal'
Vehiclekey.KeyType = 'Modern' -- Choose which key model to use
Vehiclekey.Button = 'K' -- keys bind
Vehiclekey.LockToggleButton = 'O' -- hotkey to lock/unlock without opening UI
-- Maximum distance (in GTA units/meters) from which a player can remotely lock/unlock/start
-- Setting this too high might allow interacting with unintended vehicles. Default 25.0
Vehiclekey.MaxKeyRange = 25.0
Vehiclekey.Delay = 0 -- 2s
Vehiclekey.inventory = 'ox_inventory' -- ox_inventory / qs-inventory
Vehiclekey.Item = 'vehiclekeys' -- item
Vehiclekey.Notifications = 'ox_lib' -- ox_lib/esx
-- Allow player to play the default door pulling animation when trying a locked vehicle
-- true = player reaches and pulls handle (more immersive)
-- false = instantly cancel attempt (old behavior)
Vehiclekey.AllowLockedDoorAnimation = true
-- Alarm settings (triggered when someone without a key tries to enter or lockpick a locked vehicle)
Vehiclekey.Alarm = {
enabled = true,
duration = 15000, -- total duration in ms
flashInterval = 400, -- ms between light toggles
soundInterval = 1200, -- ms between horn beeps
hornSound = 'SIRENS_AIRHORN', -- PlaySoundFromEntity sound name (optional)
maxDistance = 60.0 -- processing range; alarms farther than this from player won't tick to save performance
}
-- Lockpick system selection:
-- 'bl_ui' (existing RapidLines), 'lockpick' (exports['lockpick']:startLockpick()), 't3_lockpick' (exports['t3_lockpick']:startLockpick())
-- ( You can edit the function Vehiclekey.RunLockpickMiniGame() bellow to customize lockpick integration )
Vehiclekey.LockpickSystem = 'bl_ui'
Vehiclekey.LockpickItemName = 'lockpick' -- inventory item name that triggers AttemptLockpick
-- Key Shop settings
Vehiclekey.KeyShopEnabled = true
Vehiclekey.KeyShopPrice = 2500 -- price to buy a replacement key
Vehiclekey.Payment = 'ox' -- 'ox' (ox_inventory item money) | 'esx' (ESX cash) | 'qb' (QB-Core cash)
Vehiclekey.MoneyItemName = 'money' -- used when Payment == 'ox'
Vehiclekey.KeyShopLocations = {
vec3(170.0, -1799.5, 29.32)
}
Vehiclekey.KeyShopBlip = {
enabled = true,
sprite = 402, -- key icon
color = 5,
scale = 0.8,
name = 'Key Shop'
}
function Notifi(data)
if Vehiclekey.Notifications == 'ox_lib' then
TriggerEvent('ox_lib:notify', {
title = data.title or 'VehicleKeys',
description = data.text or data,
position = data.position or 'top-right',
style = {
backgroundColor = '#292929',
color = '#c2c2c2',
['.description'] = {
color = '#cccccc'
}
},
icon = data.icon or 'car',
iconColor = data.color or '#d46363'
})
elseif Vehiclekey.Notifications == 'esx' then
TriggerEvent('esx:showNotification', data.text, "success", 3000)
end
end
function PlateEqual(valueA, valueB)
valueA = tostring(valueA)
valueB = tostring(valueB)
valueA = valueA:gsub("%s", ""):lower()
valueB = valueB:gsub("%s", ""):lower()
return valueA == valueB
end
--[[
Customizable lockpick mini-game dispatcher.
You can freely modify this function to integrate any other system.
Return true for success, false for fail.
]]
function Vehiclekey.RunLockpickMiniGame()
local system = Vehiclekey.LockpickSystem or 'bl_ui'
if system == 'lockpick' and exports['lockpick'] and exports['lockpick'].startLockpick then
local ok = exports['lockpick']:startLockpick()
return ok == true
elseif system == 't3_lockpick' and exports['t3_lockpick'] and exports['t3_lockpick'].startLockpick then
local item = Vehiclekey.LockpickItemName or 'lockpick'
local ok = exports['t3_lockpick']:startLockpick(item, 1, 4)
return ok == true
elseif system == 'bl_ui' and exports['bl_ui'] and exports['bl_ui'].RapidLines then
local ok = exports['bl_ui']:RapidLines(1, 60, 5)
return ok == true
end
return false
end
Last updated
Was this helpful?