Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.68 KB | None | 0 0
  1. #include "Aimbot.h"
  2. #include "Autowall.h"
  3. #include "LagComp.h"
  4. #include "..\AntiAim\AntiAim.h"
  5. #include "..\..\Utils\Utils.h"
  6. #include "..\..\SDK\IVEngineClient.h"
  7. #include "..\..\SDK\PlayerInfo.h"
  8. #include "..\..\SDK\ICvar.h"
  9. #include "..\..\Utils\Math.h"
  10. #include "..\..\SDK\Hitboxes.h"
  11. #include "..\..\Menu\Menu.h"
  12. #include "..\..\Menu\config.h"
  13. #include "../../SDK/CEntity.h"
  14. #include "../../SDK/IVModelInfo.h"
  15. #include "../../SDK/CGlobalVarsBase.h"
  16. #include "../../SDK/..\Utils\GlobalVars.h"
  17. #include "../../SDK/..\Utils\Math.h"
  18. Aimbot g_Aimbot;
  19.  
  20. float Aimbot::SynchronizeHitchance() {
  21. auto me = Globals::LocalPlayer;
  22. auto cmd = Globals::pCmd;
  23.  
  24. if (!me->GetActiveWeapon())
  25. return 0;
  26.  
  27. if (me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_SCAR20 || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_G3SG1) {
  28. return c_config::get().auto_hitchance;
  29. }
  30. else if (me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_SSG08) {
  31. return c_config::get().scout_hitchance;
  32. }
  33. else if (me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_AWP) {
  34. return c_config::get().awp_hitchance;
  35. }
  36. else if (me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_REVOLVER || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_DEAGLE) {
  37. return c_config::get().heavy_pistol_hitchance;
  38. }
  39. else if (me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_P250 || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_USP_SILENCER || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_CZ75A || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_ELITE || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_FIVESEVEN || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_GLOCK || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_HKP2000 || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_TEC9)
  40. {
  41. return c_config::get().pistolss_hitchance;
  42. }
  43. else if (me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_AK47 || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_AUG || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_FAMAS || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_GALILAR || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_M4A1 || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_M4A1_SILENCER)
  44. {
  45. return c_config::get().rifles_hitchance;
  46. }
  47. else {
  48. return c_config::get().other_hitchance;
  49. }
  50. }
  51.  
  52. float Aimbot::SynchronizeMinDamage() {
  53. auto me = Globals::LocalPlayer;
  54. auto cmd = Globals::pCmd;
  55.  
  56. if (!me->GetActiveWeapon())
  57. return 0;
  58.  
  59. if (me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_SCAR20 || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_G3SG1) {
  60. return c_config::get().auto_mindamage;
  61. }
  62. else if (me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_SSG08) {
  63. return c_config::get().scout_mindamage;
  64. }
  65. else if (me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_AWP) {
  66. return c_config::get().awp_mindamage;
  67. }
  68. else if (me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_REVOLVER || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_DEAGLE) {
  69. return c_config::get().heavy_pistol_mindamage;
  70. }
  71. else if (me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_P250 || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_USP_SILENCER || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_CZ75A || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_ELITE || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_FIVESEVEN || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_GLOCK || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_HKP2000 || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_TEC9)
  72. {
  73. return c_config::get().pistolss_mindamage;
  74. }
  75. else if (me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_AK47 || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_AUG || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_FAMAS || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_GALILAR || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_M4A1 || me->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_M4A1_SILENCER)
  76. {
  77. return c_config::get().rifles_mindamage;
  78. }
  79. else {
  80. return c_config::get().other_mindamage;
  81. }
  82. }
  83.  
  84. void Aimbot::Autostop()
  85. {
  86. if (!c_config::get().autostop)
  87. return;
  88.  
  89. Vector Velocity = Globals::LocalPlayer->GetVelocity();
  90.  
  91. if (Velocity.Length2D() == 0)
  92. return;
  93.  
  94. static float Speed = 450.f;
  95.  
  96. Vector Direction;
  97. Vector RealView;
  98. g_Math.VectorAngles(Velocity, Direction);
  99. g_pEngine->GetViewAngles(RealView);
  100. Direction.y = RealView.y - Direction.y;
  101.  
  102. Vector Forward;
  103. g_Math.AngleVectors(Direction, &Forward);
  104. Vector NegativeDirection = Forward * -Speed;
  105.  
  106. Globals::pCmd->forwardmove = NegativeDirection.x;
  107. Globals::pCmd->sidemove = NegativeDirection.y;
  108. }
  109.  
  110. void SinCosBitch(float a, float* s, float*c)
  111. {
  112. *s = sin(a);
  113. *c = cos(a);
  114. }
  115. void AngleVectorsv2(const Vector &angles, Vector& forward)
  116. {
  117. float sp, sy, cp, cy;
  118.  
  119. SinCosBitch(DEG2RAD(angles[1]), &sy, &cy);
  120. SinCosBitch(DEG2RAD(angles[0]), &sp, &cp);
  121.  
  122. forward.x = cp * cy;
  123. forward.y = cp * sy;
  124. forward.z = -sp;
  125. }
  126.  
  127. bool Aimbot::HitChance(C_BaseEntity* pEnt, C_BaseCombatWeapon* pWeapon, Vector Angle, Vector Point, int chance)
  128. {
  129. if (chance == 0 || SynchronizeHitchance() == 0)
  130. return true;
  131.  
  132. float Seeds = 256.f;
  133.  
  134. Angle -= (Globals::LocalPlayer->GetAimPunchAngle() * 2.0f);
  135.  
  136. Vector forward, right, up;
  137.  
  138. g_Math.AngleVectors(Angle, &forward, &right, &up);
  139.  
  140. int Hits = 0, neededHits = (Seeds * (chance / 100.f));
  141.  
  142. float weapSpread = pWeapon->GetSpread(), weapInaccuracy = pWeapon->GetInaccuracy();
  143.  
  144. for (int i = 0; i < Seeds; i++)
  145. {
  146. float Inaccuracy = g_Math.RandomFloat(0.f, 1.f) * weapInaccuracy;
  147. float Spread = g_Math.RandomFloat(0.f, 1.f) * weapSpread;
  148.  
  149. Vector spreadView((cos(g_Math.RandomFloat(0.f, 2.f * M_PI)) * Inaccuracy) + (cos(g_Math.RandomFloat(0.f, 2.f * M_PI)) * Spread), (sin(g_Math.RandomFloat(0.f, 2.f * M_PI)) * Inaccuracy) + (sin(g_Math.RandomFloat(0.f, 2.f * M_PI)) * Spread), 0), direction;
  150. direction = Vector(forward.x + (spreadView.x * right.x) + (spreadView.y * up.x), forward.y + (spreadView.x * right.y) + (spreadView.y * up.y), forward.z + (spreadView.x * right.z) + (spreadView.y * up.z)).Normalize();
  151.  
  152. Vector viewanglesSpread, viewForward;
  153.  
  154. g_Math.VectorAngles(direction, up, viewanglesSpread);
  155. g_Math.NormalizeAngles(viewanglesSpread);
  156.  
  157. g_Math.AngleVectors(viewanglesSpread, &viewForward);
  158. viewForward.NormalizeInPlace();
  159.  
  160. viewForward = Globals::LocalPlayer->GetEyePosition() + (viewForward * pWeapon->GetCSWpnData()->range);
  161.  
  162. C_Trace Trace;
  163.  
  164. g_pTrace->ClipRayToEntity(C_Ray(Globals::LocalPlayer->GetEyePosition(), viewForward), mask_shot | contents_grate, pEnt, &Trace);
  165.  
  166. if (Trace.m_pEnt == pEnt)
  167. Hits++;
  168.  
  169. if (((Hits / Seeds) * 100.f) >= chance)
  170. return true;
  171.  
  172. if ((Seeds - i + Hits) < neededHits)
  173. return false;
  174. }
  175.  
  176. return false;
  177. }
  178.  
  179. bool ShouldBaim(C_BaseEntity* pEnt) // probably dosnt make sense
  180. {
  181. static float oldSimtime[65];
  182. static float storedSimtime[65];
  183.  
  184. static float ShotTime[65];
  185. static float NextShotTime[65];
  186. static bool BaimShot[65];
  187.  
  188. if (storedSimtime[pEnt->EntIndex()] != pEnt->GetSimulationTime())
  189. {
  190. oldSimtime[pEnt->EntIndex()] = storedSimtime[pEnt->EntIndex()];
  191. storedSimtime[pEnt->EntIndex()] = pEnt->GetSimulationTime();
  192. }
  193.  
  194. float simDelta = storedSimtime[pEnt->EntIndex()] - oldSimtime[pEnt->EntIndex()];
  195.  
  196. bool Shot = false;
  197.  
  198. if (pEnt->GetActiveWeapon() && !pEnt->IsKnifeorNade())
  199. {
  200. if (ShotTime[pEnt->EntIndex()] != pEnt->GetActiveWeapon()->GetLastShotTime())
  201. {
  202. Shot = true;
  203. BaimShot[pEnt->EntIndex()] = false;
  204. ShotTime[pEnt->EntIndex()] = pEnt->GetActiveWeapon()->GetLastShotTime();
  205. }
  206. else
  207. Shot = false;
  208. }
  209. else
  210. {
  211. Shot = false;
  212. ShotTime[pEnt->EntIndex()] = 0.f;
  213. }
  214.  
  215. if (Shot)
  216. {
  217. NextShotTime[pEnt->EntIndex()] = pEnt->GetSimulationTime() + pEnt->FireRate();
  218.  
  219. if (simDelta >= pEnt->FireRate())
  220. BaimShot[pEnt->EntIndex()] = true;
  221. }
  222.  
  223. if (BaimShot[pEnt->EntIndex()])
  224. {
  225. if (pEnt->GetSimulationTime() >= NextShotTime[pEnt->EntIndex()])
  226. BaimShot[pEnt->EntIndex()] = false;
  227. }
  228.  
  229. auto pWeapon = Globals::LocalPlayer->GetActiveWeapon();
  230.  
  231. std::vector<int> baim_hitboxes;
  232.  
  233.  
  234. baim_hitboxes.push_back((int)HITBOX_UPPER_CHEST);
  235. baim_hitboxes.push_back((int)HITBOX_LOWER_CHEST);
  236. baim_hitboxes.push_back((int)HITBOX_PELVIS);
  237. baim_hitboxes.push_back((int)HITGROUP_STOMACH);
  238.  
  239. float Radius = 0;
  240. Radius *= (c_config::get().aimbot_bodypointscale / 100.f);
  241.  
  242. float Damage = 0;
  243. for (auto HitBoxID : baim_hitboxes)
  244. {
  245. Damage = g_Autowall.Damage(pEnt->GetHitboxPosition(HitBoxID, g_Aimbot.Matrix[pEnt->EntIndex()], &Radius));
  246. }
  247.  
  248. if (Globals::LocalPlayer->GetVelocity().Length2D() > 125 && c_config::get().prefer_bodyaim[2])
  249. return true;
  250.  
  251. if (BaimShot[pEnt->EntIndex()] && c_config::get().prefer_bodyaim[3])
  252. return true;
  253.  
  254. if (!(pEnt->GetFlags() & FL_ONGROUND) && c_config::get().prefer_bodyaim[0])
  255. return true;
  256.  
  257. if (c_config::get().prefer_bodyaim[1] && (pEnt->GetVelocity().Length2D() > 15 && pEnt->GetVelocity().Length2D() < 150))
  258. return true;
  259.  
  260. if (pEnt->GetHealth() <= Damage && c_config::get().prefer_bodyaim[4])
  261. return true;
  262.  
  263. return false;
  264. }
  265.  
  266. Vector Aimbot::Hitscan(C_BaseEntity* pEnt) // supremeemmemememememe
  267. {
  268. float DamageArray[28];
  269. float tempDmg = SynchronizeMinDamage();
  270. Vector tempHitbox = { 0,0,0 };
  271.  
  272. float angToLocal = g_Math.CalcAngle(Globals::LocalPlayer->GetOrigin(), pEnt->GetOrigin()).y;
  273.  
  274. Vector2D MutipointXY = { (sin(g_Math.GRD_TO_BOG(angToLocal))),(cos(g_Math.GRD_TO_BOG(angToLocal))) };
  275. Vector2D MutipointXY180 = { (sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
  276. Vector2D Mutipoint[] = { Vector2D(MutipointXY.x, MutipointXY.y), Vector2D(MutipointXY180.x, MutipointXY180.y) };
  277.  
  278. float Velocity = abs(pEnt->GetVelocity().Length2D());
  279.  
  280. //if (Velocity > 29.f)
  281. //Velocity = 30.f;
  282.  
  283. std::vector<int> Scan;
  284.  
  285. int HeadHeight = 0;
  286.  
  287. bool Baim = ShouldBaim(pEnt);
  288.  
  289. bool PreferBaimIfLowVelcoity = (c_config::get().prefer_bodyaim_if_low_velocity && (Velocity > 15 && Velocity < 150));
  290.  
  291. if (!GetAsyncKeyState(c_config::get().baim_key_bind))
  292. {
  293. if (c_config::get().hitboxesscan[0])
  294. {
  295. Scan.push_back(HITBOX_HEAD);
  296. Scan.push_back(HITBOX_NECK);
  297. }
  298. else if (c_config::get().hitboxesscan[1])
  299. {
  300. Scan.push_back(HITBOX_LOWER_CHEST);
  301. Scan.push_back(HITBOX_UPPER_CHEST);
  302. }
  303. else if (c_config::get().hitboxesscan[2])
  304. {
  305. Scan.push_back(HITBOX_PELVIS);
  306. Scan.push_back(HITBOX_THORAX);
  307. Scan.push_back(HITBOX_RIGHT_THIGH);
  308. Scan.push_back(HITBOX_LEFT_THIGH);
  309. Scan.push_back(HITBOX_BELLY);
  310. }
  311. else if (c_config::get().hitboxesscan[3])
  312. {
  313. Scan.push_back(HITBOX_RIGHT_HAND);
  314. Scan.push_back(HITBOX_LEFT_HAND);
  315. Scan.push_back(HITBOX_RIGHT_UPPER_ARM);
  316. Scan.push_back(HITBOX_RIGHT_FOREARM);
  317. Scan.push_back(HITBOX_LEFT_UPPER_ARM);
  318. Scan.push_back(HITBOX_LEFT_FOREARM);
  319. }
  320. else if (c_config::get().hitboxesscan[4])
  321. {
  322. Scan.push_back(HITBOX_RIGHT_CALF);
  323. Scan.push_back(HITBOX_LEFT_CALF);
  324. Scan.push_back(HITBOX_RIGHT_FOOT);
  325. Scan.push_back(HITBOX_LEFT_FOOT);
  326. }
  327. }
  328. else
  329. {
  330. Scan.push_back(HITBOX_PELVIS);
  331. Scan.push_back(HITBOX_THORAX);
  332. Scan.push_back(HITBOX_RIGHT_THIGH);
  333. Scan.push_back(HITBOX_LEFT_THIGH);
  334. Scan.push_back(HITBOX_BELLY);
  335. }
  336.  
  337. Vector Hitbox;
  338. Vector Hitbox_right;
  339. Vector Hitbox_left;
  340. Vector Hitbox_top;
  341. //std::vector<Vector> Hitbox;
  342.  
  343. int bestHitboxint = 0;
  344. for (int hitbox : Scan)
  345. {
  346. studiohdr_t* pStudioModel = g_pModelInfo->GetStudiomodel(pEnt->GetModel());
  347. mstudiohitboxset_t* set = pStudioModel->GetHitboxSet(0);
  348. mstudiobbox_t* GetGit = set->GetHitbox(hitbox);
  349. if (hitbox == HITBOX_HEAD)
  350. {
  351. float Radius = 0;
  352. Radius = GetGit->radius * (c_config::get().aimbot_headpointscale / 100.f);
  353. Hitbox = pEnt->GetHitboxPosition(hitbox, Matrix[pEnt->EntIndex()], &Radius);
  354. Hitbox += Vector(0, 0, Radius);
  355. }
  356. else
  357. {
  358. float Radius = 0;
  359. Radius = GetGit->radius * (c_config::get().aimbot_bodypointscale / 100.f);
  360. Hitbox = pEnt->GetHitboxPosition(hitbox, Matrix[pEnt->EntIndex()], &Radius);
  361. Hitbox += Vector(0, 0, Radius);
  362. }
  363. float Damage = g_Autowall.Damage(Hitbox);
  364.  
  365. if (Damage > 0.f)
  366. DamageArray[hitbox] = Damage;
  367. else
  368. DamageArray[hitbox] = 0;
  369.  
  370. if (Baim && Damage >= (pEnt->GetHealth() + 10))
  371. {
  372. DamageArray[hitbox] = 400;
  373. Baim = true;
  374. }
  375.  
  376. if (DamageArray[hitbox] > tempDmg)
  377. {
  378. tempHitbox = Hitbox;
  379. bestHitboxint = hitbox;
  380. tempDmg = DamageArray[hitbox];
  381. return tempHitbox;
  382. }
  383. Globals::AimbotHitbox[pEnt->EntIndex()][hitbox] = Hitbox;
  384. }
  385.  
  386. return Vector(0, 0, 0);
  387. }
  388.  
  389. void Aimbot::OnCreateMove()
  390. {
  391. if (!g_pEngine->IsInGame())
  392. return;
  393.  
  394. Vector Aimpoint = { 0,0,0 };
  395. C_BaseEntity* Target = nullptr;
  396. targetID = 0;
  397.  
  398. int tempDmg = 0;
  399. static bool shot = false;
  400. CanShootWithCurrentHitchanceAndValidTarget = false;
  401.  
  402. for (int i = 1; i <= g_pEngine->GetMaxClients(); ++i)
  403. {
  404. C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
  405.  
  406. if (!pPlayerEntity
  407. || !pPlayerEntity->IsAlive()
  408. || pPlayerEntity->IsDormant()
  409. || pPlayerEntity->IsImmune())
  410. {
  411. g_LagComp.ClearRecords(i);
  412. continue;
  413. }
  414.  
  415. g_LagComp.StoreRecord(pPlayerEntity);
  416.  
  417. if (pPlayerEntity == Globals::LocalPlayer || pPlayerEntity->GetTeam() == Globals::LocalPlayer->GetTeam())
  418. continue;
  419.  
  420. Globals::EnemyEyeAngs[i] = pPlayerEntity->GetEyeAngles();
  421.  
  422. if (g_LagComp.PlayerRecord[i].size() == 0 || !Globals::LocalPlayer->IsAlive() || !c_config::get().aimbot_enabled || g_Menu.Config.LegitBacktrack)
  423. continue;
  424.  
  425. if (!Globals::LocalPlayer->GetActiveWeapon() || Globals::LocalPlayer->IsKnifeorNade())
  426. continue;
  427.  
  428. bestEntDmg = 0;
  429.  
  430. Vector Hitbox = Hitscan(pPlayerEntity);
  431.  
  432. if (Hitbox != Vector(0, 0, 0) && tempDmg <= bestEntDmg)
  433. {
  434. Aimpoint = Hitbox;
  435. Target = pPlayerEntity;
  436. targetID = Target->EntIndex();
  437. tempDmg = bestEntDmg;
  438. }
  439. }
  440.  
  441. if (!Globals::LocalPlayer->IsAlive())
  442. {
  443. shot = false;
  444. return;
  445. }
  446.  
  447. if (!Globals::LocalPlayer->GetActiveWeapon() || Globals::LocalPlayer->IsKnifeorNade())
  448. {
  449. shot = false;
  450. return;
  451. }
  452.  
  453. if (shot)
  454. {
  455. if (c_config::get().on_shot_aa)
  456. {
  457.  
  458. if (c_config::get().on_shot_aa_type == 0)
  459. {
  460. Globals::bSendPacket = true;
  461. g_AntiAim.OnCreateMove();
  462. }
  463. else if (c_config::get().on_shot_aa_type == 1)
  464. {
  465. Globals::bSendPacket = true;
  466. Globals::pCmd->viewangles.x = 180 - Globals::pCmd->viewangles.x;
  467. Globals::pCmd->viewangles.y = Globals::pCmd->viewangles.y + 180;
  468. }
  469.  
  470. }
  471. shot = false;
  472. }
  473.  
  474. float flServerTime = Globals::LocalPlayer->GetTickBase() * g_pGlobalVars->intervalPerTick;
  475. bool canShoot = (Globals::LocalPlayer->GetActiveWeapon()->GetNextPrimaryAttack() <= flServerTime && Globals::LocalPlayer->GetActiveWeapon()->GetAmmo() > 0);
  476.  
  477. if (Target)
  478. {
  479. Globals::TargetIndex = targetID;
  480.  
  481. float SimulationTime = 0.f;
  482.  
  483. SimulationTime = g_LagComp.PlayerRecord[targetID].at(g_LagComp.PlayerRecord[targetID].size() - 1).SimTime;
  484.  
  485. Vector Angle = g_Math.CalcAngle(Globals::LocalPlayer->GetEyePosition(), Aimpoint);
  486.  
  487. static int MinimumVelocity = 0;
  488.  
  489. if (c_config::get().autostop_mode == 0)
  490. {
  491. MinimumVelocity = Globals::LocalPlayer->GetActiveWeapon()->GetCSWpnData()->max_speed_alt * .34f;
  492. }
  493. else if (c_config::get().autostop_mode == 1)
  494. {
  495. MinimumVelocity = 0;
  496. }
  497.  
  498. bool shouldstop = c_config::get().stop_inbetween_shots ? true : canShoot;
  499.  
  500. if (Globals::LocalPlayer->GetVelocity().Length() >= MinimumVelocity && !GetAsyncKeyState(VK_SPACE))
  501. {
  502. if (canShoot)
  503. {
  504. Autostop();
  505. }
  506. }
  507.  
  508. auto me = Globals::LocalPlayer;
  509. auto cmd = Globals::pCmd;
  510. if ((Globals::LocalPlayer->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_SCAR20 || Globals::LocalPlayer->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_G3SG1 || Globals::LocalPlayer->GetActiveWeapon()->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_SSG08)) {
  511. if (c_config::get().auto_scope) {
  512. if (!me->IsScoped()) {
  513. cmd->buttons |= IN_ATTACK2;
  514. return;
  515. }
  516. }
  517. }
  518.  
  519. if (canShoot && HitChance(Target, Globals::LocalPlayer->GetActiveWeapon(), Angle, Aimpoint, SynchronizeHitchance()))
  520. {
  521. CanShootWithCurrentHitchanceAndValidTarget = true;
  522. if (Globals::pCmd->buttons & IN_ATTACK)
  523. return;
  524.  
  525. if (!Backtrack[targetID] && !ShotBacktrack[targetID])
  526. Globals::Shot[targetID] = true;
  527.  
  528. Globals::bSendPacket = true;
  529. shot = true;
  530.  
  531. Globals::pCmd->viewangles = Angle;
  532.  
  533. Globals::pCmd->buttons |= IN_ATTACK;
  534.  
  535. Globals::pCmd->tick_count = TIME_TO_TICKS(SimulationTime + g_LagComp.LerpTime());
  536. }
  537. }
  538. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement