예제 #1
0
    public static bool IsFlying(BasePlayer ply, TickInterpolator ticks, float deltaTime)
    {
        ply.flyhackPauseTime = Mathf.Max(0f, ply.flyhackPauseTime - deltaTime);
        if (ply.flyhackPauseTime > 0f)
        {
            return(false);
        }
        if (ConVar.AntiHack.flyhack_protection <= 0)
        {
            return(false);
        }
        ticks.Reset();
        if (!ticks.HasNext())
        {
            return(false);
        }
        bool      flag      = ply.transform.parent == null;
        Matrix4x4 matrix4x4 = (flag ? Matrix4x4.identity : ply.transform.parent.localToWorldMatrix);
        Vector3   vector3   = (flag ? ticks.StartPoint : matrix4x4.MultiplyPoint3x4(ticks.StartPoint));
        Vector3   vector31  = (flag ? ticks.EndPoint : matrix4x4.MultiplyPoint3x4(ticks.EndPoint));

        if (ConVar.AntiHack.flyhack_protection >= 3)
        {
            float single = Mathf.Max(ConVar.AntiHack.flyhack_stepsize, 0.1f);
            int   num    = Mathf.Max(ConVar.AntiHack.flyhack_maxsteps, 1);
            single = Mathf.Max(ticks.Length / (float)num, single);
            while (ticks.MoveNext(single))
            {
                vector31 = (flag ? ticks.CurrentPoint : matrix4x4.MultiplyPoint3x4(ticks.CurrentPoint));
                if (AntiHack.TestFlying(ply, vector3, vector31, true))
                {
                    return(true);
                }
                vector3 = vector31;
            }
        }
        else if (ConVar.AntiHack.flyhack_protection >= 2)
        {
            if (AntiHack.TestFlying(ply, vector3, vector31, true))
            {
                return(true);
            }
        }
        else if (AntiHack.TestFlying(ply, vector3, vector31, false))
        {
            return(true);
        }
        return(false);
    }
예제 #2
0
 public static bool IsFlying(BasePlayer ply, TickInterpolator ticks, float deltaTime)
 {
     using (TimeWarning.New("AntiHack.IsFlying"))
     {
         ply.flyhackPauseTime = Mathf.Max(0f, ply.flyhackPauseTime - deltaTime);
         if (ConVar.AntiHack.flyhack_protection <= 0)
         {
             return(false);
         }
         ticks.Reset();
         if (!ticks.HasNext())
         {
             return(false);
         }
         bool      flag     = ply.transform.parent == null;
         Matrix4x4 matrix4x = (flag ? Matrix4x4.identity : ply.transform.parent.localToWorldMatrix);
         Vector3   oldPos   = (flag ? ticks.StartPoint : matrix4x.MultiplyPoint3x4(ticks.StartPoint));
         Vector3   newPos   = (flag ? ticks.EndPoint : matrix4x.MultiplyPoint3x4(ticks.EndPoint));
         if (ConVar.AntiHack.flyhack_protection >= 3)
         {
             float b   = Mathf.Max(ConVar.AntiHack.flyhack_stepsize, 0.1f);
             int   num = Mathf.Max(ConVar.AntiHack.flyhack_maxsteps, 1);
             b = Mathf.Max(ticks.Length / (float)num, b);
             while (ticks.MoveNext(b))
             {
                 newPos = (flag ? ticks.CurrentPoint : matrix4x.MultiplyPoint3x4(ticks.CurrentPoint));
                 if (TestFlying(ply, oldPos, newPos, true))
                 {
                     return(true);
                 }
                 oldPos = newPos;
             }
         }
         else if (ConVar.AntiHack.flyhack_protection >= 2)
         {
             if (TestFlying(ply, oldPos, newPos, true))
             {
                 return(true);
             }
         }
         else if (TestFlying(ply, oldPos, newPos, false))
         {
             return(true);
         }
         return(false);
     }
 }
예제 #3
0
    public static bool IsFlying(BasePlayer ply, TickInterpolator ticks, float deltaTime)
    {
        ply.flyhackPauseTime = Mathf.Max(0.0f, ply.flyhackPauseTime - deltaTime);
        if ((double)ply.flyhackPauseTime > 0.0 || ConVar.AntiHack.flyhack_protection <= 0)
        {
            return(false);
        }
        ticks.Reset();
        if (!ticks.HasNext())
        {
            return(false);
        }
        bool      flag      = Object.op_Equality((Object)((Component)ply).get_transform().get_parent(), (Object)null);
        Matrix4x4 matrix4x4 = flag ? Matrix4x4.get_identity() : ((Component)ply).get_transform().get_parent().get_localToWorldMatrix();
        Vector3   oldPos    = flag ? ticks.StartPoint : ((Matrix4x4) ref matrix4x4).MultiplyPoint3x4(ticks.StartPoint);
        Vector3   newPos1   = flag ? ticks.EndPoint : ((Matrix4x4) ref matrix4x4).MultiplyPoint3x4(ticks.EndPoint);

        if (ConVar.AntiHack.flyhack_protection >= 3)
        {
            float num1     = Mathf.Max(ConVar.AntiHack.flyhack_stepsize, 0.1f);
            int   num2     = Mathf.Max(ConVar.AntiHack.flyhack_maxsteps, 1);
            float distance = Mathf.Max(ticks.Length / (float)num2, num1);
            while (ticks.MoveNext(distance))
            {
                Vector3 newPos2 = flag ? ticks.CurrentPoint : ((Matrix4x4) ref matrix4x4).MultiplyPoint3x4(ticks.CurrentPoint);
                if (AntiHack.TestFlying(ply, oldPos, newPos2, true))
                {
                    return(true);
                }
                oldPos = newPos2;
            }
        }
        else if (ConVar.AntiHack.flyhack_protection >= 2)
        {
            if (AntiHack.TestFlying(ply, oldPos, newPos1, true))
            {
                return(true);
            }
        }
        else if (AntiHack.TestFlying(ply, oldPos, newPos1, false))
        {
            return(true);
        }
        return(false);
    }