C++ FreeStand AA [LW] (wall thickness)

get good get legendware
Участник
Статус
Оффлайн
Регистрация
22 Сен 2020
Сообщения
437
Реакции[?]
201
Поинты[?]
48K
your favorite p2c freestand
enjoy

cpp: -

C++:
// add this to antiaim.cpp or whatever its called
float quick_normalize(float degree, const float min, const float max) {
    while (degree < min)
        degree += max - min;
    while (degree > max)
        degree -= max - min;

    return degree;
}
bool trace_to_exit_short(Vector& point, Vector& dir, const float step_size, float max_distance)
{
    float flDistance = 0;

    while (flDistance <= max_distance)
    {
        flDistance += step_size;

        point += dir * flDistance;

        if ((m_trace()->GetPointContents(point) & MASK_SOLID) == 0)
        {
            // found first free point
            return true;
        }
    }

    return false;
}

float get_thickness(Vector& start, Vector& end) {
    Vector dir = end - start;
    Vector step = start;
    dir /= dir.Length();
    CTraceFilter filter;
    trace_t trace;
    Ray_t ray;
    float thickness = 0;
    while (true) {
        ray.Init(step, end);
        m_trace()->TraceRay(ray, MASK_SOLID, &filter, &trace);

        if (!trace.DidHit())
            break;

        const Vector lastStep = trace.endpos;
        step = trace.endpos;

        if ((end - start).Length() <= (step - start).Length())
            break;

        if (!trace_to_exit_short(step, dir, 5, 90))
            return FLT_MAX;

        thickness += (step - lastStep).Length();
    }
    return thickness;
}



void antiaim::edge_anti_aim(CUserCmd* m_pcmd)
{
    std::vector<angle_data> points;
    if (!g_cfg.antiaim.freestand)
        return;


    const auto local = g_ctx.local();



    const auto local_position = local->m_angEyeAngles();
    std::vector<float> scanned = {};

    for (auto i = 0; i <= m_globals()->m_maxclients; i++)
    {
        auto p_entity = dynamic_cast<player_t*>(m_entitylist()->GetClientEntity(i));
        if (p_entity == nullptr) continue;
        if (p_entity == local) continue;
        if (!p_entity->is_alive()) continue;
        if (p_entity->m_iTeamNum() == local->m_iTeamNum()) continue;
        if (p_entity->IsDormant()) continue;
        if (!p_entity->is_player()) continue;

        const auto view = math::calculate_angle(local_position, p_entity->m_angEyeAngles());

        std::vector<angle_data> angs;

        for (auto y = 1; y < 4; y++)
        {
            auto ang = quick_normalize((y * 90) + view.y, -180.f, 180.f);
            auto found = false; // check if we already have a similar angle

            for (auto i2 : scanned)
                if (abs(quick_normalize(i2 - ang, -180.f, 180.f)) < 20.f)
                    found = true;

            if (found)
                continue;

            points.emplace_back(ang, -1.f);
            scanned.push_back(ang);
        }
        //points.push_back(base_angle_data(view.y, angs)); // base yaws and angle data (base yaw needed for lby breaking etc)
    }

    for (auto i = 0; i <= m_globals()->m_maxclients; i++)
    {
        auto p_entity = dynamic_cast<player_t*>(m_entitylist()->GetClientEntity(i));
        if (p_entity == nullptr) continue;
        if (p_entity == local) continue;
        if (!p_entity->is_alive()) continue;
        if (p_entity->m_iTeamNum() == local->m_iTeamNum()) continue;
        if (p_entity->IsDormant()) continue;
        if (!p_entity->is_player()) continue;

        auto found = false;
        auto points_copy = points; // copy data so that we compair it to the original later to find the lowest thickness
        auto enemy_eyes = p_entity->m_angEyeAngles();

        for (auto& z : points_copy) // now we get the thickness for all of the data
        {
            const Vector tmp(10, z.angle, 0.0f);
            Vector head;
            math::AngleVectors(tmp, &head);
            head *= ((16.0f + 3.0f) + ((16.0f + 3.0f) * sin(DEG2RAD(10.0f)))) + 7.0f;
            head += local_position;
            const auto local_thickness = get_thickness(head, enemy_eyes); // i really need my source for this bit, i forgot how it works entirely Autowall :: GetThickness1 (head, hacks.m_local_player, p_entity);
            z.thickness = local_thickness;

            if (local_thickness!= 0) // if theres a thickness of 0 dont use this data
            {
                found = true;
            }
        }

        if (!found) // dont use
            continue;

        for (auto z = 0; points_copy.size() > z; z++)
            if (points_copy[z].thickness < points[z].thickness || points[z].thickness == -1) // find the lowest thickness so that we can hide our head best for all entities
                points[z].thickness = points_copy[z].thickness;

    }
    float best = 0;
    for (auto& i : points)
        if ((i.thickness > best || i.thickness == -1) && i.thickness!= 0) // find the best hiding spot (highest thickness)
        {
            best = i.thickness;
            m_pcmd->m_viewangles.y = i.angle;
            // auto ret = true;
        }
}

