When you store a motorcycle, it gives an error on the client side F8 which is the following ‘Script Error: citizen:/scripting/lua/scheduler.lua:739: Script Error: @qb-garages/client/main-lua:189: bad argument #1 to ‘for iterator’ (table expected, got nil)’. While investigating, I discovered that the error comes from the fact that motorcycles do not have windows. The solution I made was the following
local function doCarDamage(currentVehicle, stats, props)
local engine = stats.engine + 0.0
local body = stats.body + 0.0
if not next(props) then return end
if IsPedOnAnyBike(PlayerPedId()) then
for k, v in pairs(props.doorStatus) do
if v then SetVehicleDoorBroken(currentVehicle, tonumber(k), true) end
end
for k, v in pairs(props.tireBurstState) do
if v then SetVehicleTyreBurst(currentVehicle, tonumber(k), true) end
end
for k, v in pairs(props.windowStatus) do
if not v then SmashVehicleWindow(currentVehicle, tonumber(k)) end
end
end
SetVehicleEngineHealth(currentVehicle, engine)
SetVehicleBodyHealth(currentVehicle, body)
end
I would like you to check and give an official fix, thank you
When you store a motorcycle, it gives an error on the client side F8 which is the following ‘Script Error: citizen:/scripting/lua/scheduler.lua:739: Script Error: @qb-garages/client/main-lua:189: bad argument #1 to ‘for iterator’ (table expected, got nil)’. While investigating, I discovered that the error comes from the fact that motorcycles do not have windows. The solution I made was the following
local function doCarDamage(currentVehicle, stats, props) local engine = stats.engine + 0.0 local body = stats.body + 0.0 if not next(props) then return end if IsPedOnAnyBike(PlayerPedId()) then for k, v in pairs(props.doorStatus) do if v then SetVehicleDoorBroken(currentVehicle, tonumber(k), true) end end for k, v in pairs(props.tireBurstState) do if v then SetVehicleTyreBurst(currentVehicle, tonumber(k), true) end end for k, v in pairs(props.windowStatus) do if not v then SmashVehicleWindow(currentVehicle, tonumber(k)) end end end SetVehicleEngineHealth(currentVehicle, engine) SetVehicleBodyHealth(currentVehicle, body) end
I would like you to check and give an official fix, thank you