From 4c70dbe64d5d40e21ea0c57aa111822a6034358f Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Mon, 31 Jan 2022 23:44:48 +1100 Subject: [PATCH] feat(exports/entities): persistent window state (smashed/intact) --- .../entities/client/vehicleproperties.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/resource/entities/client/vehicleproperties.lua b/resource/entities/client/vehicleproperties.lua index 0ad5aab..72a6d13 100644 --- a/resource/entities/client/vehicleproperties.lua +++ b/resource/entities/client/vehicleproperties.lua @@ -109,6 +109,16 @@ function lib.getVehicleProperties(vehicle) modDoorR = GetVehicleMod(vehicle, 47), modLivery = modLivery, modLightbar = GetVehicleMod(vehicle, 49), + windows = { + IsVehicleWindowIntact(vehicle, 0), + IsVehicleWindowIntact(vehicle, 1), + IsVehicleWindowIntact(vehicle, 2), + IsVehicleWindowIntact(vehicle, 3), + IsVehicleWindowIntact(vehicle, 4), + IsVehicleWindowIntact(vehicle, 5), + IsVehicleWindowIntact(vehicle, 6), + IsVehicleWindowIntact(vehicle, 7), + } } end end @@ -121,6 +131,7 @@ function lib.setVehicleProperties(vehicle, props) local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle) SetVehicleModKit(vehicle, 0) + SetVehicleAutoRepairDisabled(vehicle, true) if props.plate then SetVehicleNumberPlateText(vehicle, props.plate) @@ -202,6 +213,14 @@ function lib.setVehicleProperties(vehicle, props) end end + if props.windows then + for i = 1, #props.windows do + if props.windows[i] then + SmashVehicleWindow(vehicle, i - 1) + end + end + end + if props.neonColor then SetVehicleNeonLightsColour(vehicle, props.neonColor[1], props.neonColor[2], props.neonColor[3]) end