hpp :-

C++:
struct angle_data {
    float angle;
    float thickness;
    angle_data(const float angle, const float thickness) : angle(angle), thickness(thickness) {}
};
NOTE:- there's an anti paste
 
Последнее редактирование:
Пользователь
Статус
Оффлайн
Регистрация
3 Июл 2021
Сообщения
825
Реакции[?]
93
Поинты[?]
10K
your favorite p2c freestand
enjoy

cpp: -

C++:
// add this to antiaim.cpp or whatever its called
float quick_normalize(float degree, const float min, const float max) {
    while (degree < min)
        degree += max - min;
    while (degree > max)
        degree -= max - min;

    return degree;
}
bool trace_to_exit_short(Vector& point, Vector& dir, const float step_size, float max_distance)
{
    float flDistance = 0;

    while (flDistance <= max_distance)
    {
        flDistance += step_size;

        point += dir * flDistance;

        if ((m_trace()->GetPointContents(point) & MASK_SOLID) == 0)
        {
            // found first free point
            return true;
        }
    }

    return false;
}

float get_thickness(Vector& start, Vector& end) {
    Vector dir = end - start;
    Vector step = start;
    dir /= dir.Length();
    CTraceFilter filter;
    trace_t trace;
    Ray_t ray;
    float thickness = 0;
    while (true) {
        ray.Init(step, end);
        m_trace()->TraceRay(ray, MASK_SOLID, &filter, &trace);

        if (!trace.DidHit())
            break;

        const Vector lastStep = trace.endpos;
        step = trace.endpos;

        if ((end - start).Length() <= (step - start).Length())
            break;

        if (!trace_to_exit_short(step, dir, 5, 90))
            return FLT_MAX;

        thickness += (step - lastStep).Length();
    }
    return thickness;
}



