Advertisement
Guest User

Untitled

a guest
May 26th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. void CAimBot::Trigger(struct usercmd_s *cmd)
  2. {
  3.  
  4. if (cvar.trigger_key > 0 && cvar.trigger_key < 255)
  5. {
  6. static DWORD dwTemporaryBlockTimer = 0;
  7.  
  8. if (GetTickCount() - dwTemporaryBlockTimer > 200)
  9. {
  10. if (g_Menu.keys[cvar.trigger_key]) {
  11. TriggerKeyStatus = !TriggerKeyStatus;
  12. dwTemporaryBlockTimer = GetTickCount();
  13. }
  14. }
  15.  
  16. if (!TriggerKeyStatus)
  17. return;
  18. }
  19.  
  20. if (!IsCurWeaponGun() || !CanAttack())
  21. return;
  22.  
  23. unsigned int m_iWeaponID = g_Local.weapon.m_iWeaponID;
  24.  
  25. if (!cvar.legit[m_iWeaponID].trigger)
  26. return;
  27.  
  28. if (cvar.trigger_only_zoomed && IsCurWeaponSniper() && g_Local.iFOV == DEFAULT_FOV)
  29. return;
  30.  
  31. std::deque<unsigned int> Hitboxes;
  32.  
  33. if (cvar.legit[m_iWeaponID].trigger_head)
  34. {
  35. Hitboxes.push_front(11);
  36. }
  37.  
  38. if (cvar.legit[m_iWeaponID].trigger_chest)
  39. {
  40. Hitboxes.push_back(7);
  41. Hitboxes.push_back(8);
  42. Hitboxes.push_back(9);
  43. //Hitboxes.push_back(10);
  44. //Hitboxes.push_back(11);
  45. //Hitboxes.push_back(12);
  46. //Hitboxes.push_back(17);
  47. }
  48.  
  49. if (cvar.legit[m_iWeaponID].trigger_stomach)
  50. {
  51. Hitboxes.push_back(0);
  52. }
  53.  
  54. if (cvar.legit[m_iWeaponID].trigger_all)
  55. {
  56. Hitboxes.push_back(0);
  57. Hitboxes.push_back(1);
  58. Hitboxes.push_back(2);
  59. Hitboxes.push_back(3);
  60. Hitboxes.push_back(4);
  61. Hitboxes.push_back(5);
  62. Hitboxes.push_back(6);
  63. Hitboxes.push_back(7);
  64. Hitboxes.push_back(8);
  65. Hitboxes.push_back(9);
  66. Hitboxes.push_back(10);
  67. Hitboxes.push_back(11);
  68. Hitboxes.push_back(12);
  69. Hitboxes.push_back(13);
  70. Hitboxes.push_back(14);
  71. Hitboxes.push_back(15);
  72. Hitboxes.push_back(16);
  73. Hitboxes.push_back(17);
  74. Hitboxes.push_back(18);
  75. Hitboxes.push_back(19);
  76. Hitboxes.push_back(21);
  77. }
  78.  
  79. float flAccuracy = cvar.legit[m_iWeaponID].trigger_accuracy;
  80.  
  81. Vector vecSpreadDir, vecForward, vecRight, vecUp, vecRandom;
  82.  
  83. QAngle QAngles;
  84.  
  85. g_Engine.GetViewAngles(QAngles);
  86.  
  87. if (flAccuracy > 0)//Recoil
  88. {
  89. QAngles[0] += g_Local.vPunchangle[0];
  90. QAngles[1] += g_Local.vPunchangle[1];
  91. QAngles[2] = NULL;
  92. }
  93.  
  94. QAngles.Normalize();
  95.  
  96. QAngles.AngleVectors(&vecForward, &vecRight, &vecUp);
  97.  
  98. if (flAccuracy > 1)//Recoil / Spread
  99. {
  100. g_NoSpread.GetSpreadXY(g_Local.weapon.random_seed, 1, vecRandom);
  101.  
  102. vecSpreadDir = vecForward + (vecRight * vecRandom[0]) + (vecUp * vecRandom[1]);
  103.  
  104. vecSpreadDir.Normalize();
  105. }
  106. else {//Empty or Recoil
  107. vecSpreadDir = vecForward;
  108.  
  109. vecSpreadDir.Normalize();
  110.  
  111. }
  112.  
  113. for (unsigned int id = 0; id < 33; ++id)
  114. {
  115. if (id == g_Local.iIndex)
  116. continue;
  117.  
  118. if (!g_Player[id].bAlive)
  119. continue;
  120.  
  121. if (!g_Player[id].bVisible)
  122. continue;
  123.  
  124. if (!cvar.legit_teammates && g_Player[id].iTeam == g_Local.iTeam)
  125. continue;
  126.  
  127. for (auto &&hitbox : Hitboxes)
  128. {
  129. for (unsigned int i = 0; i < 12; i++)
  130. {
  131. if (g_PlayerExtraInfoList[id].bHitboxPointsVisible[hitbox][byHitboxMatrix[i][0]] && g_PlayerExtraInfoList[id].bHitboxPointsVisible[hitbox][byHitboxMatrix[i][1]])
  132. {
  133. if (g_Utils.IsBoxIntersectingRay(g_PlayerExtraInfoList[id].vHitboxMulti[hitbox][byHitboxMatrix[i][0]], g_PlayerExtraInfoList[id].vHitboxMulti[hitbox][byHitboxMatrix[i][1]], vecSpreadDir))
  134. {
  135. cmd->buttons |= IN_ATTACK;
  136. //g_Local.weapon.m_flNextPrimaryAttack > 0.0f ? cmd->buttons &= ~IN_ATTACK : cmd->buttons |= IN_ATTACK;
  137. }
  138. }
  139. }
  140. }
  141. }
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement