Skip to content

Commit

Permalink
Check for prop existence
Browse files Browse the repository at this point in the history
  • Loading branch information
GhzGarage committed Nov 15, 2023
1 parent d49dd82 commit bfd040c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,24 @@ end
local function doCarDamage(currentVehicle, stats, props)
local engine = stats.engine + 0.0
local body = stats.body + 0.0
SetVehicleEngineHealth(currentVehicle, engine)
SetVehicleBodyHealth(currentVehicle, body)
if not next(props) then return end
for k, v in pairs(props.doorStatus) do
if v then SetVehicleDoorBroken(currentVehicle, tonumber(k), true) end
if props.doorStatus then
for k, v in pairs(props.doorStatus) do
if v then SetVehicleDoorBroken(currentVehicle, tonumber(k), true) end
end
end
for k, v in pairs(props.tireBurstState) do
if v then SetVehicleTyreBurst(currentVehicle, tonumber(k), true) end
if props.tireBurstState then
for k, v in pairs(props.tireBurstState) do
if v then SetVehicleTyreBurst(currentVehicle, tonumber(k), true) end
end
end
for k, v in pairs(props.windowStatus) do
if not v then SmashVehicleWindow(currentVehicle, tonumber(k)) end
if props.windowStatus then
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

function GetSpawnPoint(garage)
Expand Down

0 comments on commit bfd040c

Please sign in to comment.