Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void aimbot::work(CUserCmd* cmd)
- {
- if (!ctx::csgo.engine->IsInGame() || !ctx::csgo.engine->IsConnected())
- return;
- functions::handle_configs();
- details::best_fov = FLT_MAX;
- ctx::csgo.engine->GetViewAngles(details::local_angles);
- game::for_every_player(
- [cmd](player_t* pl) -> bool
- {
- if (!pl)
- return false;
- if (pl->IsDormant() || !pl->is_alive())
- return false;
- bool attack_enemies = config::get<bool>(ctx::cfg.attack_enemies);
- if (!attack_enemies && pl->is_enemy())
- return false;
- if (!config::get<bool>(ctx::cfg.attack_friendlies) && !pl->is_enemy())
- return false;
- if (lagcomp::records[pl->EntIndex()].m_vecRecords.empty())
- return false;
- int hitbox_id = config::get<int>(ctx::cfg.legit_hitbox);
- bool target_bt = config::get<bool>(ctx::cfg.legit_target_backtrack);
- math::vec3_t vector_hitbox = math::vec3_t(0.f, 0.f, 0.f);
- /*if (target_bt)
- vector_hitbox = functions::closest_record(pl);
- else
- {
- auto record = lagcomp::records[pl->EntIndex()].m_vecRecords.back();
- vector_hitbox = math::calculate_hitbox(record.m_Matrix,
- record.m_arrHitboxes[hitbox_id].m_vecMins,
- record.m_arrHitboxes[hitbox_id].m_vecMaxs,
- record.m_arrHitboxes[hitbox_id].m_iBone);
- }*/
- auto record = lagcomp::records[pl->EntIndex()].m_vecRecords.back();
- int closest_hitbox = get_nearest_bone(pl);
- auto get_bone_position = [&](int bone) {
- return math::vec3_t{ record.m_Matrix[bone][0][3], record.m_Matrix[bone][1][3], record.m_Matrix[bone][2][3] };
- };
- vector_hitbox = get_bone_position(closest_hitbox);
- Globals::closest_hitbox = closest_hitbox;
- if (vector_hitbox.is_zero())
- return false;
- if (!ctx::client.local->can_see_hitbox(pl, vector_hitbox))
- return false;
- float fov = math::get_fov(details::local_angles, ctx::client.local->get_eye_pos(), vector_hitbox);
- if (fov < details::best_fov)
- {
- details::best_fov = fov;
- details::best_player = pl->EntIndex();
- details::hitbox_pos = vector_hitbox;
- }
- return false;
- }, { game::ENEMY_ONLY });
- if (details::best_player != -1)
- {
- player_t* pl = entity_t::get<player_t>(details::best_player);
- if (!pl)
- return;
- if (pl->IsDormant() || !pl->is_alive())
- return;
- if (details::hitbox_pos.is_zero())
- return;
- float fov = math::get_fov(details::local_angles, ctx::client.local->get_eye_pos(), details::hitbox_pos);
- float config_fov = details::aimbot_fov;
- if (fov > config_fov)
- return;
- math::angle_t angle = math::calc_angle(ctx::client.local->get_eye_pos(), details::hitbox_pos);
- details::final_angle = angle;
- if (cmd->buttons.has_flag(IN_ATTACK))
- {
- int smooth_type = config::get<int>(ctx::cfg.legit_smooth_type);
- math::angle_t aimPunchAngle = ctx::client.local->get_punch_angle();
- float legit_rcs_x = config::get<float>(ctx::cfg.legit_rcs_x);
- float legit_rcs_y = config::get<float>(ctx::cfg.legit_rcs_y);
- details::final_angle.x -= aimPunchAngle.x * legit_rcs_x;
- details::final_angle.y -= aimPunchAngle.y * legit_rcs_y;
- details::final_angle.z = 0.f;
- math::correct(details::final_angle);
- functions::pick_smoothing(smooth_type);
- math::correct(details::final_angle);
- if (!ctx::client.local->can_see_hitbox(pl, details::hitbox_pos))
- return;
- cmd->viewangles = details::final_angle;
- math::correct(cmd->viewangles);
- bool rcs_standalone = config::get<bool>(ctx::cfg.legit_rcs_standalone);
- if (rcs_standalone)
- functions::standalone_rcs(cmd);
- math::correct(cmd->viewangles);
- ctx::csgo.engine->SetViewAngles(cmd->viewangles);
- float shot_delay = config::get<float>(ctx::cfg.legit_delay);
- auto weap_handle = ctx::client.local->get_weapon_handle();
- if (!weap_handle)
- return;
- auto weapon = entity_t::get<weapon_t>(weap_handle);
- if (!weapon)
- return;
- if (!timer::delay(shot_delay) &&
- cmd->buttons.has_flag(IN_ATTACK) &&
- ctx::client.local->m_iShotsFired() == 0 &&
- weapon->get_definition_index() != WEAPON_REVOLVER)
- {
- cmd->buttons.remove_flag(IN_ATTACK);
- }
- else
- {
- timer::reset();
- }
- //draw_eyes(ctx::client.local->get_eye_pos(), pl->get_eye_pos());//debug
- }
- else
- {
- timer::reset();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement