mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-18 22:36:03 +01:00
fix(client/vehicle): locking issues
This commit is contained in:
@@ -318,8 +318,7 @@ local dontLock = {
|
|||||||
|
|
||||||
AddStateBagChangeHandler("locked", nil, function(bagName, key, value, reserved, replicated)
|
AddStateBagChangeHandler("locked", nil, function(bagName, key, value, reserved, replicated)
|
||||||
local entity = GetEntityFromStateBagName(bagName)
|
local entity = GetEntityFromStateBagName(bagName)
|
||||||
if entity == 0 then return end
|
if entity == 0 or value == nil or dontLock[GetVehicleClass(entity)] then return end
|
||||||
if dontLock[GetVehicleClass(entity)] then return end
|
|
||||||
|
|
||||||
if value then
|
if value then
|
||||||
-- SetVehicleDoorsLockedForAllPlayers(entity, true)
|
-- SetVehicleDoorsLockedForAllPlayers(entity, true)
|
||||||
@@ -330,7 +329,6 @@ AddStateBagChangeHandler("locked", nil, function(bagName, key, value, reserved,
|
|||||||
while GetVehiclePedIsEntering(cache.ped) == entity do Wait(10) end
|
while GetVehiclePedIsEntering(cache.ped) == entity do Wait(10) end
|
||||||
-- SetVehicleDoorsLockedForAllPlayers(entity, false)
|
-- SetVehicleDoorsLockedForAllPlayers(entity, false)
|
||||||
|
|
||||||
if value == nil then return end
|
|
||||||
SetVehicleDoorsLocked(entity, 0)
|
SetVehicleDoorsLocked(entity, 0)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
@@ -403,7 +401,7 @@ local function getNearestVehicle(hasKeysForOnly)
|
|||||||
local function setNearestVehicle(veh)
|
local function setNearestVehicle(veh)
|
||||||
if hasKeysForOnly and not hasVehicleKeys(veh.vehicle) then return end
|
if hasKeysForOnly and not hasVehicleKeys(veh.vehicle) then return end
|
||||||
local nearestDist = nearestVeh.dist
|
local nearestDist = nearestVeh.dist
|
||||||
local dist = #(GetEntityCoords(cache.ped)-veh.coords)
|
local dist = #(coords-veh.coords)
|
||||||
if not nearestDist or dist < nearestDist then
|
if not nearestDist or dist < nearestDist then
|
||||||
nearestVeh.dist = dist
|
nearestVeh.dist = dist
|
||||||
nearestVeh.coords = veh.coords
|
nearestVeh.coords = veh.coords
|
||||||
|
|||||||
Reference in New Issue
Block a user