private void RemoveTempBanCommand(PlayerSession session, string command, string[] args) { if (permission.UserHasPermission(session.SteamId.ToString(), "admintools.tempban") || permission.UserHasPermission(session.SteamId.ToString(), "admintools.all") || session.IsAdmin) { if (args.Length == 1) { TBA PlayerBanned = CheckBan(args[0]) as TBA; if (PlayerBanned != null) { hurt.SendChatMessage(session, null, Msg("isnolongertempbanned", session.SteamId.ToString()).Replace("{Name}", PlayerBanned.Name)); TempBans.Remove(PlayerBanned); if ((bool)Config["ShowConsoleMsg"]) { Puts(session.Identity.Name + " removed the TempBan on " + PlayerBanned.Name); } } else { hurt.SendChatMessage(session, null, Msg("isnttempbanned", session.SteamId.ToString()).Replace("{Name}", PlayerBanned.Name)); } } else { hurt.SendChatMessage(session, null, Msg("tempremovefail", session.SteamId.ToString())); } } else { hurt.SendChatMessage(session, null, Msg("nopermission", session.SteamId.ToString())); } }
private void TempBanCommand(PlayerSession session, string command, string[] args) { if (permission.UserHasPermission(session.SteamId.ToString(), "admintools.tempban") || permission.UserHasPermission(session.SteamId.ToString(), "admintools.all") || session.IsAdmin) { if (args.Length != 2) { hurt.SendChatMessage(session, null, Msg("tempbanfail", session.SteamId.ToString())); return; } TBA PlayerBanned = CheckBan(args[0]) as TBA; if (PlayerBanned != null) { TempBans.Remove(PlayerBanned); } DateTime CurrentTime = DateTime.UtcNow; PlayerSession person = GetSession(args[0]); if (person == null) { hurt.SendChatMessage(session, null, Msg("playernotfound", session.SteamId.ToString())); return; } double Duration; try { Duration = Convert.ToDouble(args[1]); } catch { hurt.SendChatMessage(session, null, Msg("tempbanfail", session.SteamId.ToString())); return; } hurt.BroadcastChat(null, Msg("tempbanned", session.SteamId.ToString()).Replace("{Player}", person.Identity.Name).Replace("{Duration}", Duration.ToString())); TempBans.Add(new TBA(person.SteamId.ToString(), person.Identity.Name, person.Player.ipAddress, CurrentTime.AddMinutes(Duration))); SaveTempBans(); person.IPlayer.Kick(Msg("tempbanmsg", session.SteamId.ToString()).Replace("{Duration}", Duration.ToString())); if ((bool)Config["ShowConsoleMsg"]) { Puts(session.Identity.Name + " TempBanned " + person.Identity.Name + " for " + Duration); } if ((bool)Config["LogTempBans"]) { globallog.Add("[" + DateTime.Now + "] " + session.Identity.Name + " (" + session.SteamId + ") TempBANNED " + person.Identity.Name + " (" + person.SteamId + ") for " + Duration); SaveGlobalLog(); } } else { hurt.SendChatMessage(session, null, Msg("nopermission", session.SteamId.ToString())); } }
private void CanClientLogin(PlayerSession session) { TBA Joiner = CheckBanJoin(session.Player.ipAddress, session.Identity.Name, session.SteamId.ToString()) as TBA; if (Joiner != null) { DateTime CurrentTime = DateTime.UtcNow; if (Joiner.TillExpire < CurrentTime) { TempBans.Remove(Joiner); return; } string[] TidyTime = Joiner.TillExpire.Subtract(CurrentTime).ToString().Split('.'); GameManager.Instance.KickPlayer(session.SteamId.ToString(), Msg("tempbanmsg", session.SteamId.ToString().Replace("{Duration} minutes.", TidyTime[0]))); } }
private void CheckTempBanCommand(PlayerSession session, string command, string[] args) { if (permission.UserHasPermission(session.SteamId.ToString(), "admintools.tempban") || permission.UserHasPermission(session.SteamId.ToString(), "admintools.all") || session.IsAdmin) { if (args.Length == 1) { DateTime CurrentTime = DateTime.UtcNow; TBA PlayerBanned = CheckBan(args[0]) as TBA; if (PlayerBanned != null) { string[] TidyTime = PlayerBanned.TillExpire.Subtract(CurrentTime).ToString().Split('.'); if (PlayerBanned.TillExpire < CurrentTime) { hurt.SendChatMessage(session, null, Msg("isnolongertempbanned", session.SteamId.ToString()).Replace("{Name}", PlayerBanned.Name)); TempBans.Remove(PlayerBanned); SaveTempBans(); } else { hurt.SendChatMessage(session, null, Msg("istempbanned", session.SteamId.ToString()).Replace("{Name}", PlayerBanned.Name).Replace("{Duration}", TidyTime[0])); } } else { hurt.SendChatMessage(session, null, Msg("isnttempbanned", session.SteamId.ToString()).Replace("{Name}", PlayerBanned.Name)); } } else { hurt.SendChatMessage(session, null, Msg("tempcheckfail", session.SteamId.ToString())); } } else { hurt.SendChatMessage(session, null, Msg("nopermission", session.SteamId.ToString())); } }