mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-11-15 18:43:56 +00:00
fix: lock inconsistency on player spawned vehicles
This commit is contained in:
1 parent
24e8874050
commit
8b0f2b010d
1 file changed
+5
-1
+5
-1
@@ -567,8 +567,12 @@ RegisterNetEvent("ND_Vehicles:toggleVehicleLock", function(netId)
|
||||
end)
|
||||
|
||||
-- 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
|
||||
|
||||
local state = Entity(entity).state
|
||||
if state.owner or state.locked ~= nil then return end
|
||||
|
||||
|
||||
Reference in new issue
Block a user