-- Remove key from player (when vehicle is sold/destroyed) RegisterNetEvent('carkeys:removeKey') AddEventHandler('carkeys:removeKey', function(plate) local src = source local xPlayer = Framework.GetPlayerFromId(src) local keyItem = string.format('%s_%s', Config.KeyItem, plate) xPlayer.removeInventoryItem(keyItem, 1) end)
-- Distance to interact with vehicle (for remote lock/unlock) Config.InteractDistance = 10.0 local Framework = nil if Config.Framework == 'esx' then TriggerEvent('esx:getSharedObject', function(obj) Framework = obj end) elseif Config.Framework == 'qb' then Framework = exports['qb-core']:GetCoreObject() end fivem car key script
-- Notification style Config.Notify = function(msg, type) -- type: 'info', 'error', 'success' -- Change this to your framework's notification if Config.Framework == 'esx' then ESX.ShowNotification(msg) elseif Config.Framework == 'qb' then QBCore.Functions.Notify(msg, type) else print(msg) end end -- Remove key from player (when vehicle is
client_scripts { 'config.lua', 'client.lua' } type) -- type: 'info'