Need help with entity respawning

I have a vehicle (heli) and I want to respawn it every 30 minutes and if it has a player inside then don’t remove the entity. I can not seem to find a way to check if it contain a player or not, this is what I have been using so far and it works fine. I just need a method to check if it has a player inside:


function heli()
    heli = ents.Create("sent_helicopter_nonadmin")
    heli:SetPos( Vector( -6523.794922, -2548.979004, 99.388809 ) )
    heli:Spawn()
    timer.Create( "RemoveHeli", 59, 0, function() heli:Remove() end )
end
hook.Add("InitPostEntity", "heli", heli )
timer.Create( "Heli", 60, 0, heli )

So any help is appreciated Thanks.
(Also I know that timer is not 30 minutes, it’s for debugging.)

I went to the gmod wiki, and seached driver, and this came up.

[lua]
function SpawnHeli()
if IsValid(heli:GetDriver()) then return end

heli = ents.Create("sent_helicopter_nonadmin")
heli:SetPos( Vector( -6523.794922, -2548.979004, 99.388809 ) )
heli:Spawn()

timer.Create( "RemoveHeli", 59, 0, function() heli:Remove() end )

end

hook.Add(“InitPostEntity”, “heli”, SpawnHeli )
timer.Create( “Heli”, 60, 0, heli )
[/lua]

If heli:GetDriver() is valid then it will return the ply name. Elseif heli:GetDriver() is not valid it will return NULL.
Test it out and let me know if it workd.