zio fork 1.8.2b-zio3: ban reasons on join, @css/bypassipban, spectators keep hidden
Banned players are let in long enough to be told the ban's reason and time left, then kicked after KickTime, instead of only seeing "Your client is not allowed to join this server"; they can't chat, talk or join a team meanwhile. New permission @css/bypassipban (players or groups, implied by @css/root) skips IP and shared-IP bans, leaving only bans on their own SteamID, on join and in the periodic check. Moving to spectators no longer unhides a hidden admin; only joining T or CT does.
This commit is contained in:
parent
6171162ae9
commit
2069c1a690
8 changed files with 142 additions and 25 deletions
|
|
@ -95,6 +95,7 @@ public partial class CS2_SimpleAdmin
|
|||
CachedPlayers.Remove(player);
|
||||
BotPlayers.Remove(player);
|
||||
SilentPlayers.Remove(player.Slot);
|
||||
PendingBanKicks.Remove(player.Slot);
|
||||
|
||||
if (player.IsBot)
|
||||
{
|
||||
|
|
@ -309,6 +310,10 @@ public partial class CS2_SimpleAdmin
|
|||
|
||||
var command = info.GetArg(0).ToLower();
|
||||
|
||||
// zio: a banned player waiting to be kicked can't talk or join a team.
|
||||
if (PendingBanKicks.Contains(player.Slot) && (command.Contains("say") || command == "jointeam"))
|
||||
return HookResult.Stop;
|
||||
|
||||
if (Config.OtherSettings.AdditionalCommandsToLog.Contains(command))
|
||||
Helper.LogCommand(player, info);
|
||||
|
||||
|
|
@ -405,21 +410,10 @@ public partial class CS2_SimpleAdmin
|
|||
if (remaining is null)
|
||||
player.SendLocalizedMessage(_localizer, $"sa_player_penalty_{kind}_active_perm", reason);
|
||||
else
|
||||
player.SendLocalizedMessage(_localizer, $"sa_player_penalty_{kind}_active", FormatRemaining(remaining.Value), reason);
|
||||
player.SendLocalizedMessage(_localizer, $"sa_player_penalty_{kind}_active", Helper.FormatRemaining(remaining.Value), reason);
|
||||
}
|
||||
}
|
||||
|
||||
private static string FormatRemaining(TimeSpan remaining)
|
||||
{
|
||||
if (remaining.TotalMinutes < 1)
|
||||
return "less than a minute";
|
||||
var parts = new List<string>();
|
||||
if (remaining.Days > 0) parts.Add($"{remaining.Days}d");
|
||||
if (remaining.Hours > 0) parts.Add($"{remaining.Hours}h");
|
||||
if (remaining.Minutes > 0 && remaining.Days == 0) parts.Add($"{remaining.Minutes}m");
|
||||
return string.Join(" ", parts);
|
||||
}
|
||||
|
||||
/*public HookResult OnCommandSay(CCSPlayerController? player, CommandInfo info)
|
||||
{
|
||||
if (player == null || !player.IsValid || player.IsBot)
|
||||
|
|
@ -534,7 +528,9 @@ public partial class CS2_SimpleAdmin
|
|||
if (player == null || !player.IsValid || player.IsBot || !SilentPlayers.Contains(player.Slot))
|
||||
return HookResult.Continue;
|
||||
|
||||
if (@event is not { Oldteam: <= 1, Team: >= 1 }) return HookResult.Continue;
|
||||
// zio: only joining T or CT unhides. Moving to spectators doesn't, so a plugin can take a
|
||||
// hidden admin there (e.g. to close the team select screen) and keep them hidden.
|
||||
if (@event is not { Oldteam: <= 1, Team: >= 2 }) return HookResult.Continue;
|
||||
|
||||
SilentPlayers.Remove(player.Slot);
|
||||
SimpleAdminApi?.OnAdminToggleSilentEvent(player.Slot, false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue