Fix custom rpcs Triggering anticheat

This commit is contained in:
D1GQ committed 2026-05-27 21:53:07 -05:00
1 parent 07ac51b7c7
commit 2b345a6b1d
3 files changed
+8 -22

No files matched your search

+1 -1
View File
@@ -276,7 +276,7 @@ internal static class NetworkManager
if (innerNetObject is PlayerControl player && player != null)
{
if (rpcCall == (byte)RpcCalls.SetNamePlateStr)
if (rpcCall == (byte)RPC.CUSTOM_RPC_CALL)
{
RPC.HandleCustomRPCPacked(player, reader);
}
-10
View File
@@ -7,7 +7,6 @@ using BetterAmongUs.Managers;
using BetterAmongUs.Modules.AntiCheat.RPCHandlers.NetObjectHandlers;
using BetterAmongUs.Modules.Support;
using BetterAmongUs.Mono.Extended;
using BetterAmongUs.Network;
using BetterAmongUs.Patches.Gameplay.UI.Settings;
using Hazel;
@@ -153,15 +152,6 @@ internal static class BetterAntiCheat
return false;
}
if (callId == (byte)RpcCalls.SetNamePlateStr)
{
if (RPC.IsPackedCustomRpc(reader))
{
reader.Recycle();
return false;
}
}
if (!player.IsHost())
{
if (callId is (byte)RpcCalls.SetTasks
+7 -11
View File
@@ -1,5 +1,4 @@
using AmongUs.Data;
using BetterAmongUs.Enums;
using BetterAmongUs.Enums;
using BetterAmongUs.Helpers;
using BetterAmongUs.Modules;
using BetterAmongUs.Mono.Extended;
@@ -9,11 +8,14 @@ namespace BetterAmongUs.Network;
/// <summary>
/// Handles custom RPC (Remote Procedure Call) messages for BetterAmongUs.
/// This class provides methods for sending and receiving custom RPC messages
/// packed within vanilla RPC calls to maintain compatibility with vanilla servers.
/// </summary>
internal static class RPC
{
/// <summary>
/// The base rpc call used for custom RPC messages.
/// </summary>
internal const RpcCalls CUSTOM_RPC_CALL = RpcCalls.CancelPet;
/// <summary>
/// The flag string used to identify custom RPC messages packed within vanilla RPC calls.
/// </summary>
@@ -29,11 +31,8 @@ internal static class RPC
/// <param name="targetClientId">The specific client ID to target, or -1 to broadcast to all clients.</param>
internal static void SendCustomRpcPacked(CustomRPC customRPC, Action<MessageWriter> action, int targetClientId = -1)
{
AmongUsClient.Instance.SendRpcImmediately(PlayerControl.LocalPlayer.NetId, RpcCalls.SetNamePlateStr, SendOption.Reliable, writer =>
AmongUsClient.Instance.SendRpcImmediately(PlayerControl.LocalPlayer.NetId, CUSTOM_RPC_CALL, SendOption.Reliable, writer =>
{
writer.Write(DataManager.Player.Customization.NamePlate);
writer.Write(PlayerControl.LocalPlayer.GetNextRpcSequenceId(RpcCalls.SetNamePlateStr));
writer.Write(CUSTOM_RPC_FLAG); // Flag to check if its a rpc packed into SetNamePlateStr
writer.Write((byte)customRPC);
action(writer);
@@ -53,9 +52,6 @@ internal static class RPC
MessageReader reader = MessageReader.Get(oldReader);
_ = reader.ReadString();
_ = reader.ReadByte();
if (IsPackedCustomRpc(reader))
{
CustomRPC customRPC = (CustomRPC)reader.ReadByte();