void ConnectionLeave(InSim insim, IS_CNL CNL) { try { _connections.Remove(CNL.UCID); if (ConnectedToSQL) { try { SqlInfo.UpdateUser(_connections[CNL.UCID].UName, StringHelper.StripColors(_connections[CNL.UCID].PName), _connections[CNL.UCID].TotalDistance, _connections[CNL.UCID].points); } catch (Exception EX) { if (!SqlInfo.IsConnectionStillAlive()) { ConnectedToSQL = false; SQLReconnectTimer.Start(); } else { LogTextToFile("error", "CNL - Exception: " + EX, false); } } } } catch (Exception e) { LogTextToFile("error", "CNL - Exception: " + e, false); } }
public static void CNL(InSim insim, IS_CNL CNL) { try { Connections._connections.Remove(CNL.UCID); } catch (InSimException IEx) { Logger.Error(IEx.Message, Logger.Types.CNL); } }
// Player left the server void ConnectionLeave(InSim insim, IS_CNL CNL) { try { string nocolplyname = StringHelper.StripColors(_connections[CNL.UCID].PName); LogTextToFile("connections", _connections[CNL.UCID].PName + " (" + _connections[CNL.UCID].UName + ") Disconnected", false); // Save values of user - CNL (on disconnect) if (ConnectedToSQL) { try { SqlInfo.UpdateUser(_connections[CNL.UCID].UName, true); SqlInfo.UpdateUser(_connections[CNL.UCID].UName, false, _connections[CNL.UCID].cash, _connections[CNL.UCID].bankbalance, _connections[CNL.UCID].TotalDistance, _connections[CNL.UCID].cars, _connections[CNL.UCID].totaljobsdone, _connections[CNL.UCID].totalearnedfromjobs); } catch (Exception EX) { if (!SqlInfo.IsConnectionStillAlive()) { ConnectedToSQL = false; SQLReconnectTimer.Start(); } else { var conn = _connections[CNL.UCID]; LogTextToFile("error", "[" + conn.UCID + "] " + StringHelper.StripColors(conn.PName) + "(" + _connections[CNL.UCID].UName + ") NPL - Exception: " + EX.Message, false); } } } _connections.Remove(CNL.UCID); } catch (Exception e) { var conn = _players[CNL.UCID]; conn.NoColPlayername = StringHelper.StripColors(conn.PName); LogTextToFile("error", "[" + conn.UCID + "] " + conn.NoColPlayername + "(" + _connections[CNL.UCID].UName + ") CNL - Exception: " + e, false); } }
private void Disconnected(InSim insim, IS_CNL cpr) { Console.WriteLine("IS_CNL pack received"); players.Delete(cpr.UCID); }