From 16c99135016bdc9db0804ec27ba4f110b417e2bd Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 5 Mar 2024 16:08:46 +0100 Subject: [PATCH] refactor(client/functions): getting burst tyres of an vehicle in an better way --- [core]/es_extended/client/functions.lua | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index bb545f4e..c6cf706f 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -576,21 +576,15 @@ function ESX.Game.GetVehicleProperties(vehicle) end local doorsBroken, windowsBroken, tyreBurst = {}, {}, {} - local numWheels = tostring(GetVehicleNumberOfWheels(vehicle)) - local TyresIndex = { -- Wheel index list according to the number of vehicle wheels. - ["2"] = { 0, 4 }, -- Bike and cycle. - ["3"] = { 0, 1, 4, 5 }, -- Vehicle with 3 wheels (get for wheels because some 3 wheels vehicles have 2 wheels on front and one rear or the reverse). - ["4"] = { 0, 1, 4, 5 }, -- Vehicle with 4 wheels. - ["6"] = { 0, 1, 2, 3, 4, 5 }, -- Vehicle with 6 wheels. - } - if TyresIndex[numWheels] then - for _, idx in pairs(TyresIndex[numWheels]) do - tyreBurst[tostring(idx)] = IsVehicleTyreBurst(vehicle, idx, false) - end + local wheel_count = GetVehicleNumberOfWheels(vehicle); + + for wheel_index = 0, wheel_count - 1 do + tyreBurst[tostring(wheel_index)] = IsVehicleTyreBurst(vehicle, wheel_index, false) end + for windowId = 0, 7 do -- 13 RollUpWindow(vehicle, windowId) --fix when you put the car away with the window down windowsBroken[tostring(windowId)] = not IsVehicleWindowIntact(vehicle, windowId)