Вопрос Legitbot no working in weave v2

Пользователь
Статус
Оффлайн
Регистрация
20 Июл 2017
Сообщения
203
Реакции[?]
116
Поинты[?]
0
Hello, I tried to add a legitbot from legendware to weave v2 but it doesn't work. There are no bugs, it just doesn't work. Ie. only the autopistol works from it; -; legitbot code
Код:
#include "Hooks.h"
#include "Features.h"
#include "Legitbot.h"
#define ZERO  Vector(0,0,0);

cweapon_legitconfig l_bociszek::CurrentSettings() {
    if (csgo->weapon->isPistol() && vars.legitbot.weapon[lweap_type::pistol].enable)
        return vars.legitbot.weapon[lweap_type::pistol];
    else if (csgo->weapon->isRifle() && vars.legitbot.weapon[lweap_type::rifle].enable)
        return vars.legitbot.weapon[lweap_type::rifle];

    else if (csgo->weapon->isSMG() && vars.legitbot.weapon[lweap_type::smg].enable)
        return vars.legitbot.weapon[lweap_type::smg];

    else if (csgo->weapon->isSniper() && vars.legitbot.weapon[lweap_type::sniper].enable)
        return vars.legitbot.weapon[lweap_type::sniper];
    else if (csgo->weapon->isShotgun() && vars.legitbot.weapon[lweap_type::shotgun].enable)
        return vars.legitbot.weapon[lweap_type::shotgun];
    else
        return vars.legitbot.weapon[lweap_type::defaultt];

}
void l_bociszek::do_smooth(const Vector& currentAngle, const Vector& aimAngle, Vector& angle)
{
    currentl_settings = CurrentSettings();
    auto smooth_value = smooth_t;
    if (smooth_value <= 1) {
        return;
    }

    static auto recoil_scale = interfaces.cvars->FindVar(str("weapon_recoil_scale"));

    aim_punch = csgo->local->GetPunchAngle() * recoil_scale->GetFloat();
    /*aim_punch *= (CurrentSettings().rcs / 100.f);*/
    aim_punch *= (currentl_settings.rcs / 100.f);
    Vector delta = aimAngle - (currentAngle + aim_punch);
    Math::normalize_angles(delta);

    if (currentl_settings.smooth_type == 1) {
        float randomize = Math::RandomFloat(-0.2f, 0.2f);
        smooth_value = (interfaces.global_vars->interval_per_tick * 64.0f) * (smooth_value + (randomize * smooth_value));
        smooth_value = Math::clamp(smooth_value, interfaces.global_vars->interval_per_tick * 64.0f * smooth_t, 13.f);
    }
    else {
        smooth_value = (interfaces.global_vars->interval_per_tick * 64.0f) * smooth_value;
    }

    delta /= smooth_value;
    angle = currentAngle + delta;
    Math::normalize_angles(angle);
}



bool IsNotTarget(IBasePlayer* e)
{
    if (!e)
        return true;

    if (e == csgo->local)
        return true;

    if (e->GetHealth() <= 0)
        return true;

    if (e->HasGunGameImmunity())
        return true;

    if (e->Get_Flags() & FL_FROZEN)
        return true;

    return false;
}
float l_bociszek::static_fov_to(const Vector& viewAngle, const Vector& aimAngle) {
    Vector delta = aimAngle - viewAngle;
    Math::normalize_angles(delta);
    return sqrtf(powf(delta.x, 2.0f) + powf(delta.y, 2.0f));
}

