mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
Set level false flag fix
This commit is contained in:
1 parent
24c3055511
commit
27ed1ce4f8
2 files changed
+12
-21
No files matched your search
+12
-5
@@ -282,14 +282,17 @@ class AntiCheat
|
||||
if (level + 1 > BetterGameSettings.DetectedLevelAbove.GetInt())
|
||||
{
|
||||
BetterNotificationManager.NotifyCheat(player, string.Format(Translator.GetString("InvalidLevelRPC"), level));
|
||||
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {level > BetterGameSettings.DetectedLevelAbove.GetInt()}");
|
||||
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {level > BetterGameSettings.DetectedLevelAbove.GetInt()} - {level} > {BetterGameSettings.DetectedLevelAbove.GetInt()}");
|
||||
}
|
||||
|
||||
else if (level > 1000000)
|
||||
{
|
||||
var betterData = player.BetterData();
|
||||
player.Kick(false, "{0}" + $" due to {level} being invalid level", bypassDataCheck: true);
|
||||
betterData.AntiCheatInfo.BannedByAntiCheat = true;
|
||||
if (GameStates.IsHost)
|
||||
{
|
||||
player.Kick(false, "{0}" + $" due to {level} being invalid level", bypassDataCheck: true);
|
||||
betterData.AntiCheatInfo.BannedByAntiCheat = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -674,12 +677,16 @@ class AntiCheat
|
||||
{
|
||||
if (callId is (byte)RpcCalls.CheckName or (byte)RpcCalls.SetLevel)
|
||||
{
|
||||
BetterNotificationManager.NotifyCheat(player, string.Format(Translator.GetString("AntiCheat.InvalidSetRPC"), Enum.GetName((RpcCalls)callId)));
|
||||
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {player.DataIsCollected() == true}");
|
||||
if (callId is (byte)RpcCalls.SetLevel)
|
||||
{
|
||||
BetterNotificationManager.NotifyCheat(player, string.Format(Translator.GetString("AntiCheat.InvalidSetRPC"), Enum.GetName((RpcCalls)callId)));
|
||||
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: Data - {player.DataIsCollected() == true}");
|
||||
}
|
||||
|
||||
if (callId is (byte)RpcCalls.CheckName)
|
||||
{
|
||||
var name = reader.ReadString();
|
||||
BetterNotificationManager.NotifyCheat(player, string.Format(Translator.GetString("AntiCheat.InvalidSetRPC"), Enum.GetName((RpcCalls)callId)));
|
||||
Utils.AddChatPrivate($"{player.GetPlayerNameAndColor()} Has tried to change their name to '{name}' but has been undone!");
|
||||
Logger.LogCheat($"{player.BetterData().RealName} Has tried to change their name to '{name}' but has been undone!");
|
||||
}
|
||||
|
||||
@@ -93,22 +93,6 @@ public class ClientPatch
|
||||
}
|
||||
}
|
||||
}
|
||||
[HarmonyPatch(typeof(NetworkedPlayerInfo))]
|
||||
public class NetworkedPlayerInfoPatch
|
||||
{
|
||||
[HarmonyPatch(nameof(NetworkedPlayerInfo.Deserialize))]
|
||||
[HarmonyPostfix]
|
||||
public static void Deserialize_Postfix(NetworkedPlayerInfo __instance)
|
||||
{
|
||||
if (!GameStates.IsHost)
|
||||
{
|
||||
if (__instance.PlayerLevel > 1000000)
|
||||
{
|
||||
__instance.PlayerLevel = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Set text color
|
||||
[HarmonyPatch(typeof(CosmeticsLayer))]
|
||||
public class CosmeticsLayerPatch
|
||||
|
||||
Reference in new issue
Block a user