Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void RageBot::OnCreateMove() {
- static bool shot = false;
- auto weapon = g::pLocalEntity->GetActiveWeapon();
- if (!g::pLocalEntity || !weapon || weapon->GetCSWpnData() == nullptr
- || weapon->GetCSWpnData()->type == NULL) {
- shot = false;
- return;
- }
- if (IsKnife31(weapon) || IsWeaponGrenade2(weapon) || weapon->GetAmmo() == 0 || !IsBallisticWeapon(weapon) || !CanShoot())
- {
- shot = false;
- return;
- }
- float flServerTime = g::pLocalEntity->GetTickBase() * g_pGlobalVars->intervalPerTick;
- bool canShoot = (weapon->GetNextPrimaryAttack() <= flServerTime);
- if (!g_Settings.bAimBotEnabled) {
- shot = false;
- return;
- }
- AutoRevolver111(g::pCmd, g::pLocalEntity);
- std::vector<C_BaseEntity*> targets;
- bool target_found = false;
- auto target_sort = [&](C_BaseEntity * a, C_BaseEntity * b) {
- return g::pLocalEntity->GetOrigin().DistTo(a->GetOrigin())
- < g::pLocalEntity->GetOrigin().DistTo(b->GetOrigin());
- };
- for (int o = 0; o < 64; ++o) {
- auto entity = (C_BaseEntity*)g_pEntityList->GetClientEntity(o);
- if (entity == nullptr || !g::pLocalEntity || !entity->IsAlive()
- || entity->IsDormant() || entity == g::pLocalEntity || entity->GetTeam() == g::pLocalEntity->GetTeam())
- continue;
- targets.push_back(entity);
- }
- std::sort(targets.begin(), targets.end(), target_sort);
- for (auto target : targets) {
- if (!target)
- continue;
- if (target_found)
- break;
- for (auto hitbox : get_priority(target))
- {
- if (target_found)
- break;
- if (!target->/*Proper*/SetupBones(bonematrix[target->EntIndex()], 128, 0x100, g_pGlobalVars->curtime))
- continue;
- for (auto aim_point : GetMultiplePointsForHitbox(g::pLocalEntity, target, hitbox, bonematrix[target->EntIndex()]))
- {
- int cur_hitchance = g_Settings.iHitChance;
- int cur_mindmg = g_Settings.iMinDamage;
- float damage = 0.f;
- float BestDmg = -1;
- Vector BestPos = Vector();
- if (autowall->CanHit2(aim_point, &damage))
- {
- if (BestDmg < damage && damage >= cur_mindmg)
- {
- BestDmg = damage;
- target_found = true;
- BestPos = aim_point;
- }
- }
- auto Angle = Utils::FastCalcAngle(g::pLocalEntity->GetEyePosition(), BestPos);
- if (BestDmg != -1 && BestPos != Vector()) {
- if (g::pLocalEntity->GetVelocity().Length() >= (g::pLocalEntity->GetActiveWeapon()->GetCSWpnData()->max_speed_alt * .34f) && (g::pLocalEntity->GetFlags() & FL_ONGROUND) && !(g::pCmd->buttons & IN_RELOAD))
- Autostop();
- if (g_Settings.bAutoScope && IsSniper(weapon) && !g::pLocalEntity->IsScoped())
- g::pCmd->buttons |= IN_ATTACK2;
- if (!(g::pCmd->buttons & IN_ATTACK) && canShoot &&
- HitChance(target, g::pLocalEntity->GetActiveWeapon(), Angle, BestPos, cur_hitchance)) {
- shot = true;
- //Globals::bsendpacket = true;
- g::pCmd->buttons |= IN_ATTACK;
- Globals::shots_fired++;
- g::pCmd->viewangles = Angle - (g::pLocalEntity->GetAimPunchAngle() * g_pConVar->FindVar("weapon_recoil_scale")->GetFloat());
- g::pCmd->tick_count = TIME_TO_TICKS(target->m_flSimulationTime() + LerpTime());
- Utils::Log("fire");
- }
- if (canShoot) {
- if (!HitChance(target, g::pLocalEntity->GetActiveWeapon(), Angle, BestPos, cur_hitchance))
- {
- g::pCmd->forwardmove = 0;
- g::pCmd->sidemove = 0;
- g::pCmd->upmove = 0;
- }
- }
- }
- if (target_found)
- break;
- }
- if (target_found)
- break;
- }
- if (target_found)
- break;
- }
- targets.clear();
- target_found = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement