Thanks for helping me out again Acecool. I’ve tried to make it but I’m a little stuck, I’m not sure how to get the actual vehicle’s ID to check the health of. Here is what I have so far:
Spawn.DoClick = function()
local TimerName = ""..tostring(LocalPlayer():UniqueID())..""..tostring(math.random(1, 100)).."" //Added random number just incase player has more than one aircraft spawned (bad way to do it, I know, feel free to give a tip on this if you like)
timer.Create(TimerName, 30, 0, function CheckHealth(players vehicle id?, TimerName) end)
function CheckHealth(ID, Timer)
local _nwHealth = ID:GetNWFloat( "health", 100 );
local _bDisabled = ID.disabled;
if ( ( _nwHealth && _nwHealth <= 0 ) || _bDisabled ) then
// Safely remove entity if its out of hp...
timer.Remove(Timer) //I'm guessing this is how I'm supposed to remove the timer, wiki page is blank...
local Vehicle = ents.Create( "wac_hc_littlebird_h500" );
if ( !IsValid( Vehicle ) ) then return; end
Vehicle:SetPos(Vector(4607, 0, -8575));
Vehicle:SetAngles(Angle(0, 90, 0));
ply:PrintMessage(3, "Your aircraft is on the helipad!")
As you can see I’ve sort of got this mapped out but its not quite there, so if you wouldn’t mind helping me a little more I would really appreciate it!