QBCore

qb-core

1

Has Keys Check

Vew the code on GitHub: qb-core/client/events.lua

REPLACE the line’s of code exactly as seen in the screenshot below.

qb-core/client/events.lua — line 165
if GetResourceState('cd_garage') == 'started' and plate then
    hasKeys = exports['cd_garage']:DoesPlayerHaveKeys(plate)
end
2

Remove Persistent Vehicle

View the code on GitHub: qb-core/client/functions.lua

Add the line of code exactly as seen in the screenshot below.

qb-core/client/functions.lua — line 385
TriggerServerEvent('cd_garage:RemovePersistentVehicles', exports['cd_garage']:GetPlate(vehicle))


qb-vehicleshop

1

Update Garage Type

View the code on GitHub: qb-vehicleshop/client/main.lua

Add the line of code exactly as seen in the screenshot below.

qb-vehicleshop/client/main.lua — line 657
TriggerEvent('cd_garage:UpdateGarageType')

Do vehicles still respawn when deleting them?

If vehicles still respawn when deleting them, most likely, one of your resources does not use the QBCore delete vehicle function, so you will need to refer to #PersistentVehicles and add the event to that resource.


qb-phone

1

Garage App

View the code on GitHub: qb-phone/server/main.lua

REPLACE the line’s of code exactly as seen in the screenshot below.

qb-phone/server/main.lua — line 234
v.garage = v.garage_id


qb-phone (renewed)

1

Garage App

View the code on GitHub: qb-phone/server/garage.lua

Replace this whole function.

qb-phone/server/garage.lua — line 45
QBCore.Functions.CreateCallback('qb-phone:server:GetGarageVehicles', function(source, cb)
    local Player = QBCore.Functions.GetPlayer(source)
    local Vehicles = {}
    local vehdata
    local result = exports.oxmysql:executeSync('SELECT * FROM player_vehicles WHERE citizenid = ?', {Player.PlayerData.citizenid})
    if result[1] then
        for _, v in pairs(result) do
            local VehicleData = QBCore.Shared.Vehicles[v.vehicle]
            local VehicleGarage = "None"
            local enginePercent = round(v.engine / 10, 0)
            local bodyPercent = round(v.body / 10, 0)
            VehicleGarage = v.garage_id

            local VehicleState = "In"
            if v.in_garage ~= true then
                VehicleState = "Out"
            end
            if v.impound ~= 0 then
                VehicleState = "Impounded"
            end

            if VehicleData["brand"] then
                vehdata = {
                    fullname = VehicleData["brand"] .. " " .. VehicleData["name"],
                    brand = VehicleData["brand"],
                    model = VehicleData["name"],
                    plate = v.plate,
                    garage = VehicleGarage,
                    state = VehicleState,
                    fuel = v.fuel,
                    engine = enginePercent,
                    body = bodyPercent,
                    paymentsleft = v.paymentsleft
                }
            else
                vehdata = {
                    fullname = VehicleData["name"],
                    brand = VehicleData["name"],
                    model = VehicleData["name"],
                    plate = v.plate,
                    garage = VehicleGarage,
                    state = VehicleState,
                    fuel = v.fuel,
                    engine = enginePercent,
                    body = bodyPercent,
                    paymentsleft = v.paymentsleft
                }
            end
            Vehicles[#Vehicles+1] = vehdata
        end
        cb(Vehicles)
    else
        cb(nil)
    end
end)

Last updated

Was this helpful?