Jump to content
The simFlight Network Forums

Deleting an AI Aircraft, but stubborn AI won't dissapear!

Recommended Posts

Hi guys


Trying to delete AI Traffic through FSUIPC using C#. Have successfully got it to list all of the AI. I am just having problems deleting it.

Using the code Paul gave here: http://forum.simflight.com/topic/79906-send-control-to-a-simobject/

But in my case, traffic do not seem to go away.

The Offsets I am declaring:

 private Offset<int> id = new Offset<int>(0x2904);

 private Offset<int> ctrl = new Offset<int>(0x2908);

 private Offset<int> val = new Offset<int>(0x2900);

 private AITrafficServices AI;

The code (this should remove each AI plane - but it does not). I know it isn't the foreach which is the problem because I can get it to list all of the AI just fine (I removed that here to avoid confusion)

foreach (AIPlaneInfo plane in FSUIPCConnection.AITrafficServices.AllTraffic)

                id.Value = plane.ID;  
                ctrl.Value = 65535; // delete ai traffic
                val.Value = 1;   // Set to 1 for true



I think the problem might lie in either the plane.ID or sending the control - although it is the same code as what was suggested in the link above.



Many thanks for your help!!


Link to post
Share on other sites

Hey Thomas

Thanks for the reply.

Should I get and use the ID from which my code pulls or the one in Trafficlook? For example, one AI in traffic look has the ID of 38, but in my code it is -38. In my code I am using the -38 one (all of mine are negative, but Trafficlooks are positive).

The FS Control is 65535, which in the published offsets is for deleting the AI aircraft.

I am not too sure on the Parameter, but setting it to 1 for true, seems logical?

I presume I am writing the controls correctly??

I also tried just using '38' and '-38' in the ID value, instead of plane.ID. This did not work either.





Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.