From 031ce45c741ce0c91060cfc653dd6d42d218986b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Jul 2024 15:32:24 -0700 Subject: [PATCH] fix(modules/lib): delete vehicle spawned if no owner found within timeout --- modules/lib.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/lib.lua b/modules/lib.lua index 06cdf2185..056860e4b 100644 --- a/modules/lib.lua +++ b/modules/lib.lua @@ -267,7 +267,7 @@ if isServer then SetPedIntoVehicle(ped, veh, -1) end - lib.waitFor(function() + local foundOwner = lib.waitFor(function() local owner = NetworkGetEntityOwner(veh) if ped then --- the owner should be transferred to the driver @@ -277,6 +277,11 @@ if isServer then end end, 'client never set as owner', 5000) + if not foundOwner then + DeleteEntity(veh) + error('Deleting vehicle which timed out finding an owner') + end + local state = Entity(veh).state state:set('initVehicle', true, true)