void antiaim::edge_anti_aim(CUserCmd* m_pcmd)
{
    std::vector<angle_data> points;
    if (!g_cfg.antiaim.freestand)
        return;


    const auto local = g_ctx.local();



    const auto local_position = local->m_angEyeAngles();
    std::vector<float> scanned = {};

    for (auto i = 0; i <= m_globals()->m_maxclients; i++)
    {
        auto p_entity = dynamic_cast<player_t*>(m_entitylist()->GetClientEntity(i));
        if (p_entity == nullptr) continue;
        if (p_entity == local) continue;
        if (!p_entity->is_alive()) continue;
        if (p_entity->m_iTeamNum() == local->m_iTeamNum()) continue;
        if (p_entity->IsDormant()) continue;
        if (!p_entity->is_player()) continue;

        const auto view = math::calculate_angle(local_position, p_entity->m_angEyeAngles());

        std::vector<angle_data> angs;

        for (auto y = 1; y < 4; y++)
        {
            auto ang = quick_normalize((y * 90) + view.y, -180.f, 180.f);
            auto found = false; // check if we already have a similar angle

            for (auto i2 : scanned)
                if (abs(quick_normalize(i2 - ang, -180.f, 180.f)) < 20.f)
                    found = true;

            if (found)
                continue;

            points.emplace_back(ang, -1.f);
            scanned.push_back(ang);
        }
        //points.push_back(base_angle_data(view.y, angs)); // base yaws and angle data (base yaw needed for lby breaking etc)
    }

    for (auto i = 0; i <= m_globals()->m_maxclients; i++)
    {
        auto p_entity = dynamic_cast<player_t*>(m_entitylist()->GetClientEntity(i));
        if (p_entity == nullptr) continue;
        if (p_entity == local) continue;
        if (!p_entity->is_alive()) continue;
        if (p_entity->m_iTeamNum() == local->m_iTeamNum()) continue;
        if (p_entity->IsDormant()) continue;
        if (!p_entity->is_player()) continue;

        auto found = false;
        auto points_copy = points; // copy data so that we compair it to the original later to find the lowest thickness
        auto enemy_eyes = p_entity->m_angEyeAngles();

        for (auto& z : points_copy) // now we get the thickness for all of the data
        {
            const Vector tmp(10, z.angle, 0.0f);
            Vector head;
            math::AngleVectors(tmp, &head);
            head *= ((16.0f + 3.0f) + ((16.0f + 3.0f) * sin(DEG2RAD(10.0f)))) + 7.0f;
            head += local_position;
            const auto local_thickness = get_thickness(head, enemy_eyes); // i really need my source for this bit, i forgot how it works entirely Autowall :: GetThickness1 (head, hacks.m_local_player, p_entity);
            z.thickness = local_thickness;

            if (local_thickness!= 0) // if theres a thickness of 0 dont use this data
            {
                found = true;
            }
        }

        if (!found) // dont use
            continue;

        for (auto z = 0; points_copy.size() > z; z++)
            if (points_copy[z].thickness < points[z].thickness || points[z].thickness == -1) // find the lowest thickness so that we can hide our head best for all entities
                points[z].thickness = points_copy[z].thickness;

    }
    float best = 0;
    for (auto& i : points)
        if ((i.thickness > best || i.thickness == -1) && i.thickness!= 0) // find the best hiding spot (highest thickness)
        {
            best = i.thickness;
            m_pcmd->m_viewangles.y = i.angle;
            // auto ret = true;
        }
}

hpp :-

C++:
struct angle_data {
    float angle;
    float thickness;
    angle_data(const float angle, const float thickness) : angle(angle), thickness(thickness) {}
};
NOTE:- there's an anti paste
edge yaw?
 
Начинающий
Статус
Оффлайн
Регистрация
29 Мар 2021
Сообщения
18
Реакции[?]
7
Поинты[?]
0
your favorite p2c freestand
enjoy

cpp: -

C++:
// add this to antiaim.cpp or whatever its called
float quick_normalize(float degree, const float min, const float max) {
    while (degree < min)
        degree += max - min;
    while (degree > max)
        degree -= max - min;

    return degree;
}
bool trace_to_exit_short(Vector& point, Vector& dir, const float step_size, float max_distance)
{
    float flDistance = 0;

    while (flDistance <= max_distance)
    {
        flDistance += step_size;

        point += dir * flDistance;

        if ((m_trace()->GetPointContents(point) & MASK_SOLID) == 0)
        {
            // found first free point
            return true;
        }
    }

    return false;
}

float get_thickness(Vector& start, Vector& end) {
    Vector dir = end - start;
    Vector step = start;
    dir /= dir.Length();
    CTraceFilter filter;
    trace_t trace;
    Ray_t ray;
    float thickness = 0;
    while (true) {
        ray.Init(step, end);
        m_trace()->TraceRay(ray, MASK_SOLID, &filter, &trace);

        if (!trace.DidHit())
            break;

        const Vector lastStep = trace.endpos;
        step = trace.endpos;

        if ((end - start).Length() <= (step - start).Length())
            break;

        if (!trace_to_exit_short(step, dir, 5, 90))
            return FLT_MAX;

        thickness += (step - lastStep).Length();
    }
    return thickness;
}



