From X-Plane SDK
XPLM_API void XPLMCountAircraft( int * outTotalAircraft, int * outActiveAircraft, XPLMPluginID * outController);This function returns the number of aircraft X-Plane is capable of having, as well as the number of aircraft that are currently active. These numbers count the user's aircraft. It can also return the plugin that is currently controlling aircraft. In X-Plane 7, this routine reflects the number of aircraft the user has enabled in the rendering options window.