float dynamic_fov_to(float distance, const Vector& angle, const Vector& viewangles) {
    Vector aimingAt;
    Math::AngleVectors(viewangles, aimingAt);
    aimingAt *= distance;
    Vector aimAt;
    Math::AngleVectors(angle, aimAt);
    aimAt *= distance;
    return aimingAt.DistTo(aimAt) / 5;
}
bool in_smoke(const Vector& in, const Vector& out)
{
    //static auto LineGoesThroughSmokeFn = (bool(*)(Vector vStartPos, Vector vEndPos))util::FindSignature(crypt_str("client.dll"), crypt_str("55 8B EC 83 EC 08 8B 15 ? ? ? ? 0F 57 C0"));
    static auto LineGoesThroughSmokeFn = (bool(*)(Vector vStartPos, Vector vEndPos))((DWORD)(csgo->Utils.FindPatternIDA(GetModuleHandleA(
        g_Modules[fnva1(hs::engine_dll.s().c_str())]().c_str()),
        hs::in_smoke.s().c_str())));

    return LineGoesThroughSmokeFn(in, out);
}
float get_interpolation()
{
    static auto cl_interp = interfaces.cvars->FindVar(str("cl_interp")); //-V807
    static auto cl_interp_ratio = interfaces.cvars->FindVar(str("cl_interp_ratio"));
    static auto sv_client_min_interp_ratio = interfaces.cvars->FindVar(str("sv_client_min_interp_ratio"));
    static auto sv_client_max_interp_ratio = interfaces.cvars->FindVar(str("sv_client_max_interp_ratio"));
    static auto cl_updaterate = interfaces.cvars->FindVar(str("cl_updaterate"));
    static auto sv_minupdaterate = interfaces.cvars->FindVar(str("sv_minupdaterate"));
    static auto sv_maxupdaterate = interfaces.cvars->FindVar(str("sv_maxupdaterate"));

    auto updaterate = Math::clamp(cl_updaterate->GetFloat(), sv_minupdaterate->GetFloat(), sv_maxupdaterate->GetFloat());
    auto lerp_ratio = Math::clamp(cl_interp_ratio->GetFloat(), sv_client_min_interp_ratio->GetFloat(), sv_client_max_interp_ratio->GetFloat());

    return Math::clamp(lerp_ratio / updaterate, cl_interp->GetFloat(), 1.0f);
}
void l_bociszek::createmove(CUserCmd* cmd)
{
    if (!vars.legitbot.legitenable)
        return;

    currentl_settings = CurrentSettings();
   
   
    // rata-ta-ta-ta range
    calc_fov();

    bool should_do_rcs = false;
    static bool started_scope = false;
    static bool started_unscope = false;
    static int scope_delay = 0;
    static int autofire_delay = 0;
    bool is_delayed = false;
    bool shot_delay = false;
    float shot_delay_time = 0;

    // my gun can't shoot nigga >:(
    if (csgo->weapon->is_non_aim() || csgo->weapon->m_iClip1() <= 0)
    {
        target = nullptr;
        point = Vector(0, 0, 0);
        started_scope = false;
        started_unscope = false;
        scope_delay = 0;
        autofire_delay = 0;
        return;
    }

    if (!csgo->weapon->isSniper())
    {
        started_scope = false;
        started_unscope = false;
        scope_delay = 0;
    }

    if (csgo->weapon->isSniper() && started_unscope && csgo->weapon->can_fire(false) && csgo->local->IsScoped())
    {
        scope_delay = 0;
        cmd->buttons |= IN_ATTACK2;

        if (csgo->weapon->GetZoomLevel() == 3)
            started_unscope = false;

        return;
    }

    // rata-ta-ta-ta speed
    calc_smooth();

    // my pistols do pew-pew
    if (vars.legitbot.autopistol)
        auto_pistol(cmd);

    if (target_switch_delay > interfaces.global_vars->realtime)
    {
        point = Vector(0, 0, 0);
        target = nullptr;
        autofire_delay = 0;

        if ((g_Binds[bind_key].active || g_Binds[bind_autofire].active) && !currentl_settings.rcs_type)
            do_rcs(cmd);

        return;
    }

    // find the closest enemy to our crosshair
    target_index = -1;
    target = nullptr;
    find_target();

    if (!target->valid(false, true))
        target = nullptr;

    // rata-ta-ta-ta control
    if ((g_Binds[bind_key].active || g_Binds[bind_autofire].active) && !currentl_settings.rcs_type)
        should_do_rcs = true;

    if (!target)
    {
        point = Vector(0, 0, 0);
        autofire_delay = 0;

        if (should_do_rcs)
            do_rcs(cmd);

        return;
    }

    // legitbot key check
    if (!g_Binds[bind_key].active && !g_Binds[bind_autofire].active)
    {
        autofire_delay = 0;

        if (should_do_rcs)
            do_rcs(cmd);

        return;
    }

    // point to rata-ta-ta-ta
    auto is_silent = !csgo->local->get_m_iShotsFired() && currentl_settings.silent_fov;
    point = Vector(0, 0, 0);
    find_best_point(cmd, fov_t);

    if (point == Vector(0, 0, 0))
    {
        autofire_delay = 0;

        if (should_do_rcs)
            do_rcs(cmd);

        if (is_silent)
        {
            find_best_point(cmd, currentl_settings.silent_fov);
            if (point == Vector(0, 0, 0))
                return;
        }
        else
            return;
    }

    // is enemy in smoke?
    if (!vars.legitbot.check_smoke && in_smoke(csgo->eyepos, target->hitbox_position(0)))
    {
        autofire_delay = 0;

        if (should_do_rcs)
            do_rcs(cmd);

        return;
    }

    // are we flashed?
    if (!vars.legitbot.check_flash && csgo->local->GetFlashDuration() >= 0.1f)
    {
        autofire_delay = 0;

        if (should_do_rcs)
            do_rcs(cmd);

        return;
    }

    // is local in air?
    if (!vars.legitbot.air && !(csgo->local->Get_Flags() & FL_ONGROUND))
    {
        if (should_do_rcs)
            do_rcs(cmd);

        return;
    }

    if (!csgo->local->get_m_iShotsFired() && g_Binds[bind_autofire].active && autofire_delay < currentl_settings.autofire_delay)
    {
        autofire_delay += 1;
        return;
    }
    else if (!csgo->local->get_m_iShotsFired())
        autofire_delay = 0;

    auto weapon = csgo->weapon;

    if (currentl_settings.autoscope && (!csgo->local->IsScoped() || (started_scope && scope_delay > 9)) && weapon->isSniper())
    {
        cmd->buttons |= IN_ATTACK2;
        cmd->buttons &= ~IN_ATTACK;

        started_scope = true;
        scope_delay += 1;

        return;
    }

    scope_delay = 0;
    started_scope = false;

    // are we not in scope or not ready to shoot after scope and we dont use autoscope?
    if (weapon->isSniper() &&
        currentl_settings.zoomonly && !currentl_settings.autoscope && !csgo->local->IsScoped())
    {
        if (should_do_rcs)
            do_rcs(cmd);

        return;
    }

    auto is_silent_s = !csgo->local->get_m_iShotsFired() && currentl_settings.silent_fov && target_fov <= currentl_settings.silent_fov;

    if (currentl_settings.auto_stop)
        cmd->forwardmove = cmd->sidemove = 0;

    aim_angle = Math::CalculateAngle(csgo->eyepos, point).Clamp();

    if (!is_silent_s)
        do_smooth(cmd->viewangles, aim_angle, aim_angle);

    Math::normalize_angles(aim_angle);

    cmd->viewangles = aim_angle;
    cmd->tick_count = TIME_TO_TICKS(target->GetSimulationTime() + get_interpolation());

    if (!is_silent_s)
        interfaces.engine->SetViewAngles(cmd->viewangles);

    if (currentl_settings.rcs_type || should_do_rcs)
        do_rcs(cmd);

    auto hitchanced = hitchance(target, aim_angle, point, targets[target->EntIndex()].hitbox) >= currentl_settings.autofire_hitchance;

    if (g_Binds[bind_autofire].active && csgo->weapon->can_fire(true) && hitchanced)
        cmd->buttons |= IN_ATTACK;

    if (cmd->buttons & IN_ATTACK && !started_unscope)
        if (csgo->weapon->isSniper())
            started_unscope = true;
}

