# QBCore

### qb-core

{% stepper %}
{% step %}

#### **Has Keys Check**

Vew the code on GitHub: [qb-core/client/events.lua](https://github.com/qbcore-framework/qb-core/blob/b6249c3783ccf9d18bf6487dad2bea0f87934f8e/client/events.lua#L165)

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

{% code title="qb-core/client/events.lua — line 165" %}

```lua
if GetResourceState('cd_garage') == 'started' and plate then
    hasKeys = exports['cd_garage']:DoesPlayerHaveKeys(plate)
end
```

{% endcode %}

<figure><img src="https://789235289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MSKsM-AnxI2icNixJI8%2Fuploads%2FyRDQpFMYpCIv0LTDvNUy%2FScreenshot%202025-10-30%20200558.png?alt=media&#x26;token=7c57bae1-5974-40e6-87d7-2845f7e97b08" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Remove Persistent Vehicle

View the code on GitHub: [qb-core/client/functions.lua](https://github.com/qbcore-framework/qb-core/blob/b6249c3783ccf9d18bf6487dad2bea0f87934f8e/client/functions.lua#L385)

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

{% code title="qb-core/client/functions.lua — line 385" %}

```lua
TriggerServerEvent('cd_garage:RemovePersistentVehicles', exports['cd_garage']:GetPlate(vehicle))
```

{% endcode %}

<figure><img src="https://789235289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MSKsM-AnxI2icNixJI8%2Fuploads%2Fx4e0faEOclVmjK4tOhhl%2FScreenshot_6.png?alt=media&#x26;token=4312cbe2-c889-4c54-8632-c2f35e2cfa99" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

***

### qb-vehicleshop

{% stepper %}
{% step %}
**Update Garage Type**

View the code on GitHub: [qb-vehicleshop/client/main.lua](https://github.com/qbcore-framework/qb-vehicleshop/blob/6fddc5bc25d6b52eaee29d233d0e1c6652b99490/client.lua#L657)

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

{% code title="qb-vehicleshop/client/main.lua — line 657" %}

```lua
TriggerEvent('cd_garage:UpdateGarageType')
```

{% endcode %}

<figure><img src="https://789235289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MSKsM-AnxI2icNixJI8%2Fuploads%2FKUuIMSTwBmzZNcwQz0Oo%2FScreenshot_4.png?alt=media&#x26;token=cf9f16ff-028b-4de4-98de-ec9f9a4de27f" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}

#### **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 [#P](https://docs.codesign.pro/paid-scripts/garage#vehicle-keys)[ersistentVehicles](https://docs.codesign.pro/paid-scripts/garage#persistent-vehicles) and add the event to that resource.
{% endhint %}
{% endstep %}
{% endstepper %}

***

### qb-phone

{% stepper %}
{% step %}
**Garage App**

View the code on GitHub: [qb-phone/server/main.lua](https://github.com/qbcore-framework/qb-phone/blob/1ae3374f96971a5ae7df0665b59c445ebf18f6a3/server/main.lua#L234)

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

{% code title="qb-phone/server/main.lua — line 234" %}

```lua
v.garage = v.garage_id
```

{% endcode %}

<figure><img src="https://789235289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MSKsM-AnxI2icNixJI8%2Fuploads%2FxhS0lLDXCoIRk66s8pts%2F1.png?alt=media&#x26;token=07e1e731-296f-4f59-abfd-be6d3a52fa79" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

***

### qb-phone (renewed)

{% stepper %}
{% step %}
**Garage App**

View the code on GitHub: [qb-phone/server/garage.lua](https://github.com/Renewed-Scripts/qb-phone/blob/7004231ac178a455de9d551bcd7215c14b337cbb/server/garage.lua#L45)

Replace this whole function.

{% code title="qb-phone/server/garage.lua — line 45" lineNumbers="true" %}

```lua
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)
```

{% endcode %}
{% endstep %}
{% endstepper %}
