Tutorials
How to lock/unlock vehicle with third party script ?
How to make your vehicle drivable after lockpicking it while Config.NeedKeysToStartVehicles is true
How to create vehicle_keys table in your database
1.
---@param vehicle integer
---@param status Optional[integer] (1 || 2)
exports.fivecode_carkeys:ToggleLock(vehicle, status)-- For example in ox_target
exports.ox_target:addGlobalVehicle({
{
name = 'ox_target:driverF',
icon = 'fa-solid fa-car-side',
label = 'Toggle Lock Vehicle',
bones = { 'bodyshell' },
canInteract = function(entity, distance, coords, name)
local boneId = GetEntityBoneIndexByName(entity, 'door_dside_f')
if boneId ~= -1 then
return #(coords - GetWorldPositionOfEntityBone(entity, boneId)) < 0.5 or #(coords - GetWorldPositionOfEntityBone(entity, GetEntityBoneIndexByName(entity, 'seat_dside_f'))) < 0.72
end
end,
onSelect = function(data)
exports.fivecode_carkeys:ToggleLock(data.entity)
end
}
})2.
Client side:
Server side:
Script used for this demonstration: https://github.com/esx-framework/esx_vehicleshop
Script used for this demonstration: https://github.com/qbcore-framework/qb-vehicleshop
3.
4.
5.
If you need help with anything, do not hesitate and open a support ticket in our discord.
Last updated
Was this helpful?