예제 #1
0
    public static bool ValidateMove(BasePlayer ply, TickInterpolator ticks, float deltaTime)
    {
        bool flag;

        using (TimeWarning timeWarning = TimeWarning.New("AntiHack.ValidateMove", 0.1f))
        {
            if (ply.IsFlying)
            {
                ply.lastAdminCheatTime = UnityEngine.Time.realtimeSinceStartup;
            }
            if (ply.IsAdmin)
            {
                if (ConVar.AntiHack.userlevel < 1)
                {
                    flag = true;
                    return(flag);
                }
                else if (ConVar.AntiHack.admincheat && ply.UsedAdminCheat(1f))
                {
                    flag = true;
                    return(flag);
                }
            }
            if (ply.IsDeveloper)
            {
                if (ConVar.AntiHack.userlevel < 2)
                {
                    flag = true;
                    return(flag);
                }
                else if (ConVar.AntiHack.admincheat && ply.UsedAdminCheat(1f))
                {
                    flag = true;
                    return(flag);
                }
            }
            if (ply.IsSleeping())
            {
                flag = true;
            }
            else if (ply.IsWounded())
            {
                flag = true;
            }
            else if (ply.IsSpectating())
            {
                flag = true;
            }
            else if (!ply.IsDead())
            {
                bool flag1 = deltaTime > ConVar.AntiHack.maxdeltatime;
                using (TimeWarning timeWarning1 = TimeWarning.New("IsNoClipping", 0.1f))
                {
                    if (AntiHack.IsNoClipping(ply, ticks, deltaTime))
                    {
                        if (!flag1)
                        {
                            AntiHack.AddViolation(ply, AntiHackType.NoClip, ConVar.AntiHack.noclip_penalty * ticks.Length);
                            if (ConVar.AntiHack.noclip_reject)
                            {
                                flag = false;
                                return(flag);
                            }
                        }
                        else
                        {
                            flag = false;
                            return(flag);
                        }
                    }
                }
                using (timeWarning1 = TimeWarning.New("IsSpeeding", 0.1f))
                {
                    if (AntiHack.IsSpeeding(ply, ticks, deltaTime))
                    {
                        if (!flag1)
                        {
                            AntiHack.AddViolation(ply, AntiHackType.SpeedHack, ConVar.AntiHack.speedhack_penalty * ticks.Length);
                            if (ConVar.AntiHack.speedhack_reject)
                            {
                                flag = false;
                                return(flag);
                            }
                        }
                        else
                        {
                            flag = false;
                            return(flag);
                        }
                    }
                }
                using (timeWarning1 = TimeWarning.New("IsFlying", 0.1f))
                {
                    if (AntiHack.IsFlying(ply, ticks, deltaTime))
                    {
                        if (!flag1)
                        {
                            AntiHack.AddViolation(ply, AntiHackType.FlyHack, ConVar.AntiHack.flyhack_penalty * ticks.Length);
                            if (ConVar.AntiHack.flyhack_reject)
                            {
                                flag = false;
                                return(flag);
                            }
                        }
                        else
                        {
                            flag = false;
                            return(flag);
                        }
                    }
                }
                flag = true;
            }
            else
            {
                flag = true;
            }
        }
        return(flag);
    }
예제 #2
0
 public static bool ValidateMove(BasePlayer ply, TickInterpolator ticks, float deltaTime)
 {
     using (TimeWarning.New("AntiHack.ValidateMove", 0.1f))
     {
         if (ply.IsFlying)
         {
             ply.lastAdminCheatTime = Time.get_realtimeSinceStartup();
         }
         if (ply.IsAdmin && (ConVar.AntiHack.userlevel < 1 || ConVar.AntiHack.admincheat && ply.UsedAdminCheat(1f)) || ply.IsDeveloper && (ConVar.AntiHack.userlevel < 2 || ConVar.AntiHack.admincheat && ply.UsedAdminCheat(1f)) || (ply.IsSleeping() || ply.IsWounded() || (ply.IsSpectating() || ply.IsDead())))
         {
             return(true);
         }
         bool flag = (double)deltaTime > (double)ConVar.AntiHack.maxdeltatime;
         using (TimeWarning.New("IsNoClipping", 0.1f))
         {
             if (AntiHack.IsNoClipping(ply, ticks, deltaTime))
             {
                 if (flag)
                 {
                     return(false);
                 }
                 AntiHack.AddViolation(ply, AntiHackType.NoClip, ConVar.AntiHack.noclip_penalty * ticks.Length);
                 if (ConVar.AntiHack.noclip_reject)
                 {
                     return(false);
                 }
             }
         }
         using (TimeWarning.New("IsSpeeding", 0.1f))
         {
             if (AntiHack.IsSpeeding(ply, ticks, deltaTime))
             {
                 if (flag)
                 {
                     return(false);
                 }
                 AntiHack.AddViolation(ply, AntiHackType.SpeedHack, ConVar.AntiHack.speedhack_penalty * ticks.Length);
                 if (ConVar.AntiHack.speedhack_reject)
                 {
                     return(false);
                 }
             }
         }
         using (TimeWarning.New("IsFlying", 0.1f))
         {
             if (AntiHack.IsFlying(ply, ticks, deltaTime))
             {
                 if (flag)
                 {
                     return(false);
                 }
                 AntiHack.AddViolation(ply, AntiHackType.FlyHack, ConVar.AntiHack.flyhack_penalty * ticks.Length);
                 if (ConVar.AntiHack.flyhack_reject)
                 {
                     return(false);
                 }
             }
         }
         return(true);
     }
 }