Hello everyone, i need assistance with my program. With this code i can add players to the dictionary and write the name in the console. I cant figure out how to write to console player name when player leaves the track. Its been a long time since i did any programming, so excuse me if this is a really simple solution.
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");
}