Kick players who say start, small num fix

This commit is contained in:
Ape committed 2026-02-01 21:14:13 +01:00
1 parent e9f1c1aaf1
commit 5570d6f4ea
4 files changed
+49 -4

No files matched your search

+3 -1
View File
@@ -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<int, int> SayStartTimes = [];
public static PlayerControl[] AllPlayerControls
{
get
+14
View File
@@ -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);
+2 -2
View File
@@ -69,9 +69,9 @@ public static class CustomRoleManagement
var impostorRoles = new List<string>();
var lines = new List<string>();
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<string> roles)
{
+30 -1
View File
@@ -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;