void l_bociszek::calc_fov()
{
    currentl_settings = CurrentSettings();
    if (csgo->local->get_m_iShotsFired() < 2)
        fov_t = currentl_settings.fov;

    else if (csgo->local->get_m_iShotsFired() >= 2 && currentl_settings.custom_rcs_fov > 0.f)
        fov_t = currentl_settings.custom_rcs_fov;

    else
        fov_t = currentl_settings.fov;
}

void l_bociszek::calc_smooth()
{
    currentl_settings = CurrentSettings();
    if (csgo->local->get_m_iShotsFired() < 2)
        smooth_t = currentl_settings.smooth;

    else if (csgo->local->get_m_iShotsFired() >= 2 && currentl_settings.custom_rcs_smooth >= 1.f)
        smooth_t = currentl_settings.custom_rcs_smooth;

    else
        smooth_t = currentl_settings.smooth;
}

void l_bociszek::do_rcs(CUserCmd* cmd)
{
    auto weapon = csgo->weapon;
    static Vector prev_punch = { 0.0f, 0.0f, 0.0f };

    if (weapon->GetItemDefinitionIndex() == WEAPON_REVOLVER
        || currentl_settings.rcs <= 0
        || weapon->is_non_aim()
        || csgo->local->GetShootsFired() < 2)
    {
        prev_punch = Vector(0, 0, 0);
        return;
    }

    static auto recoil_scale = interfaces.cvars->FindVar("weapon_recoil_scale")->GetFloat();
    aim_punch = csgo->local->GetPunchAngle() * recoil_scale;

    // rcs in %
    aim_punch *= (currentl_settings.rcs / 100.f);

    auto rcs = cmd->viewangles += (prev_punch - aim_punch);
    Math::normalize_angles(rcs);
    interfaces.engine->SetViewAngles(rcs);

    prev_punch = aim_punch;
}

