C++ Исходник Anti-aim от старого сурса (Я сонный хватит реакций клоунов)

Забаненный
Статус
Оффлайн
Регистрация
11 Ноя 2019
Сообщения
8
Реакции[?]
1
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Я вспомнил что credit : Shonax

AntiAim.cpp

Код:
#include "AntiAim.h"
#include "..\Aimbot\Autowall.h"
#include "..\..\Utils\Utils.h"
#include "..\..\SDK\IVEngineClient.h"
#include "..\..\SDK\PlayerInfo.h"
#include "..\..\Utils\Math.h"
#include "..\..\Menu\Menu.h"
#include "../../Shonax_Cfg/shonax.h"
#include "../../Utils/Interfaces.h"
#include "../../SDK/InputSystem.h"
#include "../../Features/TriggerBot/TriggerBot.h"
#include "../../Features/Aimbot/Aimbot.h"
AntiAim g_AntiAim;

bool Swtich = false;
static bool dir = false;
static bool back = false;
static bool up = false;
static bool jitter = false;
static bool jitter2 = false;
bool stand_done = false;
bool move_done = false;
bool local_update;
//    bool swap_sides_stand = Options::Menu.MiscTab.desync_swapsides_stand.GetState();
//    bool swap_sides_move = Options::Menu.MiscTab.desync_swapsides_move.GetState();
float RandomBetween(float Min, float Max)
{
    return ((float(rand()) / float(RAND_MAX)) * (Max - Min)) + Min;
}
struct angle_data
{
    float angle;
    float thickness;
    angle_data(const float angle, const float thickness) : angle(angle), thickness(thickness) {}
};
void inline SinCos2(float radians, float* sine, float* cosine)
{
    *sine = sin(radians);
    *cosine = cos(radians);
}


