The online racing simulator
but its learning by doing and smoetimes check some samples and see how it works ^^
a bit of a noob question but it has completely slipped my mind. the "PIT" packet which is a byte, could someone give me an example of an if for it, if someone has got a drive through penalty (number 1)
IS_PIT does contain a penalty, although its not live. IS_PEN does and sends it as the penaltys happens. It gets fired when someone gets a penalty. If you want to see if its Drive through penalty.

[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] (PEN.NewPen == [/SIZE][SIZE=2][COLOR=#2b91af]Enums[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#2b91af]Penalty[/COLOR][/SIZE][SIZE=2].PENALTY_DT)[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#008000] // Do something[/COLOR][/SIZE]
[SIZE=2]}[/SIZE]

That should work fine.
I dunno anything about LFS_External, but the IS_PIT packet does contain a penalty value...

struct IS_PIT // PIT stop (stop at pit garage)
{
byte Size; // 24
byte Type; // ISP_PIT
byte ReqI; // 0
byte PLID; // player's unique id

word LapsDone; // laps completed
word Flags; // player flags

byte Sp0;
byte [b]Penalty[/b]; // current penalty value (see below)
byte NumStops; // number of pit stops
byte Sp3;

byte Tyres[4]; // tyres changed

unsigned Work; // pit work
unsigned Spare;
};

Maybe LFS_E treats it differently though.
Oh Crap, I was thinking of IS_PLP...Sorry!!!


With that said, In order to catch a penalty as it happends, you will need to use IS_PEN.
thanks i've just figured out my self about int(integers), strings and decimals
ok i got that if in you posted mcgas and it works but i want to be able to make it so it says a message that says {username} was kicked for speeding in the pits but it just says the host's name, could you help me? thanks
Seen as the IS_PEN only contains the PLID you have to go into the players list for the playername or, into the players list then the connections list, something like...

[SIZE=2]
Connections[GetConnIdx(Players[GetPlyIdx(PEN.PLID)].UniqueID)].Username[/SIZE]

thanks mcgas, works like a charm
i wanted to make an if that finds out if the node is between 136 and 188

heres what i know
if (MCI.Info[0].Node >= 136 (cant remember what goes here) <= 188)

could you help me?
C# uses operators && (and) || (or)

So to check if they're between 136 and 188, use:

if ((MCI.Info[0].Node >= 136) && (MCI.Info[0].Node <= 188))

Hope that helps...
thanks
i have got some buttons saying the location of yourself coming up but they only come up on the first person out of the pits, unless they spectate then join again, how could i get around this? thianks
Quote from vane :i have got some buttons saying the location of yourself coming up but they only come up on the first person out of the pits, unless they spectate then join again, how could i get around this? thianks

Explain in more detail please, im a little confused..
If I understand correctly, the problem is that only MCI packet 1 is used. What you need to do is make a for loop, like so:

for (int i; i < Players.Count; i++)
{
// do whatever code here, replace 0 with i
}

Quote from dougie-lampkin :If I understand correctly, the problem is that only MCI packet 1 is used. What you need to do is make a for loop, like so:

for (int i; i < Players.Count; i++)
{
// do whatever code here, replace 0 with i
}


You must not use Players.Count because 1 MCI packet contains up to 8 players only. Lets say if there are 18 players, there will be sent 3 MCI packets in a row. The first packet holds player 1 to 8, the second packet holds player 9 to 16 and the 3rd packet holds the last 2 players. So you have to make some sort of counter to loop trough all the players.
Quote from T-RonX :So you have to make some sort of counter to loop trough all the players.

The NumC element of the IS_MCI contains the number of Compcar structs in a given MCI packet.

Keeping your own tracking is irrelevant and unreliable if you're using it to determine how many Compcar entries exist.
I think you need something like this: (Taken from LFSLapper[Thanks])


[SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=2] i = 0; i < System.[/SIZE][SIZE=2][COLOR=#2b91af]Math[/COLOR][/SIZE][SIZE=2].Min(8, Players.Count); i++)[/SIZE]
{
}

Quote from the_angry_angel :The NumC element of the IS_MCI contains the number of Compcar structs in a given MCI packet.

Keeping your own tracking is irrelevant and unreliable if you're using it to determine how many Compcar entries exist.

Yes you are right, I forgot about NumC. Thanks.
with the original code if two people left the pits the second person has the first persons MCI information like co-ordinates, could someone help me?
Still alot of work until the next release? (can't wait to try it out :nod
Thanks for this
I'm onto my first public project I think
2 years younger then sun and you can work better then him. That shows what putting some work into learning does. Well done Shaun
Thanks Sean
Correct me if I'm wrong, but is there no packet handler thingy for IS_REPLY? I've enabled it's event by uncommenting it, but I can't for the life of me work out how to set up the method
Attached images
IS.REPLY.jpg

FGED GREDG RDFGDR GSFDG