void l_bociszek::auto_pistol(CUserCmd* cmd)
{
    auto weapon = csgo->weapon;

    if (!weapon->isPistol()
        || weapon->GetItemDefinitionIndex() == WEAPON_REVOLVER
        || weapon->m_iClip1() <= 0)
        return;

    static bool is_firing = false;

    if (cmd->buttons & IN_ATTACK) {
        if (is_firing) {
            cmd->buttons &= ~IN_ATTACK;
        }
    }

    is_firing = cmd->buttons & IN_ATTACK;
}

void l_bociszek::find_best_point(CUserCmd* cmd, float fov_v)
{

    currentl_settings = CurrentSettings();
    static auto recoil_scale = interfaces.cvars->FindVar("weapon_recoil_scale")->GetFloat();
    aim_punch = csgo->local->GetPunchAngle() * recoil_scale;
    aim_punch *= (currentl_settings.rcs / 100.f);

    auto best_fov = fov_v;

    // if nearest aimbot method
    if (currentl_settings.priority == 0)
    {
        for (auto bone : { HITBOX_HEAD, HITBOX_PELVIS, HITBOX_CHEST, HITBOX_UPPER_CHEST, HITBOX_STOMACH })
        {
            float distance = 0.f;
            float fov = FLT_MAX;
            Vector ang = Vector(0, 0, 0);

            auto bone_pos = target->hitbox_position(bone);
            Math::VectorAngles(bone_pos - csgo->eyepos, ang);
            Math::normalize_angles(ang);
            distance = csgo->eyepos.DistTo(bone_pos);

            if (currentl_settings.fov_type == 1)
                fov = dynamic_fov_to(distance, ang, cmd->viewangles + aim_punch);
            else
                fov = static_fov_to(cmd->viewangles + aim_punch, ang);

            if (fov > best_fov)
                continue;

            auto fire_data = g_AutoWall->Think(bone_pos, target);

            Ray_t ray;
            ray.Init(csgo->local->m_vecOrigin() + csgo->local->GetVecViewOffset(), bone_pos);

            CTraceFilter filter;
            filter.pSkip = csgo->local;

            trace_t tr;
            interfaces.trace->TraceRay(ray, MASK_SHOT | CONTENTS_GRATE, &filter, &tr);


            /*if (!fire_data.visible && !currentl_settings.awall_dmg)
                continue;*/

            /*if (currentl_settings.min_ldamage > 0 && fire_data.m_damage < currentl_settings.min_ldamage)
                continue;*/

            best_fov = fov;
            point = bone_pos;
            target_fov = fov;
            targets[target->EntIndex()].hitbox = bone;
        }
    }
    else if (currentl_settings.priority == 1) // head only
    {
        float distance = 0.f;
        float fov = FLT_MAX;
        Vector ang = Vector(0, 0, 0);

        auto bone_pos = target->hitbox_position(0);
        Math::VectorAngles(bone_pos - csgo->eyepos, ang);
        Math::normalize_angles(ang);
        distance = csgo->eyepos.DistTo(bone_pos);

        if (currentl_settings.fov_type == 1)
            fov = dynamic_fov_to(distance, ang, cmd->viewangles + aim_punch);
        else
            fov = static_fov_to(cmd->viewangles + aim_punch, ang);

        if (fov > best_fov)
            return;

        //auto fire_data = g_AutoWall->Think(bone_pos, target);

        Ray_t ray;
        ray.Init(csgo->local->m_vecOrigin() + csgo->local->GetVecViewOffset(), bone_pos);

        CTraceFilter filter;
        filter.pSkip = csgo->local;

        trace_t tr;
        interfaces.trace->TraceRay(ray, MASK_SHOT | CONTENTS_GRATE, &filter, &tr);


        /*if (!fire_data.visible && !currentl_settings.awall_dmg)
            return;*/

        /*if (currentl_settings.min_ldamage > 0 && fire_data.m_damage < currentl_settings.min_ldamage)
            return;*/

        best_fov = fov;
        point = bone_pos;
        target_fov = fov;
        targets[target->EntIndex()].hitbox = 0;
    }
    else if (currentl_settings.priority == 2) // nearest body
    {
        for (auto bone : { HITBOX_PELVIS, HITBOX_CHEST, HITBOX_UPPER_CHEST, HITBOX_STOMACH }) {
            float distance = 0.f;
            float fov = FLT_MAX;
            Vector ang = Vector(0, 0, 0);

            auto bone_pos = target->hitbox_position(bone);
            Math::VectorAngles(bone_pos - csgo->eyepos, ang);
            Math::normalize_angles(ang);
            distance = csgo->eyepos.DistTo(bone_pos);

            if (currentl_settings.fov_type == 1)
                fov = dynamic_fov_to(distance, ang, cmd->viewangles + aim_punch);
            else
                fov = static_fov_to(cmd->viewangles + aim_punch, ang);

            if (fov > best_fov)
                continue;

            Ray_t ray;
            ray.Init(csgo->local->m_vecOrigin() + csgo->local->GetVecViewOffset(), bone_pos);

            CTraceFilter filter;
            filter.pSkip = csgo->local;

            trace_t tr;
            interfaces.trace->TraceRay(ray, MASK_SHOT | CONTENTS_GRATE, &filter, &tr);

            //auto fire_data = g_AutoWall->Think(bone_pos, target);

            /*if (!fire_data.visible && !currentl_settings.awall_dmg)
                continue;*/

            /*if (currentl_settings.min_ldamage > 0 && fire_data.m_damage < currentl_settings.min_ldamage)
                continue;*/

            best_fov = fov;
            point = bone_pos;
            target_fov = fov;
            targets[target->EntIndex()].hitbox = bone;
        }
    }
}
int l_bociszek::hitchance(IBasePlayer* target, const Vector& aim_angle, const Vector& point, int hitbox) //-V688
{
    auto final_hitchance = 0;
    auto weapon_info = csgo->weapon->GetCSWpnData();
    currentl_settings = CurrentSettings();
    if (!weapon_info)
        return final_hitchance;

    if ((csgo->eyepos - point).Length() > weapon_info->m_flRange)
        return final_hitchance;

    auto forward = ZERO;
    auto right = ZERO;
    auto up = ZERO;

    Math::AngleVectors(aim_angle, &forward, &right, &up);

    Math::fast_vec_normalize(forward);
    Math::fast_vec_normalize(right);
    Math::fast_vec_normalize(up);

    auto is_special_weapon = csgo->weapon->GetItemDefinitionIndex() == WEAPON_AWP || csgo->weapon->GetItemDefinitionIndex() == WEAPON_G3SG1 || csgo->weapon->GetItemDefinitionIndex() == WEAPON_SCAR20 || csgo->weapon->GetItemDefinitionIndex() == WEAPON_SSG08;
    auto inaccuracy = weapon_info->flInaccuracyStand;

    if (csgo->local->Get_Flags() & FL_DUCKING)
    {
        if (is_special_weapon)
            inaccuracy = weapon_info->flInaccuracyCrouchAlt;
        else
            inaccuracy = weapon_info->flInaccuracyCrouch;
    }
    else if (is_special_weapon)
        inaccuracy = weapon_info->flInaccuracyStandAlt;

    if (csgo->innacuracy - 0.000001f < inaccuracy)
        final_hitchance = 101;
    else
    {
        static auto setup_spread_values = true;
        static float spread_values[256][6];

        if (setup_spread_values)
        {
            setup_spread_values = false;

            for (auto i = 0; i < 256; ++i)
            {
                Math::random_seed(i + 1);

                auto a = Math::RandomFloat(0.0f, 1.0f);
                auto b = Math::RandomFloat(0.0f, DirectX::XM_2PI);
                auto c = Math::RandomFloat(0.0f, 1.0f);
                auto d = Math::RandomFloat(0.0f, DirectX::XM_2PI);

                spread_values[i][0] = a;
                spread_values[i][1] = c;

                auto sin_b = 0.0f, cos_b = 0.0f;
                DirectX::XMScalarSinCos(&sin_b, &cos_b, b);

                auto sin_d = 0.0f, cos_d = 0.0f;
                DirectX::XMScalarSinCos(&sin_d, &cos_d, d);

                spread_values[i][2] = sin_b;
                spread_values[i][3] = cos_b;
                spread_values[i][4] = sin_d;
                spread_values[i][5] = cos_d;
            }
        }

        auto hits = 0;

        for (auto i = 0; i < 256; ++i)
        {
            auto inaccuracy = spread_values[i][0] * csgo->innacuracy;
            auto spread = spread_values[i][1] * csgo->innacuracy;

            auto spread_x = spread_values[i][3] * inaccuracy + spread_values[i][5] * spread;
            auto spread_y = spread_values[i][2] * inaccuracy + spread_values[i][4] * spread;

            auto direction = ZERO;

            direction.x = forward.x + right.x * spread_x + up.x * spread_y;
            direction.y = forward.y + right.y * spread_x + up.y * spread_y;
            direction.z = forward.z + right.z * spread_x + up.z * spread_y; //-V778

            auto end = csgo->eyepos + direction * weapon_info->m_flRange;

            if (hitbox_intersection(target, target->GetBoneCache2().Base(), hitbox, csgo->eyepos, end))
                ++hits;
        }

        final_hitchance = (int)((float)hits / 2.56f);
    }

    return final_hitchance;
}
void l_bociszek::find_target()
{
    for (auto i = 0; i < 65; ++i)
    {
        targets[i].fov = 0.0f;
        targets[i].hitbox = -1;
    }
    currentl_settings = CurrentSettings();
    auto best_fov = FLT_MAX;

    for (auto i = 1; i <= interfaces.global_vars->maxClients; ++i)
    {
        auto e = static_cast<IBasePlayer*>(interfaces.ent_list->GetClientEntity(i));

        if (IsNotTarget(e))
            continue;

        if (!currentl_settings.team && e->GetTeam() == csgo->local->GetTeam())
            continue;

        Vector engine_angles;
        interfaces.engine->GetViewAngles(engine_angles);
        targets[i].fov = Math::get_fov(engine_angles, Math::CalculateAngle(csgo->eyepos, e->hitbox_position(HITBOX_CHEST)));

        if (targets[i].fov < best_fov)
        {
            best_fov = targets[i].fov;
            target = e;
            target_index = i;
        }
    }
}
#define INRANGE(x, a, b) (x >= a && x <= b)  //-V1003
#define GETBITS(x) (INRANGE((x & (~0x20)),'A','F') ? ((x & (~0x20)) - 'A' + 0xA) : (INRANGE(x, '0', '9') ? x - '0' : 0)) //-V1003
#define GETBYTE(x) (GETBITS(x[0]) << 4 | GETBITS(x[1]))
uint64_t FindSignature(const char* szModule, const char* szSignature)
{
    MODULEINFO modInfo;
    GetModuleInformation(GetCurrentProcess(), GetModuleHandle(szModule), &modInfo, sizeof(MODULEINFO));

    uintptr_t startAddress = (DWORD)modInfo.lpBaseOfDll; //-V101 //-V220
    uintptr_t endAddress = startAddress + modInfo.SizeOfImage;

    const char* pat = szSignature;
    uintptr_t firstMatch = 0;

    for (auto pCur = startAddress; pCur < endAddress; pCur++)
    {
        if (!*pat)
            return firstMatch;

        if (*(PBYTE)pat == '\?' || *(BYTE*)pCur == GETBYTE(pat))
        {
            if (!firstMatch)
                firstMatch = pCur;

            if (!pat[2])
                return firstMatch;

            if (*(PWORD)pat == '\?\?' || *(PBYTE)pat != '\?')
                pat += 3;
            else
                pat += 2;
        }
        else
        {
            pat = szSignature;
            firstMatch = 0;
        }
    }

    return 0;
}
static int clip_ray_to_hitbox(const Ray_t& ray, mstudiobbox_t* hitbox, matrix3x4_t& matrix, trace_t& trace)
{

    static auto fn = FindSignature(str("client.dll"), str("55 8B EC 83 E4 F8 F3 0F 10 42"));

    trace.fraction = 1.0f;
    trace.startsolid = false;

    return reinterpret_cast <int(__fastcall*)(const Ray_t&, mstudiobbox_t*, matrix3x4_t&, trace_t&)> (fn)(ray, hitbox, matrix, trace);
}

bool l_bociszek::hitbox_intersection(IBasePlayer* e, matrix3x4_t* matrix, int hitbox, const Vector& start, const Vector& end)
{
    auto model = e->GetModel();

    if (!model)
        return false;

    auto studio_model = interfaces.models.model_info->GetStudioModel(model);

    if (!studio_model)
        return false;

    auto studio_set = studio_model->pHitboxSet(e->GetHitboxSet());

    if (!studio_set)
        return false;

    auto studio_hitbox = studio_set->pHitbox(hitbox);

    if (!studio_hitbox)
        return false;

    trace_t trace;

    Ray_t ray;
    ray.Init(start, end);

    return clip_ray_to_hitbox(ray, studio_hitbox, matrix[studio_hitbox->bone], trace) >= 0;
}

createmove:
Код:
g_Legit->createmove(cmd);
 
Сверху Снизу