private void attach_towplane() { try { if (towplaneid == uint.MaxValue) { towplaneid = uint.Parse(lbx_planes_towPlane.SelectedItem.ToString().Split(':')[0]); } if (playerid == uint.MaxValue) { playerid = uint.Parse(lbx_planes_attachTo.SelectedItem.ToString().Split(':')[0]); } } catch {; } if (towplaneid != uint.MaxValue && playerid != uint.MaxValue) { simconnect.AIReleaseControl(towplaneid, DATA_REQUESTS.REQUEST_PLANE_LIST); simconnect.RequestDataOnSimObject(DATA_REQUESTS.REQUEST_PLAYER_UPDATE_AND_ATTACH, DEFINITIONS.AirplaneData, playerid, SIMCONNECT_PERIOD.ONCE, 0, 0, 1, 0); attachTick.Interval = 6; attachTick.Start(); button3.Text = "Release towplane from player"; isAttached = true; } }
public static void DisableAI(int requestId) { simConnect.AIReleaseControl(SimConnect.SIMCONNECT_OBJECT_ID_USER, (SIMVARDEFINITION)requestId); }