Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. void RageBot::OnCreateMove() {
  2. static bool shot = false;
  3.  
  4. auto weapon = g::pLocalEntity->GetActiveWeapon();
  5. if (!g::pLocalEntity || !weapon || weapon->GetCSWpnData() == nullptr
  6. || weapon->GetCSWpnData()->type == NULL) {
  7. shot = false;
  8. return;
  9. }
  10.  
  11. if (IsKnife31(weapon) || IsWeaponGrenade2(weapon) || weapon->GetAmmo() == 0 || !IsBallisticWeapon(weapon) || !CanShoot())
  12. {
  13. shot = false;
  14. return;
  15. }
  16.  
  17.  
  18. float flServerTime = g::pLocalEntity->GetTickBase() * g_pGlobalVars->intervalPerTick;
  19. bool canShoot = (weapon->GetNextPrimaryAttack() <= flServerTime);
  20.  
  21.  
  22.  
  23. if (!g_Settings.bAimBotEnabled) {
  24. shot = false;
  25. return;
  26.  
  27. }
  28.  
  29. AutoRevolver111(g::pCmd, g::pLocalEntity);
  30.  
  31. std::vector<C_BaseEntity*> targets;
  32.  
  33. bool target_found = false;
  34.  
  35. auto target_sort = [&](C_BaseEntity * a, C_BaseEntity * b) {
  36. return g::pLocalEntity->GetOrigin().DistTo(a->GetOrigin())
  37. < g::pLocalEntity->GetOrigin().DistTo(b->GetOrigin());
  38. };
  39.  
  40. for (int o = 0; o < 64; ++o) {
  41. auto entity = (C_BaseEntity*)g_pEntityList->GetClientEntity(o);
  42. if (entity == nullptr || !g::pLocalEntity || !entity->IsAlive()
  43. || entity->IsDormant() || entity == g::pLocalEntity || entity->GetTeam() == g::pLocalEntity->GetTeam())
  44. continue;
  45.  
  46. targets.push_back(entity);
  47. }
  48.  
  49. std::sort(targets.begin(), targets.end(), target_sort);
  50.  
  51. for (auto target : targets) {
  52. if (!target)
  53. continue;
  54. if (target_found)
  55. break;
  56.  
  57.  
  58. for (auto hitbox : get_priority(target))
  59. {
  60. if (target_found)
  61. break;
  62.  
  63. if (!target->/*Proper*/SetupBones(bonematrix[target->EntIndex()], 128, 0x100, g_pGlobalVars->curtime))
  64. continue;
  65.  
  66. for (auto aim_point : GetMultiplePointsForHitbox(g::pLocalEntity, target, hitbox, bonematrix[target->EntIndex()]))
  67. {
  68. int cur_hitchance = g_Settings.iHitChance;
  69. int cur_mindmg = g_Settings.iMinDamage;
  70. float damage = 0.f;
  71.  
  72. float BestDmg = -1;
  73. Vector BestPos = Vector();
  74.  
  75. if (autowall->CanHit2(aim_point, &damage))
  76. {
  77. if (BestDmg < damage && damage >= cur_mindmg)
  78. {
  79. BestDmg = damage;
  80. target_found = true;
  81. BestPos = aim_point;
  82. }
  83. }
  84.  
  85. auto Angle = Utils::FastCalcAngle(g::pLocalEntity->GetEyePosition(), BestPos);
  86. if (BestDmg != -1 && BestPos != Vector()) {
  87.  
  88. if (g::pLocalEntity->GetVelocity().Length() >= (g::pLocalEntity->GetActiveWeapon()->GetCSWpnData()->max_speed_alt * .34f) && (g::pLocalEntity->GetFlags() & FL_ONGROUND) && !(g::pCmd->buttons & IN_RELOAD))
  89. Autostop();
  90.  
  91. if (g_Settings.bAutoScope && IsSniper(weapon) && !g::pLocalEntity->IsScoped())
  92. g::pCmd->buttons |= IN_ATTACK2;
  93.  
  94.  
  95.  
  96.  
  97. if (!(g::pCmd->buttons & IN_ATTACK) && canShoot &&
  98. HitChance(target, g::pLocalEntity->GetActiveWeapon(), Angle, BestPos, cur_hitchance)) {
  99. shot = true;
  100. //Globals::bsendpacket = true;
  101. g::pCmd->buttons |= IN_ATTACK;
  102. Globals::shots_fired++;
  103. g::pCmd->viewangles = Angle - (g::pLocalEntity->GetAimPunchAngle() * g_pConVar->FindVar("weapon_recoil_scale")->GetFloat());
  104. g::pCmd->tick_count = TIME_TO_TICKS(target->m_flSimulationTime() + LerpTime());
  105.  
  106. Utils::Log("fire");
  107. }
  108.  
  109. if (canShoot) {
  110. if (!HitChance(target, g::pLocalEntity->GetActiveWeapon(), Angle, BestPos, cur_hitchance))
  111. {
  112. g::pCmd->forwardmove = 0;
  113. g::pCmd->sidemove = 0;
  114. g::pCmd->upmove = 0;
  115. }
  116. }
  117. }
  118. if (target_found)
  119. break;
  120. }
  121. if (target_found)
  122. break;
  123. }
  124. if (target_found)
  125. break;
  126. }
  127. targets.clear();
  128. target_found = false;
  129.  
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement