The online racing simulator
IS_CON - InSim.NET
(13 posts, started )
IS_CON - InSim.NET
Hello!,

Kay decided to switch from Lfs_External to InSim.NET. Best choice i've ever made Alright let me get to my point :P

Inserted the Contact packet and started to code some shitznee :

static void CarContact(InSim insim, IS_CON con)
{
//Conn1 = con.A.PLID;
//Conn2 = con.B.PLID;
double speed = MathHelper.MpsToKph((con.SpClose & 0x00ff) * 0.1);

if (con.A.Speed > con.B.Speed)
{
insim.Send("/msg " + con.A.PLID + " ^2hit " + con.B.PLID);
}

insim.Send("/msg ^2Contact detected!");
}

Problem is if i hit someone it doesn't actually well work...

Any ideas?

PS : New to InSim.NET don't get shit read the document already over and over again nothing that can actually help me :P Im suprised i can actually get the insim connected :P

Thanks alot!

Yoran
Looks weird to me, try send the message first and the rest code later in case of an error. Also you can use the breakpoint and check if in contact it gets called.
Basiclly what i have now is this :

static void CarContact(InSim insim, IS_CON con)
{

insim.Send("/msg ^2Contact Detected!");
double speed = MathHelper.MpsToKph((con.SpClose & 0x00ff) * 0.1);

if (con.A.Speed > con.B.Speed)
{
insim.Send("/msg " + con.A.PLID + " ^2hit " + con.B.PLID);
}

}

But its still not sending "Contact Detected!"

Not sure if i've done something wrong...

Thanks,
Yoran
Did you specify the ISF_CON flag in the InSimSettings?
EDIT :

Got it to work but when i hit someone it shows 1 hit 3...
Not sure how but it is since i cant get PlayerName out of con.A/B
Quote from MadCatX :Did you specify the ISF_CON flag in the InSimSettings?

I guess that was. I had totally forgot about it.

Quote from yoran765 :EDIT :

Got it to work but when i hit someone it shows 1 hit 3...
Not sure how but it is since i cant get PlayerName out of con.A/B

You need to store a Player's and Connection's values making a List and then access them. You can always take a look at my example i have made long time ago.

https://www.lfsforum.net/showt ... php?p=1651859#post1651859
Thanks mate!

Just what i needed!

Thanks for all the support and help!

Yoran
Decided to use your example DK I hope i can actually use it :P But will put your name on the Rights

Alright so basiclly i've added the Packet IS_CON no errors. Then i've added the flag ISF_CON still no errors. When i actually crash someone it says : There was a packet-error : The given key was not present in the dictionary. Not sure what this means but its not working out.

Any help?

Thanks!
Yoran
Try to debug it using the breakpoint and check what 'key' is actually the wrong one.
Not sure what you just said there could you maybe explain abit better? :P Thanks
Just noticed what i did wrong the _connections[CON.A.PLID].PName gives me the error pretty wierd :s Anyway i can still get Player Names through Contact?

Thanks!

Yoran
Just found out myself It was _players not _connections

Thanks too you two for all the help and support!

Thanks!

Yoran

IS_CON - InSim.NET
(13 posts, started )
FGED GREDG RDFGDR GSFDG