Merge pull request #14 from D1GQ/dev

fix
This commit is contained in:
D1GQ authored and GitHub committed 2024-08-03 22:51:04 -05:00
commit 6e23ed3246
2 files changed
+23 -4

No files matched your search

+11 -2
View File
@@ -234,14 +234,23 @@ class AntiCheat
if (callId is (byte)RpcCalls.MurderPlayer)
{
bool condition = false;
if (ExtendedPlayerInfo.TimeSinceKill.TryGetValue(player, out var value))
{
if (value < GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown)
{
condition = true;
}
}
if (reader.BytesRemaining > 0)
{
PlayerControl target = reader.ReadNetObject<PlayerControl>();
if (target != null)
{
if (!player.IsImpostorTeam() || !player.IsAlive() || player.IsInVanish() || !target.IsAlive() || target.IsImpostorTeam()
|| ExtendedPlayerInfo.TimeSinceKill.TryGetValue(player, out var value) && value < (float)GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown)
if (!player.IsImpostorTeam() || !player.IsAlive() || player.IsInVanish() || !target.IsAlive() || target.IsImpostorTeam() || condition)
{
BetterNotificationManager.NotifyCheat(player, $"Invalid Action RPC: {Enum.GetName((RpcCalls)callId)}");
}
+12 -2
View File
@@ -65,7 +65,7 @@ class BetterHostManager
public static bool CheckRPCAsHost(PlayerControl player, byte callId, MessageReader reader, ref bool canceled)
{
if (player == null) return true;
if (player == null || !GameStates.IsHost) return true;
bool shouldReturn = false;
@@ -97,6 +97,16 @@ class BetterHostManager
{
PlayerControl target = reader.ReadNetObject<PlayerControl>();
bool condition = false;
if (ExtendedPlayerInfo.TimeSinceKill.TryGetValue(player, out var value))
{
if (value >= GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown)
{
condition = true;
}
}
if (target != null)
{
if (player.IsAlive()
@@ -107,7 +117,7 @@ class BetterHostManager
&& !player.shapeshifting
&& !player.onLadder
&& !player.MyPhysics.Animations.IsPlayingAnyLadderAnimation()
&& ExtendedPlayerInfo.TimeSinceKill.TryGetValue(player, out var value) && value >= (float)GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown
&& condition
&& CheckRange(player.GetCustomPosition(), target.GetCustomPosition(), 3f))
{
if (target.IsAlive()