Just build something in the MCI package where you check if the current node is 53. Then send the /spec command with the corresponding username.
InSim insim = new InSim();
// Bind Received Packets to your methods.
// <IS_XXX> is the name of the packet, (XXX_Handler) is the method that is executed everytime a IS_XXX packet is received.
insim.Bind<IS_MCI>(MCI_Handler);
// Connect InSim (read about IS_ISI in InSim.txt doc for more info)
insim.Initialize(new InSimSettings {Host = "127.0.0.1", Port = 29999, IName = "InSimName", Flags = InSimFlags.ISF_MCI, Interval = 500});
// Method that is executed everytime a MCI packet is received.
// (Read InSim.txt doc to understand what is contained inside InSim Packets and hence how to handle them).
void MCI_Handler(InSim insim_var, IS_MCI MCI)
{
for (int n = 0; n < MCI.NumC; n++)
{
if (MCI.Info[n].Node == 53)
{
// Retrieve the Username of the player which has "MCI.Info[n].PLID" as current PlayerID...
// Pitlane him...
insim.Send("/pitlane " + Username);
}
}
}
void MCI_Handler(Packets.IS_MCI MCI)
{
for (int n = 0; n < MCI.NumC; n++)
{
if (MCI.Info[n].Node == 56)
{
// Retrieve the Username of the player which has "MCI.Info[n].PLID" as current PlayerID...
// Pitlane him...
foreach (clsConnection Conn in Connections)
InSim.Send_MST_Message("/pitlane " + Conn.Username);
}
}
}
<?php
foreach (clsConnection Conn in Connections) {
InSim.Send_MST_Message("/pitlane " + Conn.Username);
}
?>
// Retrieve the Username of the player...
foreach (clsConnnection Conn in Connections)
{
if (Conn.PlayerID == MCI.Info[n].PLID)
{
insim.Send("/pitlane " + Conn.Username);
}
}
static void NewPlayer(InSim insim, IS_NPL npl)
{
if (players.ContainsKey(npl.PLID)) // Adding players to players dict
{
// Player leaving pits, just updating NPL object
players[npl.PLID] = npl;
Console.WriteLine(npl.PName + " PLID updated");
}
else
{
// Add new player.
players.Add(npl.PLID, npl);
Console.WriteLine(npl.PName + " added");
}
}
static void PlayerLeft(InSim insim, IS_PLL pll)
{
// Remove player.
players.Remove(pll.PLID);
Console.WriteLine("Player removed: player left the track");
}
static void PlayerLeft(InSim insim, IS_PLL pll)
{
IS_NPL player = players[pll.PLID];
// Remove player.
players.Remove(pll.PLID);
Console.WriteLine(player.PName + "Player removed: player left the track");
}
int r = new Random().Next(1, 10);
if (r < 5) { // do something }