mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-17 05:56:01 +01:00
fix: lock inconsistency on player spawned vehicles
This commit is contained in:
@@ -567,8 +567,12 @@ RegisterNetEvent("ND_Vehicles:toggleVehicleLock", function(netId)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- locking of npc vehicles, if the players spawns inside a vehicle it won't be locked.
|
-- locking of npc vehicles, if the players spawns inside a vehicle it won't be locked.
|
||||||
RegisterNetEvent("entityCreated", function(entity)
|
AddEventHandler("entityCreated", function(entity)
|
||||||
|
local time = os.time()
|
||||||
|
while not DoesEntityExist(entity) and os.time()-time < 5 do Wait(50) end
|
||||||
|
|
||||||
if not DoesEntityExist(entity) or GetEntityType(entity) ~= 2 then return end
|
if not DoesEntityExist(entity) or GetEntityType(entity) ~= 2 then return end
|
||||||
|
|
||||||
local state = Entity(entity).state
|
local state = Entity(entity).state
|
||||||
if state.owner or state.locked ~= nil then return end
|
if state.owner or state.locked ~= nil then return end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user