Skip to content

Commit

Permalink
fix(modules/lib): delete vehicle spawned if no owner found within tim…
Browse files Browse the repository at this point in the history
…eout
  • Loading branch information
Manason committed Jul 4, 2024
1 parent 7091ae2 commit 031ce45
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit 031ce45

Please sign in to comment.