Paul Henty Posted March 16, 2014 Report Posted March 16, 2014 Hi George, We have already discussed this back in January. What you are asking for is very complex code. It would take many days to write. All I can do in this forum is tell you how you might go about doing this. I can't write your code for you. In addition to Graham's help above, I can only repeat my advice from January: You would do something like this: 1. Find current player position 2. Work out the Lon, Lat coordinates of a box 5NM around the player 3. Select the airports from the database that have coordinates within this box You can use the FsLatLonPoint class in my DLL to help with getting the coordinates of the test box. See the UserGuide.pdf (Pages 16 & 17) for more details on this class. If you get more than 1 airport back you can measure the distance to each one and find the closest. You can use FsLatLonPoint for this also. Paul
A320_Pilot Posted April 22, 2014 Author Report Posted April 22, 2014 Where is my error? private void openFSUIPC() { //---------------------------------------------------------------------------------// try { //---------------------------------------------------------------------------------// //Ckeck parking brake //---------------------------------------------------------------------------------// if (PBrake.Value == 1) { MessageBox.Show(CLIENT_MSG18_RU, AUTH_ERR0_RU, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); FSUIPCConnection.Open(); this.startfl.Enabled = false; this.endfl.Enabled = true; this.timer1.Interval = 200; this.timer1.Enabled = true; this.connect_m.Text = (FSUIPC_MSG2_RU); } //---------------------------------------------------------------------------------// else //---------------------------------------------------------------------------------// { FSUIPCConnection.Close(); this.startfl.Enabled = true; this.endfl.Enabled = false; this.connect_m.Text = (FSUIPC_MSG1_RU); } //---------------------------------------------------------------------------------// } //---------------------------------------------------------------------------------// catch (Exception ex) { MessageBox.Show(ex.Message, FSUIPC_ERR0_RU, MessageBoxButtons.OK, MessageBoxIcon.Error); } //---------------------------------------------------------------------------------// }
Paul Henty Posted April 22, 2014 Report Posted April 22, 2014 What's the problem? Just from looking at the code, I think you'll probably want to disable the timer1 in the 'else' block. Also in the catch block I recommend you call FSUIPCConnection.Close() just to clean things up if the connection failed. Other than that, you need describe the problem you are having. Paul
A320_Pilot Posted April 22, 2014 Author Report Posted April 22, 2014 Why is it still does not connect with the simulator, the parking brake is on, but no result!
Paul Henty Posted April 22, 2014 Report Posted April 22, 2014 How can your program know the parking brakes are on if it hasn't yet connected to the simulator?
Paul Henty Posted April 23, 2014 Report Posted April 23, 2014 Sorry but this isn't making any sense to me. First you say: "Why is it still does not connect with the simulator" Then you say "Connection is open". The code you posted is trying to open the connection. How can your connection already be open? Paul
buick552 Posted February 7, 2017 Report Posted February 7, 2017 On 14.02.2014 at 7:33 PM, A320_Pilot said: private Offset<short> simrate = new Offset<short>(0x0C1A); Correct? I do it like this... Dim tSimrate As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&HC1A) If tSimrate.Value = 256 Then SimRate1 = True Else SimRate1 = False But be aware that, I just wanna know if the pilot is using x1 simrate or not, I don't care if he increases or decreases the sim rate, I just care if he flies normally or not!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now