From c8db003cbce45862cb503cfae429c7d7dba5f0b3 Mon Sep 17 00:00:00 2001 From: Angelo Rodrigues De Morais Barroso <115129101+Angelo90810@users.noreply.github.com> Date: Mon, 19 Jan 2026 19:46:37 -0300 Subject: [PATCH] Add lockState support to vehicle properties (#83) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hello, I’d like to propose a small improvement to vehicle properties handling. This change adds support for the vehicle door lock state (lockState) by: - Including lockState in the VehicleProperties type - Reading the value using GetVehicleDoorLockStatus in getVehicleProperties - Applying the value using SetVehicleDoorsLocked in setVehicleProperties This allows vehicle lock status to be properly saved and restored alongside other vehicle properties. Let me know if this fits the project direction or if any adjustments are needed. This allows the vehicle lock status to be properly saved and restored alongside other vehicle properties. Note: Two additional commits and pull requests were accidentally opened during this process and have already been closed. Sorry for the noise. Thank you! Signed-off-by: Angelo Rodrigues De Morais Barroso <115129101+Angelo90810@users.noreply.github.com> --- resource/vehicleProperties/client.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resource/vehicleProperties/client.lua b/resource/vehicleProperties/client.lua index 3207789..1138039 100644 --- a/resource/vehicleProperties/client.lua +++ b/resource/vehicleProperties/client.lua @@ -12,6 +12,7 @@ if cache.game == 'redm' then return end ---@field model? number ---@field plate? string ---@field plateIndex? number +---@field lockState? number ---@field bodyHealth? number ---@field engineHealth? number ---@field tankHealth? number @@ -202,6 +203,7 @@ function lib.getVehicleProperties(vehicle) model = GetEntityModel(vehicle), plate = GetVehicleNumberPlateText(vehicle), plateIndex = GetVehicleNumberPlateTextIndex(vehicle), + lockState = GetVehicleDoorLockStatus(vehicle), bodyHealth = math.floor(GetVehicleBodyHealth(vehicle) + 0.5), engineHealth = math.floor(GetVehicleEngineHealth(vehicle) + 0.5), tankHealth = math.floor(GetVehiclePetrolTankHealth(vehicle) + 0.5), @@ -322,6 +324,10 @@ function lib.setVehicleProperties(vehicle, props, fixVehicle) SetVehicleNumberPlateTextIndex(vehicle, props.plateIndex) end + if props.lockState ~= nil then + SetVehicleDoorsLocked(vehicle, props.lockState) + end + if props.bodyHealth then SetVehicleBodyHealth(vehicle, props.bodyHealth + 0.0) end