XPLMSetUsersAircraft

From X-Plane SDK
Jump to: navigation, search

XPLMSetUsersAircraft

XPLM_API void                 XPLMSetUsersAircraft(
                                   const char *         inAircraftPath);    
This routine changes the user's aircraft. Note that this will reinitialize the user to be on the nearest airport's first runway. Pass in a full path (hard drive and everything including the .acf extension) to the .acf file.

Since the full path of the sim is represented in CFM/HFS format on OS X (for legacy reasons), it is best to use XPLMGetSystemPath to prefix your call. This code loads the default 747.

char	buf[1024]; /* dangerous, could overrun */
XPLMGetSystemPath(buf);		
strcat(buf, "Aircraft");
strcat(buf, XPLMGetDirectorySeparator());
strcat(buf, "Heavy Metal");
strcat(buf, XPLMGetDirectorySeparator());
strcat(buf, "B747-400 United");
strcat(buf, XPLMGetDirectorySeparator());
strcat(buf, "United-Air.acf");
XPLMSetUsersAircraft(buf);