fix(client/vehicle): locking issues

This commit is contained in:
Andyyy7666
2023-09-24 04:46:24 +02:00
parent 7a97816570
commit ae7f0dc0d8

View File

@@ -318,8 +318,7 @@ local dontLock = {
AddStateBagChangeHandler("locked", nil, function(bagName, key, value, reserved, replicated)
local entity = GetEntityFromStateBagName(bagName)
if entity == 0 then return end
if dontLock[GetVehicleClass(entity)] then return end
if entity == 0 or value == nil or dontLock[GetVehicleClass(entity)] then return end
if value then
-- SetVehicleDoorsLockedForAllPlayers(entity, true)
@@ -330,7 +329,6 @@ AddStateBagChangeHandler("locked", nil, function(bagName, key, value, reserved,
while GetVehiclePedIsEntering(cache.ped) == entity do Wait(10) end
-- SetVehicleDoorsLockedForAllPlayers(entity, false)
if value == nil then return end
SetVehicleDoorsLocked(entity, 0)
end)
end)
@@ -403,7 +401,7 @@ local function getNearestVehicle(hasKeysForOnly)
local function setNearestVehicle(veh)
if hasKeysForOnly and not hasVehicleKeys(veh.vehicle) then return end
local nearestDist = nearestVeh.dist
local dist = #(GetEntityCoords(cache.ped)-veh.coords)
local dist = #(coords-veh.coords)
if not nearestDist or dist < nearestDist then
nearestVeh.dist = dist
nearestVeh.coords = veh.coords