Jump to content
The simFlight Network Forums

Recommended Posts

Posted

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
                FSUIPCConnection.Process();



            }

 

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!!

 

Posted

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.

 

Cheers

 

 

Posted

Sorry, I am not really sure what I am supposed to be checking for. I have used the exact same offsets which Paul posted on here before.

 

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.