fix: checking for driver in spawned vehicle

This commit is contained in:
Andyyy7666
2023-12-23 00:00:45 +01:00
parent 7fe7901a13
commit a60e1b9e32

View File

@@ -576,7 +576,15 @@ AddEventHandler("entityCreated", function(entity)
local state = Entity(entity).state
if state.owner or state.locked ~= nil then return end
time = os.time()
local driver = GetPedInVehicleSeat(entity, -1)
while DoesEntityExist(entity) and driver == 0 and os.time()-time < 2 do
driver = GetPedInVehicleSeat(entity, -1)
Wait(100)
end
if not DoesEntityExist(entity) then return end
if DoesEntityExist(driver) and IsPedAPlayer(driver) then
state.locked = false
state.hotwired = true