Exemple #1
0
 private static void isPlayerTeleportHacking(AnticheatInfo player)
 {
     // Has the player left a car recently.
     if (player.LeftCarRecently)
     {
         player.LeftCarRecently = false;
         player.LastPosition    = player.PlayerClient.position;
         return;
     }
     // Player on foot can cover about 21 feet per 3 seconds.
     if (!player.PlayerClient.isInVehicle)
     {
         if (player.PlayerClient.position.DistanceTo2D(player.LastPosition) > 28)
         {
             player.CurrentStrikes += 1;
             DiscordBot.sendMessageToServer(string.Format("[Anticheat] {0}, strike added for Teleporting.", player.PlayerClient.name));
         }
     }
     else
     {
         if (player.PlayerClient.position.DistanceTo2D(player.LastPosition) > 180)
         {
             player.CurrentStrikes += 1;
             DiscordBot.sendMessageToServer(string.Format("[Anticheat] {0}, strike added for Teleporting.", player.PlayerClient.name));
         }
     }
     player.LastPosition = player.PlayerClient.position;
 }
Exemple #2
0
        public static AnticheatInfo addPlayer(Client player)
        {
            foreach (AnticheatInfo info in AntiCheatPlayers)
            {
                if (info.PlayerClient != player)
                {
                    continue;
                }

                Player instance = player.getData("Instance");
                info.PlayerClient          = player;
                info.LastPosition          = instance.LastPosition;
                info.CurrentStrikes        = 0;
                info.Model                 = player.model;
                info.HealthChangedRecently = true;
                info.ArmorChangedRecently  = true;
                info.isOnline              = true;
                return(info);
            }

            AnticheatInfo antiInfo = new AnticheatInfo(player);

            AntiCheatPlayers.Add(antiInfo);
            return(antiInfo);
        }
Exemple #3
0
        public static void checkHealth(Client player, int oldValue)
        {
            if (!player.hasData("Anticheat"))
            {
                return;
            }
            // Get Anticheat Info
            AnticheatInfo info = player.getData("Anticheat");

            // If their health is only going down, don't worry about it.
            if (player.health < oldValue)
            {
                return;
            }
            // If their health is going up, we're checking it.
            if (info.HealthChangedRecently)
            {
                info.HealthChangedRecently = false;
                return;
            }
            else
            {
                info.CurrentStrikes += 1;
                DiscordBot.sendMessageToServer(string.Format("[Anticheat] {0}, possible health hacking.", player.name));
            }
        }
Exemple #4
0
        private static void isModelHacking(AnticheatInfo player)
        {
            if (player.PlayerClient.model == player.Model)
            {
                return;
            }

            player.CurrentStrikes += 5;
            DiscordBot.sendMessageToServer(string.Format("[Anticheat] {0}, 5 strikes added for model change.", player.PlayerClient.name));
        }
Exemple #5
0
 private static void strikeCheck(AnticheatInfo player)
 {
     if (player.CurrentStrikes <= 4)
     {
         return;
     }
     // Kick the player because their strike count is exceeding 5.
     player.CurrentStrikes = 0;
     player.PlayerClient.kick("Anticheat");
 }
Exemple #6
0
        public static void setPlayerOffline(Client player)
        {
            if (!player.hasData("Anticheat"))
            {
                return;
            }

            AnticheatInfo antiInfo = player.getData("Anticheat");

            antiInfo.isOnline = false;
        }
Exemple #7
0
        private static void setArmor(Client player, int value)
        {
            if (!player.hasData("Anticheat"))
            {
                return;
            }

            AnticheatInfo info = player.getData("Anticheat");

            info.ArmorChangedRecently = true;
            player.armor += value;
        }
Exemple #8
0
        private static void setHealth(Client player, int value)
        {
            if (!player.hasData("Anticheat"))
            {
                return;
            }

            AnticheatInfo info = player.getData("Anticheat");

            info.HealthChangedRecently = true;
            player.health += value;
        }
Exemple #9
0
        public static void checkArmor(Client player, int oldValue)
        {
            if (!player.hasData("Anticheat"))
            {
                return;
            }

            AnticheatInfo info = player.getData("Anticheat");

            if (player.armor > oldValue)
            {
                if (info.HealthChangedRecently)
                {
                    info.ArmorChangedRecently = false;
                    return;
                }
                else
                {
                    info.CurrentStrikes += 1;
                    DiscordBot.sendMessageToServer(string.Format("[Anticheat] {0}, possible armor hacking.", player.name));
                }
            }
        }