Code to read out Best Lap time
=============================
Step by Step:
=============================
Step by Step:
1. Fill in the private void:
RES_RaceOrQualifyingResult(Packets.IS_RES RES)
{
}
2. Add position "finder".
Till up to ResultNum == 31.
RES_RaceOrQualifyingResult(Packets.IS_RES RES)
{
if (RES.ResultNum == 0) // 0=1, 1=2 .....
{
}
}
3. Add some code to display the Informations.
You must remove ButtonID to the ID.
RES_RaceOrQualifyingResult(Packets.IS_RES RES)
{
if (RES.ResultNum == 0) // 0=1, 1=2 .....
{
//Convert ms to Minutes:Seconds:Milliseconds
TimeSpan bestLap = TimeSpan.FromMilliseconds(RES.BTime);
string bestLapStr = string.Format("{0}:{1:00}.{2:000}", bestLap.Minutes, bestLap.Seconds, bestLap.Milliseconds);
//Buttons to display the Informations.
InSim.Send_BTN_CreateButton("^7[COLOR=Red]*[/COLOR]", Flags.ButtonStyles.ISB_DARK | Flags.ButtonStyles.ISB_LEFT, 4, 5, 25, 10, 37, 255, 1, false);
InSim.Send_BTN_CreateButton(RES.PName, Flags.ButtonStyles.ISB_DARK | Flags.ButtonStyles.ISB_LEFT, 4, 20, 25, 15, 38, 255, 1, false);
InSim.Send_BTN_CreateButton("^7"+bestLapStr, Flags.ButtonStyles.ISB_DARK | Flags.ButtonStyles.ISB_LEFT, 4, 10, 25, 40, 40, 255, 1, false);
}
}
4. Fill in into your InSim Application.
*WARNING*
* = Needs to be removed to each result number.
THIS IS JUST A PICE OF THE WHOLE CODE! BE HAPPY IF IT WORKS WHEN YOU "COPY|PASTE" IT OTHERWISE TRY TO GET IT WORKING
Thanks to:
DarkTimes = Remember me on TimeSpan method.
Dougie-Lampkin = Gave me Tipps.
Marco1 = Seting up a Server and tested code stuff.
Support at:
- [MSN] [email protected]
- [ICQ] 355863550
- [PN] Private Message
- [E-Mail] [email protected]