void OnLeave(LeaveEventArgs e) { lock (this) { Player plr = players[e.Who]; if (TShock.Players[e.Who] == null || plr == null) { return; } if (!TShock.Players[e.Who].IsLoggedIn) { players[e.Who] = null; return; } if (StatDB.PlayerExists(plr.Name)) { StatDB.UpdatePlayer(plr); } else { StatDB.AddPlayer(plr); } players[e.Who] = null; } }
void UpdateTimerTick(object sender, ElapsedEventArgs e) { foreach (Player player in players) { if (player != null && TShock.Players[player.Index] != null && TShock.Players[player.Index].IsLoggedIn) { if (StatDB.PlayerExists(player.Name)) { StatDB.UpdatePlayer(player); } else { StatDB.AddPlayer(player); } } } }