[EDIT]: I don't want to promote TC server, I remember only this server
Hello everyone!
I won't post all code because is useless.
My problem is when someone disconnect or anything else, the program sometimes save info as I want and sometimes doesn't work.
When it works, the written line is: [TC] Cruise Server, S2 server, 20.01.2023 - 14:37
and when doesn't work, the written line is just: ^7, ^6 server^7, 20.01.2023 - 14:37
So sometimes my program doesn't write host name and game version
Hello everyone!
I won't post all code because is useless.
My problem is when someone disconnect or anything else, the program sometimes save info as I want and sometimes doesn't work.
When it works, the written line is: [TC] Cruise Server, S2 server, 20.01.2023 - 14:37
and when doesn't work, the written line is just: ^7, ^6 server^7, 20.01.2023 - 14:37
So sometimes my program doesn't write host name and game version
public string Database = @"Database";
public string Players = @"Players";
public string HostName;
public string GameVersion;
private void ClientLeavesHost(InSim insim_var, IS_CNL CNL)
{
try
{
clsConnection Conn = Connections[GetConnIdx(CNL.UCID)];
switch (CNL.Reason)
{
case "LEAVR_KICKED": // User Kicked
case "LEAVR_BANNED": // User Banned
case "LEAVR_CPW": // Cheat protection wrong.
case "LEAVR_LOSTCONN": // Lost Connection
case "LEAVR_TIMEOUT": // Timed out
case "LEAVR_DISCO": // Disconnected
case "LEAVR_SECURITY": // Out-of-sync (OOS) or cheat protection
case "LEAVR_OOS": // Out of sync with host
case "LEAVR_JOOS": // Join OOS (initial sync failed)
case "LEAVR_HACK": // Invalid packet
StreamWriter Sw = new StreamWriter(Database + "\\" + Players + "\\" + Conn.Username + ".txt");
Sw.WriteLine(Conn.HostName + "^7, ^6" + Conn.GameVersion + " server^7, " + System.DateTime.Now.ToString("dd/MM/yyyy - HH:mm"));
Sw.Flush();
Sw.Close();
break;
}
}
catch(Exception ex)
{
insim.Send(new IS_MSL { Msg = "^1CNL - " + ex.Message});
}
}
private void InSimVersion(InSim insim_var, IS_VER VER)
{
try
{
foreach (clsConnection Conn in Connections)
{
Conn.GameVersion = VER.Product.ToString();
}
catch(Exception ex)
{
insim.Send(new IS_MSL { Msg = "^1VER - " + ex.Message});
}
}