void antiaim::edge_anti_aim(CUserCmd* m_pcmd)
{
    std::vector<angle_data> points;
    if (!g_cfg.antiaim.freestand)
        return;


    const auto local = g_ctx.local();



    const auto local_position = local->m_angEyeAngles();
    std::vector<float> scanned = {};

    for (auto i = 0; i <= m_globals()->m_maxclients; i++)
    {
        auto p_entity = dynamic_cast<player_t*>(m_entitylist()->GetClientEntity(i));
        if (p_entity == nullptr) continue;
        if (p_entity == local) continue;
        if (!p_entity->is_alive()) continue;
        if (p_entity->m_iTeamNum() == local->m_iTeamNum()) continue;
        if (p_entity->IsDormant()) continue;
        if (!p_entity->is_player()) continue;

        const auto view = math::calculate_angle(local_position, p_entity->m_angEyeAngles());

        std::vector<angle_data> angs;

        for (auto y = 1; y < 4; y++)
        {
            auto ang = quick_normalize((y * 90) + view.y, -180.f, 180.f);
            auto found = false; // check if we already have a similar angle

            for (auto i2 : scanned)
                if (abs(quick_normalize(i2 - ang, -180.f, 180.f)) < 20.f)
                    found = true;

            if (found)
                continue;

            points.emplace_back(ang, -1.f);
            scanned.push_back(ang);
        }
        //points.push_back(base_angle_data(view.y, angs)); // base yaws and angle data (base yaw needed for lby breaking etc)
    }

    for (auto i = 0; i <= m_globals()->m_maxclients; i++)
    {
        auto p_entity = dynamic_cast<player_t*>(m_entitylist()->GetClientEntity(i));
        if (p_entity == nullptr) continue;
        if (p_entity == local) continue;
        if (!p_entity->is_alive()) continue;
        if (p_entity->m_iTeamNum() == local->m_iTeamNum()) continue;
        if (p_entity->IsDormant()) continue;
        if (!p_entity->is_player()) continue;

        auto found = false;
        auto points_copy = points; // copy data so that we compair it to the original later to find the lowest thickness
        auto enemy_eyes = p_entity->m_angEyeAngles();

        for (auto& z : points_copy) // now we get the thickness for all of the data
        {
            const Vector tmp(10, z.angle, 0.0f);
            Vector head;
            math::AngleVectors(tmp, &head);
            head *= ((16.0f + 3.0f) + ((16.0f + 3.0f) * sin(DEG2RAD(10.0f)))) + 7.0f;
            head += local_position;
            const auto local_thickness = get_thickness(head, enemy_eyes); // i really need my source for this bit, i forgot how it works entirely Autowall :: GetThickness1 (head, hacks.m_local_player, p_entity);
            z.thickness = local_thickness;

            if (local_thickness!= 0) // if theres a thickness of 0 dont use this data
            {
                found = true;
            }
        }

        if (!found) // dont use
            continue;

        for (auto z = 0; points_copy.size() > z; z++)
            if (points_copy[z].thickness < points[z].thickness || points[z].thickness == -1) // find the lowest thickness so that we can hide our head best for all entities
                points[z].thickness = points_copy[z].thickness;

    }
    float best = 0;
    for (auto& i : points)
        if ((i.thickness > best || i.thickness == -1) && i.thickness!= 0) // find the best hiding spot (highest thickness)
        {
            best = i.thickness;
            m_pcmd->m_viewangles.y = i.angle;
            // auto ret = true;
        }
}

hpp :-

C++:
struct angle_data {
    float angle;
    float thickness;
    angle_data(const float angle, const float thickness) : angle(angle), thickness(thickness) {}
};
NOTE:- there's an anti paste
definition for angle_data? (start of function edge_anti_aim) because i dont have in my source
 
Сверху Снизу