Подведи собственные итоги года совместно с YOUGAME и забери ценные призы! Перейти

Вопрос Hitchance

Пользователь
Пользователь
Статус
Оффлайн
Регистрация
29 Май 2019
Сообщения
692
Реакции
147
спатив я другу хитшанс с рифка почему це чудо стреляет тогда когда ставлю 1 хитганс?
Код:
Expand Collapse Copy
build_seed_table();
int i = 0; i++;
auto e = static_cast<player_t*>(m_entitylist()->GetClientEntity(i));

const auto weapon = csgo.globals.weapon->get_csweapon_info();

if (!weapon)
return false;

const auto info = csgo.globals.weapon->m_iItemDefinitionIndex();

if (!info)
return false;

const auto studio_model = m_modelinfo()->GetStudioModel(e->GetModel());

if (!studio_model)
return false;

// performance optimization.
if ((csgo.globals.eye_pos - final_target.data.point.point).Length() > weapon->flRange)
return false;

// setup calculation parameters.
const auto round_acc = [](const float accuracy) { return roundf(accuracy * 1000.f) / 1000.f; };
const auto sniper = csgo.globals.weapon->m_iItemDefinitionIndex() == WEAPON_AWP || csgo.globals.weapon->m_iItemDefinitionIndex() == WEAPON_G3SG1
|| csgo.globals.weapon->m_iItemDefinitionIndex() == WEAPON_SCAR20 || csgo.globals.weapon->m_iItemDefinitionIndex() == WEAPON_SSG08;
const auto crouched = csgo.local()->m_fFlags() & FL_DUCKING;

// calculate inaccuracy.
const auto weapon_inaccuracy = csgo.globals.inaccuracy;

if (csgo.globals.weapon->m_iItemDefinitionIndex() == WEAPON_REVOLVER)
return weapon_inaccuracy < (crouched ? .0020f : .0055f);

// no need for hitchance, if we can't increase it anyway.
if (crouched)
{

    if (round_acc(weapon_inaccuracy) == round_acc(sniper ? weapon->flInaccuracyCrouchAlt : weapon->flInaccuracyCrouch))
        return true;
}
else
{
    if (round_acc(weapon_inaccuracy) == round_acc(sniper ? weapon->flInaccuracyCrouchAlt : weapon->flInaccuracyStand))
        return true;
}

// calculate start and angle.
const auto start = csgo.local()->get_shoot_position();
//const auto aim_angle = math::calculate_angle(start, final_target.data.point.point).Clamp();
Vector forward, right, up;
math::angle_vectors(aim_angle, &forward, &right, &up);

// keep track of all traces that hit the enemy.
auto current = 0;

// setup calculation parameters.
Vector total_spread, spread_angle, end;
float inaccuracy, spread_x, spread_y;
std::tuple<float, float, float>* seed;

// use look-up-table to find average hit probability.
for (auto i = 0u; i < total_seeds; i++)  // NOLINT(modernize-loop-convert)
{
    // get seed.
    seed = &precomputed_seeds[i];

    // calculate spread.
    inaccuracy = std::get<0>(*seed) * weapon_inaccuracy;
    spread_x = std::get<2>(*seed) * inaccuracy;
    spread_y = std::get<1>(*seed) * inaccuracy;
    total_spread = (forward + right * spread_x + up * spread_y);

    // calculate angle with spread applied.
    math::vector_angles(total_spread, spread_angle);

    // calculate end point of trace.
    math::angle_vectors(spread_angle, end);
    auto direction = ZERO;

    end = start + direction * weapon->flRange;

    // did we hit the hitbox?
    if (hitbox_intersection(final_target.record->player, final_target.record->matrixes_data.main, final_target.data.hitbox, csgo.globals.eye_pos, end))
        current++;

    // abort if hitchance is already sufficent.
    if (static_cast<float>(current) / static_cast<float>(total_seeds) >= (float)g_cfg.ragebot.weapon[csgo.globals.current_weapon].hitchance_amount / 100.f)
        return true;

    // abort if we can no longer reach hitchance.
    if (static_cast<float>(current + total_seeds - i) / static_cast<float>(total_seeds) < (float)g_cfg.ragebot.weapon[csgo.globals.current_weapon].hitchance_amount / 100.f)
        return false;
}

return static_cast<float>(current) / static_cast<float>(total_seeds) >= (float)g_cfg.ragebot.weapon[csgo.globals.current_weapon].hitchance_amount / 100.f;
 
Думаю проблему нужно искать здесь:
Код:
Expand Collapse Copy
    end = start + direction * weapon->flRange;

    // did we hit the hitbox?
    if (hitbox_intersection(final_target.record->player, final_target.record->matrixes_data.main, final_target.data.hitbox, csgo.globals.eye_pos, end))
        current++;

    // abort if hitchance is already sufficent.
    if (static_cast<float>(current) / static_cast<float>(total_seeds) >= (float)g_cfg.ragebot.weapon[csgo.globals.current_weapon].hitchance_amount / 100.f)
        return true;

    // abort if we can no longer reach hitchance.
    if (static_cast<float>(current + total_seeds - i) / static_cast<float>(total_seeds) < (float)g_cfg.ragebot.weapon[csgo.globals.current_weapon].hitchance_amount / 100.f)
        return false;
}

return static_cast<float>(current) / static_cast<float>(total_seeds) >= (float)g_cfg.ragebot.weapon[csgo.globals.current_weapon].hitchance_amount / 100.f;
 
Назад
Сверху Снизу