C++ Better hitchance for lw

gabeg
Забаненный
Статус
Оффлайн
Регистрация
21 Фев 2020
Сообщения
260
Реакции[?]
61
Поинты[?]
0
Товары в продаже
1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
C++:
bool ragebot::Hitchance(vec3_t angles, c_base_player* ent, float chance)
{


auto weapon = g_local->get_active_weapon();

if (!weapon)
return false;
vec3_t farward, right, up;
vec3_t src = g_local->get_eye_pos();
math::angle_vectors(angles, farward, right, up);
int cHits = 0;
int cNeededHits = static_cast<int> (150.f * (chance / 100.f));
weapon->update_accuracy_penalty();
float weap_spread = weapon->get_spread();
float weap_inaccuracy = weapon->get_inaccuracy();

for (int i = 0; i < 150; i++)
{
float a = math::random_float(0.f, 1.f);
float b = math::random_float(0.f, 2.f * M_PI);
float c = math::random_float(0.f, 1.f);
float d = math::random_float(0.f, 2.f * M_PI);

float inaccuracy = a * weap_inaccuracy;
float spread = c * weap_spread;

if (weapon->m_iItemDefinitionIndex() == 64)
{
a = 1.f - a * a;
a = 1.f - c * c;

}

vec3_t spreadView((cos(cos(b)) * inaccuracy) + (cos(d) * spread), (sin(b) * inaccuracy) + (sin(d) * spread), 0), direction;
direction.x = farward.x + (spreadView.x * right.x) + (spreadView.y * up.x);
direction.y = farward.y + (spreadView.x * right.y) + (spreadView.y * up.y);
direction.y = farward.z + (spreadView.x * right.z) + (spreadView.y * up.z);
direction.normalized();

vec3_t viewAnlesSpread;
math::vector_angles(direction, up , viewAnlesSpread);
viewAnlesSpread.normalized();

vec3_t viewForward;
math::vector_angles(viewAnlesSpread, up, viewForward);
viewForward.normalize_in_place();

viewForward = src + (viewForward * weapon->get_cs_weapon_data()->range);
trace_t tr;
ray_t ray;

ray.initialize(src, viewForward);
i::trace->clip_ray_to_entity(ray, mask_shot | contents_grate, ent, &tr);

if (tr.player == ent)
++cHits;
if (static_cast<int> ((static_cast<float> (cHits) / 150.f) * 100.f) >= chance)
return true;
if ((150 - i + cHits) < cNeededHits)

return false;


}

}
 
Эксперт
Статус
Оффлайн
Регистрация
30 Дек 2019
Сообщения
1,970
Реакции[?]
958
Поинты[?]
19K
Сверху Снизу