From 5570d6f4eadd4771d2f3def26bd03f0d64256c04 Mon Sep 17 00:00:00 2001 From: Ape <155788660+ApeMV@users.noreply.github.com> Date: Sun, 1 Feb 2026 21:14:13 +0100 Subject: [PATCH] Kick players who say start, small num fix --- AmongUsRevamped.cs | 4 +++- Modules/CustomOptionsHolder.cs | 14 ++++++++++++++ Modules/CustomRoleManagement.cs | 4 ++-- Patches/ChatPatches.cs | 31 ++++++++++++++++++++++++++++++- 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/AmongUsRevamped.cs b/AmongUsRevamped.cs index d6442e4..c09e2f7 100644 --- a/AmongUsRevamped.cs +++ b/AmongUsRevamped.cs @@ -39,10 +39,12 @@ public partial class Main : BasePlugin public static HideNSeekGameOptionsV10 HideNSeekOptions => GameOptionsManager.Instance != null ? GameOptionsManager.Instance.currentHideNSeekGameOptions : null; public static bool HasArgumentException; public static string CredentialsText; - public const string ModVersion = "v1.4.1"; + public const string ModVersion = "v1.5.0"; public static float GameTimer; + public static readonly Dictionary SayStartTimes = []; + public static PlayerControl[] AllPlayerControls { get diff --git a/Modules/CustomOptionsHolder.cs b/Modules/CustomOptionsHolder.cs index 4510c18..5fc2256 100644 --- a/Modules/CustomOptionsHolder.cs +++ b/Modules/CustomOptionsHolder.cs @@ -78,6 +78,11 @@ namespace AmongUsRevamped public static OptionItem ApplyModeratorList; public static OptionItem ModeratorCanUseCommand; + public static OptionItem AutoKickStart; + public static OptionItem AutoKickStartAsBan; + public static OptionItem AutoKickStartTimes; + public static OptionItem AutoKickStartStrength; + public static OptionItem TabGroupAutomation; public static OptionItem AutoSendGameInfo; @@ -266,6 +271,15 @@ namespace AmongUsRevamped ApplyModeratorList = BooleanOptionItem.Create(60121, "Apply Moderator List", true, TabGroup.SystemSettings, false); ModeratorCanUseCommand = BooleanOptionItem.Create(60122, "Moderators can use commands", true, TabGroup.SystemSettings, false); + AutoKickStart = BooleanOptionItem.Create(60123, "Kick Players Who Say Start", false, TabGroup.SystemSettings, false); + AutoKickStartAsBan = BooleanOptionItem.Create(60124, "Ban Instead Of Kick", false, TabGroup.SystemSettings, false) + .SetParent(AutoKickStart); + AutoKickStartTimes = IntegerOptionItem.Create(60125, "Start messages needed to kick", new(1, 10, 1), 1, TabGroup.SystemSettings, false) + .SetParent(AutoKickStart) + .SetValueFormat(OptionFormat.Times); + AutoKickStartStrength = BooleanOptionItem.Create(60126, "Strict detection mode", false, TabGroup.SystemSettings, false) + .SetParent(AutoKickStart); + TabGroupAutomation = TextOptionItem.Create(60149, "Automation", TabGroup.SystemSettings) .SetColor(Color.yellow); diff --git a/Modules/CustomRoleManagement.cs b/Modules/CustomRoleManagement.cs index 82d4687..a375ec0 100644 --- a/Modules/CustomRoleManagement.cs +++ b/Modules/CustomRoleManagement.cs @@ -69,9 +69,9 @@ public static class CustomRoleManagement var impostorRoles = new List(); var lines = new List(); - if (Options.MayorPerc.GetInt() > 1) crewmateRoles.Add($"Mayor ({Options.MayorPerc.GetInt()}%)"); + if (Options.MayorPerc.GetInt() > 1) crewmateRoles.Add($"Mayor"); - if (Options.JesterPerc.GetInt() > 1) neutralRoles.Add($"Jester ({Options.JesterPerc.GetInt()})%"); + if (Options.JesterPerc.GetInt() > 1) neutralRoles.Add($"Jester"); void AddCategory(string header, List roles) { diff --git a/Patches/ChatPatches.cs b/Patches/ChatPatches.cs index e46f211..31e1f08 100644 --- a/Patches/ChatPatches.cs +++ b/Patches/ChatPatches.cs @@ -142,7 +142,7 @@ internal static class SendChatPatch switch (Options.Gamemode.GetValue()) { case 0: - Utils.ChatCommand(__instance, $"CUSTOM ROLES:\n\n{CustomRoleManagement.GetActiveRoles()}", "", false); + Utils.ChatCommand(__instance, $"ENABLED CUSTOM ROLES:\n\n{CustomRoleManagement.GetActiveRoles()}", "", false); break; case 1: @@ -254,6 +254,35 @@ public static class RPCHandlerPatch Logger.Info($" {__instance.Data.PlayerName}: {msgtext}", "SendChat"); + string[] keywords = Options.AutoKickStartStrength.GetBool() ? new[] { "start", "begin", "commence" } : new[] { "start", "begin", "commence", "s t a r t", "go" }; + + bool c = false; + + if (Options.AutoKickStartStrength.GetBool()) + { + c = keywords.Any(k => text.Contains(k)); + } + else + { + c = keywords.Any(k => text == k); + } + if (c && !Utils.IsPlayerModerator(__instance.Data.FriendCode)) + { + int clientId = __instance.Data.ClientId; + + if (!Main.SayStartTimes.ContainsKey(clientId)) + Main.SayStartTimes.Add(clientId, 0); + Main.SayStartTimes[clientId]++; + + if (Main.SayStartTimes[clientId] >= Options.AutoKickStartTimes.GetInt()) + { + bool sBan = Options.AutoKickStartAsBan.GetBool(); + AmongUsClient.Instance.KickPlayer(clientId, sBan); + Logger.Info($" {__instance.Data.PlayerName} was {(sBan ? "banned" : "kicked")} for saying start", "KickAnnoyingKids"); + Logger.SendInGame($" {__instance.Data.PlayerName} was {(sBan ? "banned" : "kicked")} for saying start"); + } + } + if (text == "/h" || text == "/help" || text == "/cmd" || text == "/commands") { if (!Utils.IsPlayerModerator(__instance.Data.FriendCode) || !Options.ModeratorCanUseCommand.GetBool()) return;