float max_desync_angle() {
    auto local_player = g::pLocalEntity;
    auto animstate = uintptr_t(local_player->AnimState());

    float duckammount = *(float *)(animstate + 0xA4);
    float speedfraction = max(0, min(*reinterpret_cast<float*>(animstate + 0xF8), 1));

    float speedfactor = max(0, min(1, *reinterpret_cast<float*> (animstate + 0xFC)));

    float unk1 = ((*reinterpret_cast<float*> (animstate + 0x11C) * -0.30000001) - 0.19999999) * speedfraction;
    float unk2 = unk1 + 1.f;
    float unk3;

    if (duckammount > 0)
        unk2 += ((duckammount * speedfactor) * (0.5f - unk2));

    unk3 = *(float *)(animstate + 0x334) * unk2;

    return unk3;
}
float get_fixed_feet_yaw() {

    float current_feet_yaw = *(float *)(g::pLocalEntity->AnimState() + 0x80);

    if (current_feet_yaw >= -360)
        current_feet_yaw = min(current_feet_yaw, 360.0);

    return current_feet_yaw;
}
inline void SinCos(float radians, float *sine, float *cosine)
{
    *sine = sin(radians);
    *cosine = cos(radians);
}
inline void zxdAngleVectors(const QAngle &angles, Vector *forward)
{
    float sp, sy, cp, cy;

    SinCos(DEG2RAD(angles.y), &sy, &cy);
    SinCos(DEG2RAD(angles.x), &sp, &cp);

    forward->x = cp * cy;
    forward->y = cp * sy;
    forward->z = -sp;
}
inline float sseSqrt(float x)
{
    //return sqrtf(x);

    float root = 0.0f;

    __asm
    {
        sqrtss xmm0, x
        movss root, xmm0
    }

    return root;
}
inline void zxdVectorAngles(Vector forward, QAngle& angles)
{
    //Assert(s_bMathlibInitialized);
    float yaw, pitch;

    if (forward[1] == 0 && forward[0] == 0)
    {
        yaw = 0;
        if (forward[2] > 0)
            pitch = 270;
        else
            pitch = 90;
    }
    else
    {
        yaw = (atan2(forward[1], forward[0]) * 180 / M_PI);
        if (yaw < 0)
            yaw += 360;

        float tmp = sseSqrt(forward[0] * forward[0] + forward[1] * forward[1]);
        pitch = (atan2(-forward[2], tmp) * 180 / M_PI);
        if (pitch < 0)
            pitch += 360;
    }

    angles[0] = pitch;
    angles[1] = yaw;
    angles[2] = 0;
}
inline QAngle zxdCalcAngle(const Vector& src, const Vector& dst)
{
    Vector delta = dst - src;
    QAngle angles;
    zxdVectorAngles(delta, angles);

    return angles;
}
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;
}
void AngleVectorsQAng(const QAngle& angles, Vector* forward)
{
    float sp, sy, cp, cy;

    SinCos2(DEG2RAD(angles.y), &sy, &cy);
    SinCos2(DEG2RAD(angles.x), &sp, &cp);

    forward->x = cp * cy;
    forward->y = cp * sy;
    forward->z = -sp;
}
bool next_lby_update2()
{


    if (!g::pLocalEntity)
        return false;

    static float next_lby_update_time = 0;
    float curtime = g_pGlobalVars->curtime;
    local_update = next_lby_update_time;

    auto animstate = g::pLocalEntity->AnimState();

    if (!animstate)
        return false;

    if (!(g::pLocalEntity->GetFlags() & FL_ONGROUND))
        return false;

    if (animstate->speed_2d > 0.1f)
        next_lby_update_time = curtime + 0.22f;

    if (next_lby_update_time < curtime)
    {
        next_lby_update_time = curtime + 1.1f;
        return true;
    }

    return false;
}
float stand_range = Shonax.Antiaim.standrange;
float move_range = Shonax.Antiaim.moverange;
float fov_player(Vector ViewOffSet, Vector View, C_BaseEntity* entity, int hitbox)
{
    const float MaxDegrees = 180.0f;
    Vector Angles = View, Origin = ViewOffSet;
    Vector Delta(0, 0, 0), Forward(0, 0, 0);
    Vector AimPos = entity->GetHitboxPositionxd(hitbox);

    g_Math.AngleVectors(Angles, &Forward);
    g_Math.VectorSubtract(AimPos, Origin, Delta);
    g_Math.NormalizeNum(Delta, Delta);

    float DotProduct = Forward.Dot(Delta);
    return (acos(DotProduct) * (MaxDegrees / M_PI));
}
int closest_to_crosshair()
{
    int index = -1;
    float lowest_fov = INT_MAX;

    
    if (!g::pLocalEntity)
        return -1;

    Vector local_position = g::pLocalEntity->GetOrigin() + g::pLocalEntity->GetViewOffset();

    Vector angles;
    g_pEngine->GetViewAngles(angles);

    for (int i = 1; i <= g_pGlobalVars->maxClients; i++)
    {
        C_BaseEntity *entity = g_pEntityList->GetClientEntity(i);

        if (!entity || entity->GetHealth() <= 0 || entity->GetTeam() == g::pLocalEntity->GetTeam() || entity->IsDormant() || entity == g::pLocalEntity)
            continue;

        float fov = fov_player(local_position, angles, entity, 0);

        if (fov < lowest_fov)
        {
            lowest_fov = fov;
            index = i;
        }
    }

    return index;
}
float BalanceDumpedFromPolak(int type) {
    auto net_channel = *reinterpret_cast<INetChannel**>(reinterpret_cast<std::uintptr_t>(g_pClientState) + 0x9C);

    float desync = max_desync_angle();

    float balance = 1.0f;
    if (type == 2)
        balance = -1.0f;

    if (g_pGlobalVars->curtime <= next_lby_update2()) {
        if (net_channel->choked_packets >= 2)
            return quick_normalize(g::pCmd->viewangles.y, -180.f, 180.f);

        if (type == 1)
            return -100.0f;
        else
            return +(balance * 120.0f);
    }
    else if (type != 1) {
        return -((desync + 30.0f) * balance);
    }
}
bool next_lby_update(const float yaw_to_break)
{
    auto local_player = g_pEntityList->GetClientEntity(g_pEngine->GetLocalPlayer());

    static float next_lby_update_time = 0.f;

    float curtime = (float)(local_player->GetTickBase()  * g_pGlobalVars->intervalPerTick);

    auto animstate = local_player->AnimState();

    if (!animstate)
        return false;

    if (local_player->GetFlags() & FL_ONGROUND)
    {
        if (animstate->speed_2d > 15)  // скорость > 15 (игрок двигается вперёд назад вперёд назад)
        {
            next_lby_update_time = curtime + 0.22; // на муве таймер + 0.22
        }


        if (next_lby_update_time < curtime)
        {
            next_lby_update_time = curtime + 1.1; // на стендах таймер + 1.1
            return true;
        }

    }
    return false;
}
void polak(int type)
{
    float desync = max_desync_angle();
    float balance = 1.0f;
    if (type == 2)
        balance = -1.0f;

    if (g_pGlobalVars->curtime <= next_lby_update(g::pCmd->viewangles.y)) {
        if (g_pEngine->GetNetChannel()->m_nChokedPackets >= 2) {
            g::pCmd->viewangles.y = g_Math.NormalizeYaw(g::pCmd->viewangles.y);
            return;
        }

        if (type == 1)
            g::pCmd->viewangles.y -= 100.0f;
        else
            g::pCmd->viewangles.y += (balance * 120.0f);
    }
    else if (type != 1) {
        g::pCmd->viewangles.y -= (desync + 30.0f) * balance;
    }
}
void FreeStanding()
{
    std::vector< angle_data > points;
    if (!g::pLocalEntity) return;
    auto local_position = g::pLocalEntity->GetEyePosition();
    std::vector< float > scanned = {};

    for (auto i = 0; i <= g_pEngine->GetMaxClients(); i++) {
        auto enemy = dynamic_cast<C_BaseEntity*>(g_pEntityList->GetClientEntity(i));
        if (enemy == nullptr) continue;
        if (enemy == g::pLocalEntity) continue;
        if (!enemy->IsAlive()) continue;
        if (enemy->GetTeam() == g::pLocalEntity->GetTeam()) continue;
        if (enemy->IsDormant()) continue;
        if (!enemy->IsPlayer()) continue;

        const auto view = zxdCalcAngle(local_position, enemy->GetEyePosition());

        std::vector< angle_data > angs;

        for (auto y = 0; y < 8; y++) {
            auto ang = quick_normalize((y * 45) + 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)
    }
    auto found = false;
    for (auto i = 0; i <= g_pEngine->GetMaxClients(); i++) {
        auto enemy = dynamic_cast<C_BaseEntity*>(g_pEntityList->GetClientEntity(i));
        if (enemy == nullptr) continue;
        if (enemy == g::pLocalEntity) continue;
        if (!enemy->IsAlive()) continue;
        if (enemy->GetTeam() == g::pLocalEntity->GetTeam()) continue;
        if (enemy->IsDormant()) continue;
        if (!enemy->IsPlayer()) continue;

        
        auto points_copy = points; // copy data so that we compare it to the original later to find the lowest thickness
        auto enemy_eyes = enemy->GetEyePosition();

        for (auto &z : points_copy) // now we get the thickness for all of the data
        {
            const QAngle tmp(10, z.angle, 0.0f);
            Vector head;
            zxdAngleVectors(tmp, &head);
            head *= ((16.0f + 3.0f) + ((16.0f + 3.0f) * sin(DEG2RAD(10.0f)))) + 7.0f;
            head += local_position;
            float distance = -1;
            auto enemy_weapon = enemy->GetActiveWeapon();
            if (enemy_weapon) {
                auto weapon_data = enemy_weapon->GetCSWpnData();
                if (weapon_data)
                    distance = weapon_data->range;
            }
            float local_thickness = g_Autowall->get_thickness(head, enemy_eyes, distance);
            z.thickness = local_thickness;

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

        if (!found) // dont use, completely visible to this player or data is invalid
        {
            
            continue;
        }
            

        for (unsigned int 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;
    if (found)
    {
        for (auto &i : points)
            if ((i.thickness > best || i.thickness == -1) && i.thickness != 0)
                // find the best hiding spot (highest thickness)
            {
                best = i.thickness;
                g::pCmd->viewangles.y = i.angle;
                g::freestandyaw = g::pCmd->viewangles.y;
            }
    }
    else
    {
        g::pCmd->viewangles.y += 179;
        g::freestandyaw = g::pCmd->viewangles.y;
    }
        
}
/*void FreeStanding(bool isdesync)
{
    auto local_player = g::pLocalEntity;

    if (!local_player)
        return;
    float range = Shonax.freestandrange;
    static float last_real;
    static int Ticks = 0;
    bool no_active = true;
    float bestrotation = 0.f;
    float highestthickness = 0.f;
    Vector besthead;

    auto leyepos = local_player->GetVecOrigin() + local_player->GetViewOffset();
    auto headpos = g_Aimbot.get_hitbox_pos(local_player, 0);
    auto origin = local_player->GetAbsOrigin();

    auto checkWallThickness = [&](C_BaseEntity* pPlayer, Vector newhead) -> float
    {
        Vector endpos1, endpos2;
        Vector eyepos = pPlayer->GetVecOrigin() + pPlayer->GetViewOffset();

        C_Ray ray(newhead, eyepos);


        CTraceFilterSkipTwoEntities filter(pPlayer, local_player);

        C_Trace trace1, trace2;
        g_pTrace->TraceRay(ray, MASK_SHOT_BRUSHONLY, &filter, &trace1);

        if (trace1.DidHit())
            endpos1 = trace1.end;
        else
            return 0.f;

        ray.Init(eyepos, newhead);
        g_pTrace->TraceRay(ray, MASK_SHOT_BRUSHONLY, &filter, &trace2);

        if (trace2.DidHit())
            endpos2 = trace2.end;

        float add = newhead.DistTo(eyepos) - leyepos.DistTo(eyepos) + 3.f;
        return endpos1.DistTo(endpos2) + add / 3;
    };

    int index = closest_to_crosshair();

    static C_BaseEntity* entity;

    if (index != -1)
    {
        entity = g_pEntityList->GetClientEntity(index);
    }

    float step = (2 * M_PI) / 18.f; // One PI = half a circle ( for stacker cause low iq :sunglasses: ), 28

    float radius = fabs(Vector(headpos - origin).Length2D());

    if (index == -1)
    {
        no_active = true;
    }
    else
    {
        for (float rotation = 0; rotation < (M_PI * 2.0); rotation += step)
        {
            Vector newhead(radius * cos(rotation) + leyepos.x, radius * sin(rotation) + leyepos.y, leyepos.z);

            float totalthickness = 0.f;

            no_active = false;

            totalthickness += checkWallThickness(entity, newhead);

            if (totalthickness > highestthickness)
            {
                highestthickness = totalthickness;
                bestrotation = rotation;
                besthead = newhead;
            }
        }
    }

    if (g::bSendPacket && Shonax.Antiaim.DesyncAngle)
    {

    }
    else
    {
        {
            if (no_active)
            {
                g::pCmd->viewangles.y += 179.000000;

            }
            else
            {
                if (!isdesync)
                {
                    switch (Shonax.freetype)
                    {
                    case 0:
                        g::pCmd->viewangles.y = RAD2DEG(bestrotation);

                        break;
                    case 1:
                    {
                        if (jitter)
                            g::pCmd->viewangles.y = RAD2DEG(bestrotation) - range;
                        else
                            g::pCmd->viewangles.y = RAD2DEG(bestrotation) + range;

                        jitter = !jitter;
                    }
                    break;
                    case 2:
                    {
                        g::pCmd->viewangles.y = RAD2DEG(bestrotation) + RandomBetween(range, -range);
                    }
                    break;
                    case 3:
                    {
                        g::pCmd->viewangles.y -= Ticks;
                        Ticks += 5;
                        if (Ticks > (RAD2DEG(bestrotation) + range))
                            Ticks = (RAD2DEG(bestrotation) - range);
                    }
                    break;
                    }
                }
                else
                {
                    g::pCmd->viewangles.y = RAD2DEG(bestrotation);
                }

            }



        }
        last_real = g::pCmd->viewangles.y;
    }
}*/








float random_float(float min, float max) {
    typedef float(*RandomFloat_t)(float, float);
    static RandomFloat_t m_RandomFloat = (RandomFloat_t)GetProcAddress(GetModuleHandle("vstdlib.dll"), "RandomFloat");
    return m_RandomFloat(min, max);
}
float AntiAim::get_feet_yaw()
{
    auto local_player = g::pLocalEntity;

    if (!local_player)
        return 0.f;

    auto state = local_player->GetBasePlayerAnimState();

    float current_feet_yaw = state->m_flGoalFeetYaw;

    if (current_feet_yaw >= -360)
        current_feet_yaw = min(current_feet_yaw, 360.f);

    return current_feet_yaw;
}
float AntiAim::do_desync(CUserCmd * cmd, bool moving)
{
    if (!cmd)
        return { };
    float yaw;
    if (!moving)
    {
        switch (Shonax.Antiaim.StandDesync)
        {
        case 0: yaw = desync_simple(cmd, moving);
            break;
        case 1: yaw = desync_default(cmd, moving);
            break;
        case 2: yaw = desync_default(cmd, moving);
            break;
        case 3: yaw = desync_default(cmd, moving);
            break;
        case 4: yaw = desync_default(cmd, moving);//desync_spin(cmd, moving);
            break;
        case 5: yaw = desync_default(cmd, moving);
            break;
        case 6: yaw = desync_default(cmd, moving);
            break;
        case 7: yaw = desync_default(cmd, moving);
            break;
        }
        return yaw;
    }

    if (moving)
    {
        switch (Shonax.Antiaim.MoveDesync)
        {
        case 0: yaw = desync_simple(cmd, moving);
            break;
        case 1: yaw = desync_default(cmd, moving);
            break;
        case 2: yaw = desync_default(cmd, moving);
            break;
        case 3: yaw = desync_default(cmd, moving);
            break;
        case 4: yaw = desync_default(cmd, moving);
            break;
        case 5: yaw = desync_default(cmd, moving);
            break;
        case 6: yaw = desync_default(cmd, moving);
            break;
        case 7: yaw = desync_default(cmd, moving);
            break;
        }
        return yaw;
    }
}
float AntiAim::desync_simple(CUserCmd * cmd, bool moving)
{
    float yaw;
    jitter2 = !jitter2;
    yaw = jitter2 ? g::RealAngle.y + 58 : g::RealAngle.y - 58;
    g::FakeAngle.y = cmd->viewangles.y;
    return yaw;
}
float AntiAim::desync_default(CUserCmd * cmd, bool moving)
{
    float yaw;
    auto local_player = g::pLocalEntity;

    if (!local_player)
        return { };

    float r = moving ? move_range : stand_range;

    bool done = false;

    //    *local_player->GetBasePlayerAnimState()->feetyaw() += jitter2 ? -r : r;
    if (!done)
    {
        yaw = g::RealAngle.y + random_float(29, -29);
        cmd->viewangles.y += r;
        done = true;
    }
    else
    {
        yaw = g::RealAngle.y + random_float(29, -29);
        cmd->viewangles.y -= r;
        done = false;
    }
    jitter2 = !jitter2;
    *local_player->GetBasePlayerAnimState()->feetyaw() += (moving ? (jitter2 ? 29 : 0) : (jitter2 ? 40.f : 0));
    g::FakeAngle.y = cmd->viewangles.y;
    return yaw;
}
void MakeDesync() // dont use it please
{
    static bool doswitch;
    doswitch = !doswitch; // switch
    static float side; // +-
    if (doswitch)
        side = 1;
    else
        side = -1;

    if (g::pLocalEntity->AnimState())
    {
        if (Shonax.Antiaim.StandDesync == 1)
        {
            g::pCmd->viewangles.y = g_Math.NormalizeYaw(g_Math.NormalizeYaw(g::pLocalEntity->AnimState()->m_flGoalFeetYaw) + max_desync_angle() - side);
            
        }
        else if (Shonax.Antiaim.StandDesync == 2)
        {
            g::pCmd->viewangles.y = g_Math.NormalizeYaw(g_Math.NormalizeYaw(g::pLocalEntity->AnimState()->m_flGoalFeetYaw) - max_desync_angle() + side);
        
        }
        else if (Shonax.Antiaim.StandDesync == 3)
        {
            g::pCmd->viewangles.y = g_Math.NormalizeYaw(g_Math.NormalizeYaw(g::pLocalEntity->AnimState()->m_flGoalFeetYaw) + ((max_desync_angle() * side) - side));
            
        }
        else if (Shonax.Antiaim.StandDesync == 4)
        {
            // del because supreme
        }
    }
    
}

void ZAnti(CUserCmd* cmd, int v)
{
    constexpr auto maxRange = 90.0f;

    // where you want your head to go
    constexpr auto angleAdditive = 179.0f;

    // to make it equal on both sides / by 2
    if (v != 999)
        cmd->viewangles.y += angleAdditive - maxRange / 2.f + std::fmodf(g_pGlobalVars->curtime * 60, maxRange) + Shonax.Antiaim.yawoffset[v];
    else
        cmd->viewangles.y += angleAdditive - maxRange / 2.f + std::fmodf(g_pGlobalVars->curtime * 60, maxRange) + Shonax.newfeatures.yawoffset;
}
void yaw(int version)
{
    static float last_real;

    Vector angles; g_pEngine->GetViewAngles(angles);
    if (Shonax.Aimbot.Weapon[Shonax.number].SlowWalk && GetAsyncKeyState(VK_SHIFT))
    {

        switch (Shonax.newfeatures.slowyaw)
        {
        case 0: break;
        case 1: g::pCmd->viewangles.y += 179.f + Shonax.newfeatures.yawoffset; break;
        case 2: {
            if (Shonax.Antiaim.flip_bool)
                g::pCmd->viewangles.y -= 90 + Shonax.newfeatures.yawoffset;
            else
                g::pCmd->viewangles.y += 90 + Shonax.newfeatures.yawoffset;
        } break;
        case 3: g::pCmd->viewangles.y += 180 + ((rand() % 15) - (15 * 0.5f)) + Shonax.newfeatures.yawoffset; break;
        case 4: FreeStanding(); break;
        case 5: ZAnti(g::pCmd, 999); break;
        case 6: {
            static int addvalue = 5;
            addvalue += 5;
            g::pCmd->viewangles.y += addvalue + Shonax.newfeatures.yawoffset;
        } break;
        case 7: {
            static int addvalueFast = 20;
            addvalueFast += 20;
            g::pCmd->viewangles.y += addvalueFast + Shonax.newfeatures.yawoffset;
        } break;
        }

    }
    else
    {
    
        switch (Shonax.Antiaim.yaw[version])
        {
            case 0: break;
            case 1: g::pCmd->viewangles.y += 179.f + Shonax.Antiaim.yawoffset[version]; break;
            case 2: {
                if (Shonax.Antiaim.flip_bool)
                    g::pCmd->viewangles.y -= 90 + Shonax.Antiaim.yawoffset[version];
                else
                    g::pCmd->viewangles.y += 90 + Shonax.Antiaim.yawoffset[version];
            } break;
            case 3: g::pCmd->viewangles.y += 180 + ((rand() % 15) - (15 * 0.5f)) + Shonax.Antiaim.yawoffset[version]; break;
            case 4: FreeStanding(); break;
            case 5: ZAnti(g::pCmd, version); break;
            case 6: {
                static int addvalue = 5;
                addvalue += 5;
                g::pCmd->viewangles.y += addvalue + Shonax.Antiaim.yawoffset[version];
            } break;
            case 7: {
                static int addvalueFast = 20;
                addvalueFast += 20;
                g::pCmd->viewangles.y += addvalueFast + Shonax.Antiaim.yawoffset[version];
            } break;
        }
        
    }
    
}

#include <directxmath.h>

float NormalizesAngles(float& angles)
{
    while (angles < -180.0f)
    {
        angles += 360.0f;
    }
    while (angles > 180.0f)
    {
        angles -= 360.0f;
    }
    return angles;
}
float m_flPreviousFeetYaw;
float m_flCurrentFeetYaw;
int JitterRangeZ;








float randnum(int Min, int Max)
{
    return ((rand() % (Max - Min)) + Min);
}
float GetDesyncDelta()
{
    auto animstate = uintptr_t(g::pLocalEntity->AnimState());
    float duckammount = *(float *)(animstate + 0xA4);
    float speedfraction = max(0, min(*reinterpret_cast< float* >(animstate + 0xF8), 1));
    float speedfactor = max(0, min(1, *reinterpret_cast< float* > (animstate + 0xFC)));
    float unk1 = ((*reinterpret_cast< float* > (animstate + 0x11C) * -0.30000001) - 0.19999999) * speedfraction;
    float unk2 = unk1 + 1.f;
    float unk3;

    if (duckammount > 0)
    {
        unk2 += ((duckammount * speedfactor) * (0.5f - unk2));
    }
    unk3 = *(float *)(animstate + 0x334) * unk2;
    return unk3 + randnum(-10, 0);
}

void Real()
{

        int local_flags = g::pLocalEntity->GetFlags();
        if ((g::pLocalEntity->GetVelocity().Length2D() < 80) && !(g::pCmd->buttons & IN_JUMP))
        {
            yaw(0);
            
        }
        else
        {
            if ((g::pLocalEntity->GetVelocity().Length2D() >= 80) && (!(g::pCmd->buttons & IN_JUMP) && (local_flags & FL_ONGROUND)))
            {
                yaw(1);
                
            }
            else
            {
                yaw(2);
                
                
            }
        }

        

    //}
}


float Fake()
{

    switch (Shonax.Antiaim.StandDesync) {
    case 1:
        return BalanceDumpedFromPolak(1);    //balance
    case 2:
        return BalanceDumpedFromPolak(2);    //strech
    case 3:
        //jitter
        if ((g::pCmd->viewangles.y - get_fixed_feet_yaw()) < max_desync_angle())
            return 180;
        else
            return max_desync_angle();
    }
    
}


float pitch(int version)
{
    float pitch;
    switch (Shonax.Antiaim.pitch[version])
    {
    case 0:
        pitch = 0;
        break;
    case 1:
        pitch = 89.0f;
        break;
    case 2:
        pitch = -89.0f;
        break;
    case 3:
        pitch = 89.0f;
        break;
    case 4:
        pitch = 1080.0f;
        break;
    case 5:
        pitch = -179.990005f;
        break;
    case 6:
        pitch = 971.0f;
        break;
    case 7:
    {
        static int AdaptiveDown = 1;
        static int Down = 2;
        static int AdaptiveUp = 3;
        static int Up = 4;
        static int JitterStep;
        if (JitterStep != 0)
        {
            if (JitterStep == AdaptiveDown)
            {
                pitch = 75.0f;
                JitterStep = randnum(2, 4);
            }
            else if (JitterStep == AdaptiveUp)
            {
                pitch = -35.0f;
                JitterStep = randnum(1, 2);
            }
            else if (JitterStep == Down)
            {
                pitch = 88.0f;
                JitterStep = randnum(1, 4);
            }
            else if (JitterStep == Up)
            {
                pitch = -47.0f;
                JitterStep = randnum(2, 3);
            }
        }
        else
        {
            JitterStep = randnum(1, 4);
        }

    }break;
    }

    return pitch;
}


float AntiAim::slowpitch(float speed)
{
    float pitch;
    switch (Shonax.newfeatures.slowpitch)
    {
    case 0:
        pitch = 0;
        break;
    case 1:
        pitch = 89.0f; // down
        break;
    case 2:
        pitch = -89.0f;
        break;
    case 3:
        pitch = 70.f;
        break;
    case 4:
        pitch = 1080.0f;
        break;
    case 5:
        pitch = -179.990005f;
        break;
    case 6:
        pitch = 971.0f;
        break;
    case 7:
    {
        static int AdaptiveDown = 1;
        static int Down = 2;
        static int AdaptiveUp = 3;
        static int Up = 4;
        static int JitterStep;
        if (JitterStep != 0)
        {
            if (JitterStep == AdaptiveDown)
            {
                pitch = 75.0f;
                JitterStep = randnum(2, 4);
            }
            else if (JitterStep == AdaptiveUp)
            {
                pitch = -77.0f;
                JitterStep = randnum(1, 2);
            }
            else if (JitterStep == Down)
            {
                pitch = 88.0f;
                JitterStep = randnum(1, 4);
            }
            else if (JitterStep == Up)
            {
                pitch = -88.0f;
                JitterStep = randnum(2, 3);
            }
        }
        else
        {
            JitterStep = randnum(1, 4);
        }
        
    }break;
        
    }

    return pitch;
}




static bool hold;

void AntiAim::OnCreateMove()
{


    if (!g_pEngine->IsInGame() || Shonax.Aimbot.legitbot[Shonax.number].LegitBacktrack)
        return;
    if (!g::pLocalEntity)
        return;

    if (!g::pLocalEntity->IsAlive())
        return;

    if (!Shonax.Antiaim.enable)
    {
        
        return;
    }

    if (!g::pLocalEntity->GetActiveWeapon())
        return;

    if (g::pLocalEntity->GetMoveType() == MoveType_t::MOVETYPE_LADDER)
    {
    
        g::pCmd->viewangles.x = 0;
        return;
    }

    float flServerTime = g::pLocalEntity->GetTickBase() * g_pGlobalVars->intervalPerTick;
    bool canShoot = (g::pLocalEntity->GetActiveWeapon()->GetNextPrimaryAttack() <= flServerTime);
    auto m_weapon = g::pLocalEntity->GetActiveWeapon();
    if (!m_weapon)
        return;

    if (m_weapon->is_grenade() && m_weapon->m_fThrowTime() > 0.f)
        return;

    if (canShoot && (g::pCmd->buttons & IN_ATTACK))
        return;

    if (g::pCmd->buttons & IN_USE)
        return;
    if (!m_weapon->GetCSWpnData()) return;
    if (m_weapon->GetCSWpnData()->type == 9) return;

    auto local_player = g::pLocalEntity;
    if (!local_player) return;
    if (local_player->GetHealth() <= 0) return;





    Vector oldAngle = g::pCmd->viewangles;
    float  oldForward = g::pCmd->forwardmove;
    float  oldSideMove = g::pCmd->sidemove;



    bool onground = (g::pLocalEntity->GetFlags() & FL_ONGROUND);
    

    if (g_pInputSystem->IsButtonDown(Shonax.Antiaim.flip_int) && !hold)
    {
        Shonax.Antiaim.flip_bool = !Shonax.Antiaim.flip_bool;
        hold = true;
    }
    else if (hold && !g_pInputSystem->IsButtonDown(Shonax.Antiaim.flip_int))
        hold = false;
    

    if (Shonax.Aimbot.Weapon[Shonax.number].SlowWalk && GetAsyncKeyState(VK_SHIFT))
        g::pCmd->viewangles.x = g_AntiAim.slowpitch(Shonax.Aimbot.Weapon[Shonax.number].Speed);
    else
    {
        int local_flags = g::pLocalEntity->GetFlags();
        if ((g::pLocalEntity->GetVelocity().Length2D() < 80) && !(g::pCmd->buttons & IN_JUMP))
            g::pCmd->viewangles.x = pitch(0);
        else
            if ((g::pLocalEntity->GetVelocity().Length2D() > 80) && (!(g::pCmd->buttons & IN_JUMP) && (local_flags & FL_ONGROUND)))
                g::pCmd->viewangles.x = pitch(1);
            else
                g::pCmd->viewangles.x = pitch(2);
    }
    

    
    if (g_pInputSystem->IsButtonDown(Shonax.Antiaim.aapanic))
    {
        Shonax.Antiaim.panicSwitch = !Shonax.Antiaim.panicSwitch;
        static int stage;
        stage = randnum(1, 5);
        if (stage != 3)
        {
            Shonax.Antiaim.panicSwitch ? g::pCmd->viewangles.y -= randnum(-48, 48) + randnum(-10, 10) + 179 : g::pCmd->viewangles.y += randnum(-28, 28) + randnum(-30, 30) + 179;
        }
        else
        {
            Shonax.Antiaim.panicSwitch ? g::pCmd->viewangles.y -= randnum(-128, 128) + randnum(-17, 17) + 58 : g::pCmd->viewangles.y += randnum(-64, 64) + randnum(-65, 79) - 58;
        }
    }
    else
    {
        if (Shonax.Antiaim.StandDesync != 0)
        {
            if (g::bSendPacket && Shonax.Antiaim.DesyncAngle && !g_pClientState->m_nChokedCommands)
            {

                //FreeStanding(true);
                MakeDesync();
                g::curang = g::pCmd->viewangles.y;
                g::FakeAngle = g::pCmd->viewangles;
                g::desyncang = max_desync_angle();
            }
            else
            {
                Real();
                g::curang = g::pCmd->viewangles.y;
                g::RealAngle = g::pCmd->viewangles;
            }
        }
        else
        {
            if (g::pLocalEntity->AnimState())
            {
                static bool doswitch;
                doswitch = !doswitch; // switch
                static float side; // сайд нужный для +- десинка
                if (doswitch)
                    side = 1;
                else
                    side = -1;
                auto yawfeetdelta = g::pCmd->viewangles.y - g_Math.NormalizeYaw(g::pLocalEntity->AnimState()->m_flGoalFeetYaw);
            


                


                if (g::pCmd->command_number % 3 && Shonax.Antiaim.DesyncAngle)
                {
                    
                    // Если yawfeetdelta меньше максдесинка - добавляем 180, иначе +- десинк
                

                    if (yawfeetdelta < max_desync_angle())
                    {
                        g::pCmd->viewangles.y += 180;
                    }
                    else
                    {
                        g::pCmd->viewangles.y += max_desync_angle();
                    }


                    g::curang = g::pCmd->viewangles.y;
                    g::FakeAngle = g::pCmd->viewangles;
                    g::desyncang = max_desync_angle();
                }
                else
                {
                    Real();
                    g::curang = g::pCmd->viewangles.y;
                    g::RealAngle = g::pCmd->viewangles;
                }
            }
        }
        float needtobreak = 120 + max_desync_angle();
        static bool firststage = true;
        if (next_lby_update2() && g::bSendPacket) // anti-paste lol
        {
            if (firststage)
            {
                g::pCmd->viewangles.y -= needtobreak;
                firststage = false;
            }
            else
            {
                g::pCmd->viewangles.y += needtobreak;
                firststage = true;
            }
            
        }

    }
    g::curpitch = g::pCmd->viewangles.x;
    

}
// Source leak by LegendWare
// nice try to find antipaste
AntiAim.h

Код:
#pragma once
#include "..\..\Utils\GlobalVars.h"
#include "..\..\SDK\CGlobalVarsBase.h"

class AntiAim
{
public:
    void OnCreateMove();
    float slowpitch(float speed);
    float slowyaw(float speed);
    float get_feet_yaw();

    float do_desync(CUserCmd * cmd, bool moving);

    float desync_simple(CUserCmd * cmd, bool moving);

    float desync_default(CUserCmd * cmd, bool moving);
private:
    
};
extern AntiAim g_AntiAim;
 
Начинающий
Статус
Оффлайн
Регистрация
9 Сен 2017
Сообщения
89
Реакции[?]
25
Поинты[?]
0
C++:
switch (Shonax.Antiaim.StandDesync)
        {
        case 0: yaw = desync_simple(cmd, moving);
            break;
        case 1: yaw = desync_default(cmd, moving);
            break;
        case 2: yaw = desync_default(cmd, moving);
            break;
        case 3: yaw = desync_default(cmd, moving);
            break;
        case 4: yaw = desync_default(cmd, moving);//desync_spin(cmd, moving);
            break;
        case 5: yaw = desync_default(cmd, moving);
            break;
        case 6: yaw = desync_default(cmd, moving);
            break;
        case 7: yaw = desync_default(cmd, moving);
            break;
        }
        return yaw;
what is this?
Using ternary operators would we better ig.
C++:
!Shonax.Antiaim.StandDesync ? yaw = desync_simple(cmd, moving) : yaw = desync_default(cmd, moving);
 
Сверху Снизу