// This function will locate the nearest airport and display it back to you.
// You can check for the nearest Airport within a specified distance as well.
Usage:
// Add this to compile the function in your init.sqf
ClosestAirport = compile (preprocessFileLineNumbers "findnearestairport.sqf");
// Use this to call the function
_Aportinfo = [player, 9000] call ClosestAirport;
Return:
%1 - Name of the town
%2 - Distance in Meter
%3 - Direction heading (north, south, etc)
Example of the return:
hint format ["The Closest Town is: %1, \n%2m to the %3",_Aportinfo select 0,_Aportinfo select 2, _Aportinfo select 1];
Edit:
Updated to return the closest town name as the airport name within 2KM.
If no town is around, the name is automatically called 'Remote', as in Remote Airstrip.
Meters is now rounded to KM.
Now should work on any island.
Let me know if there are any bugs.