Script Install

Dependencies

  • One Sync Infinity

  • [mk_utils] (provided with script)

Install Steps

  • Install Dependencies

  • Download [mk_utils] from Keymaster (access provided with script purchase)

  • add mk_utils to resource folder

  • add mk_vehiclekeys to resource folder

  • add ensure mk_utils into server.cfg (It must be added BEFORE mk_vehiclekeys)

  • add ensure mk_vehiclekeys into server.cfg

  • Make sure ox_lib ace permissions are in server.cfg

add_ace resource.ox_lib command.add_ace allow
add_ace resource.ox_lib command.remove_ace allow
add_ace resource.ox_lib command.add_principal allow
add_ace resource.ox_lib command.remove_principal allow

Your server.cfg should look similar to this when finished

goto file qb-core/client/events.lua and replace the event QBCore:Command:SpawnVehicle with the following

RegisterNetEvent('QBCore:Command:SpawnVehicle', function(vehName)
    local ped = PlayerPedId()
    local hash = joaat(vehName)
    local veh = GetVehiclePedIsUsing(ped)
    if not IsModelInCdimage(hash) then return end
    RequestModel(hash)
    while not HasModelLoaded(hash) do
        Wait(0)
    end

    if IsPedInAnyVehicle(ped) then
        SetEntityAsMissionEntity(veh, true, true)
        DeleteVehicle(veh)
    end

    local vehicle = CreateVehicle(hash, GetEntityCoords(ped), GetEntityHeading(ped), true, false)
    TaskWarpPedIntoVehicle(ped, vehicle, -1)
    SetVehicleFuelLevel(vehicle, 100.0)
    SetVehicleDirtLevel(vehicle, 0.0)
    SetModelAsNoLongerNeeded(hash)
    --TriggerEvent('vehiclekeys:client:SetOwner', QBCore.Functions.GetPlate(vehicle))
    exports.mk_vehiclekeys:AddKey(vehicle)
end)

In the same file replace the event QBCore:Client:VehicleInfo with the following

RegisterNetEvent('QBCore:Client:VehicleInfo', function(info)
    local plate = QBCore.Functions.GetPlate(info.vehicle)
    local hasKeys = true

    if GetResourceState('qb-vehiclekeys') == 'started' then
        hasKeys = exports['qb-vehiclekeys']:HasKeys(plate)
    elseif GetResourceState('mk_vehiclekeys') == 'started' then
        hasKeys = exports.mk_vehiclekeys:HasKey(vehicle)
    end

    local data = {
        vehicle = info.vehicle,
        seat = info.seat,
        name = info.modelName,
        plate = plate,
        driver = GetPedInVehicleSeat(info.vehicle, -1),
        inseat = GetPedInVehicleSeat(info.vehicle, info.seat),
        haskeys = hasKeys
    }

    TriggerEvent('QBCore:Client:' .. info.event .. 'Vehicle', data)
end)

Setup Lockpick Items

Last updated