Skip to content

Commit

Permalink
fix: allow vehicle to be locked/unlocked only if it has a lock
Browse files Browse the repository at this point in the history
  • Loading branch information
Manason committed Sep 23, 2024
1 parent a1f020f commit fdd6ecb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 0 additions & 3 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,6 @@ end

qbx.entityStateHandler('doorslockstate', function(entity, _, value)
if entity == 0 then return end
if getIsVehicleShared(entity) then
value = 1
end
SetVehicleDoorsLocked(entity, value)
end)

Expand Down
2 changes: 2 additions & 0 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local addPlayer = functions.addPlayer
local removePlayer = functions.removePlayer
local getIsVehicleAlwaysUnlocked = sharedFunctions.getIsVehicleAlwaysUnlocked
local getIsVehicleInitiallyLocked = sharedFunctions.getIsVehicleInitiallyLocked
local getIsVehicleShared = sharedFunctions.getIsVehicleShared

---@enum EntityType
local EntityType = {
Expand Down Expand Up @@ -39,6 +40,7 @@ end)
RegisterNetEvent('qb-vehiclekeys:server:setVehLockState', function(vehNetId, state)
local vehicleEntity = NetworkGetEntityFromNetworkId(vehNetId)
if type(state) ~= 'number' or not DoesEntityExist(vehicleEntity) then return end
if getIsVehicleAlwaysUnlocked(vehicleEntity) or getIsVehicleShared(vehicleEntity) then return end
Entity(vehicleEntity).state:set('doorslockstate', state, true)
end)

Expand Down

0 comments on commit fdd6ecb

Please sign in to comment.