# kq\_wheeldamage

{% hint style="warning" %}
**This section is for qb-core / qbx\_core users only.**

ESX users, do not need to make any changes - es\_extended has these options in its vehicle properties by default.
{% endhint %}

{% hint style="danger" %}
**If you're using VMS Tuning**, you don't need to make the following changes - [use our prepared Vehicle Properties](https://docs.vames-store.com/assets/vms_tuning/installation).
{% endhint %}

<details>

<summary>qb-core</summary>

1. Go to your **qb-core/client/functions.lua**
2. Find function `QBCore.Functions.GetVehicleProperties`
3. Replace below code from:

```lua
local tireHealth = {}
for i = 0, 3 do
    tireHealth[i] = GetVehicleWheelHealth(vehicle, i)
end

local tireBurstState = {}
for i = 0, 5 do
    tireBurstState[i] = IsVehicleTyreBurst(vehicle, i, false)
end

local tireBurstCompletely = {}
for i = 0, 5 do
    tireBurstCompletely[i] = IsVehicleTyreBurst(vehicle, i, true)
end
```

to:

```lua
local tireHealth = {}
for i = 0, 3 do
    tireHealth[tostring(i)] = GetVehicleWheelHealth(vehicle, i)
end

local tireBurstState = {}
for i = 0, 5 do
    tireBurstState[tostring(i)] = IsVehicleTyreBurst(vehicle, i, false)
end

local tireBurstCompletely = {}
for i = 0, 5 do
    tireBurstCompletely[tostring(i)] = IsVehicleTyreBurst(vehicle, i, true)
end
```

4. Find function `QBCore.Functions.SetVehicleProperties`
5. Replace below code from:

```lua
if props.tireHealth then
    for wheelIndex, health in pairs(props.tireHealth) do
        SetVehicleWheelHealth(vehicle, wheelIndex, health)
    end
end
```

to:

```lua
if props.tireHealth then
    for wheelIndex, health in pairs(props.tireHealth) do
        SetVehicleWheelHealth(vehicle, tonumber(wheelIndex), health)
    end
end
```

</details>

<details>

<summary>qbx_core</summary>

1. Go to your **qbx\_core/bridge/qb/client/functions.lua**
2. Find function `functions.GetVehicleProperties`
3. Replace below code from:

```lua
local tireHealth = {}
for i = 0, 3 do
    tireHealth[i] = GetVehicleWheelHealth(vehicle, i)
end

local tireBurstState = {}
local tireBurstCompletely = {}

for i = 0, 7 do
    local damage = props.tyres[i]
    tireBurstState[i] = damage == 1 or damage == 2
    tireBurstCompletely[i] = damage == 2
end
```

to:

```lua
local tireHealth = {}
for i = 0, 3 do
    tireHealth[tostring(i)] = GetVehicleWheelHealth(vehicle, i)
end

local tireBurstState = {}
local tireBurstCompletely = {}

for i = 0, 7 do
    local damage = props.tyres[i]
    tireBurstState[tostring(i)] = damage == 1 or damage == 2
    tireBurstCompletely[tostring(i)] = damage == 2
end
```

4. Find function `functions.SetVehicleProperties`
5. Replace below code from:

```lua
if props.tireHealth and not props.tyres then
    for wheelIndex, health in pairs(props.tireHealth) do
        SetVehicleWheelHealth(vehicle, wheelIndex, health)
    end
end
```

```lua
if (props.tireBurstCompletely or props.tireBurstState) and not props.tyres then
    props.tyres = {}
    for i = 0, 7 do
        props.tyres[i] = props.tireBurstCompletely and props.tireBurstCompletely[i] and 2 or props.tireBurstState and props.tireBurstState[i] and 1 or nil
    end
end
```

to:

```lua
if props.tireHealth and not props.tyres then
    for wheelIndex, health in pairs(props.tireHealth) do
        SetVehicleWheelHealth(vehicle, tonumber(wheelIndex), health)
    end
end
```

```lua
if (props.tireBurstCompletely or props.tireBurstState) and not props.tyres then
    props.tyres = {}
    for i = 0, 7 do
        props.tyres[tostring(i)] = props.tireBurstCompletely and props.tireBurstCompletely[tostring(i)] and 2 or props.tireBurstState and props.tireBurstState[tostring(i)] and 1 or nil
    end
end
```

6. Go to your **ox\_lib/resource/vehicleProperties/client.lua**
7. Replace below code from:

```lua
for i = 0, 7 do
    if IsVehicleTyreBurst(vehicle, i, false) then
        damage.tyres[i] = IsVehicleTyreBurst(vehicle, i, true) and 2 or 1
    end
end
```

to:

```lua
for i = 0, 7 do
    if IsVehicleTyreBurst(vehicle, i, false) then
        damage.tyres[tostring(i)] = IsVehicleTyreBurst(vehicle, i, true) and 2 or 1
    end
end
```

</details>
