Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.84 KB | None | 0 0
  1. #pragma once
  2. #include "stdafx.h"
  3. #include "Tools\Utils\hitbox.h"
  4. #include "Tools\Hacks\Misc.h"
  5. #include "Tools\Utils\LocalInfo.h"
  6.  
  7. #include <vector>
  8. using namespace std;
  9.  
  10. #include "Tools\Utils\Playerlist.h"
  11.  
  12. #define keystate(i) GetAsyncKeyState(i & 0x8000)
  13.  
  14. class Legit
  15. {
  16. private:
  17. float deltaTime;
  18. float curAimTime;
  19.  
  20. int besttarget = -1;
  21. int besthitbox = -1;
  22.  
  23. bool EntityIsValid(int i, int hitbox)
  24. {
  25. auto pEntity = static_cast<CBaseEntity*> (Interfaces.pEntList->GetClientEntity(i));
  26.  
  27. if (!pEntity)
  28. return false;
  29. if (pEntity == Hacks.LocalPlayer)
  30. return false;
  31. if (pEntity->GetHealth() <= 0)
  32. return false;
  33. if (pEntity->HasGunGameImmunity())
  34. return false;
  35. if (pEntity->IsDormant())
  36. return false;
  37. if (pEntity->GetTeam() == Hacks.LocalPlayer->GetTeam())
  38. return false;
  39.  
  40. return true;
  41. }
  42.  
  43. void GetBestTarget()
  44. {
  45. float bestfov = 9999999.f;
  46. Vector vSrc = Hacks.LocalPlayer->GetEyePosition();
  47. for (int i = 0; i < Interfaces.pEntList->GetHighestEntityIndex(); i++)
  48. {
  49. if (!EntityIsValid(i, Options.LegitBot.Legitbot_hitbox + 1))
  50. continue;
  51.  
  52. auto pEntity = static_cast<CBaseEntity*> (Interfaces.pEntList->GetClientEntity(i));
  53. if (!pEntity)
  54. continue;
  55.  
  56.  
  57. if (Options.LegitBot.Legitbot_multihitbox)
  58. {
  59. for (int j = 3; j <= 27; j++)
  60. {
  61. Vector vec = pEntity->GetBonePos(j);
  62.  
  63. //if (!Misc::isVisible(pEntity, j))
  64. // continue;
  65. float fov = Misc::GetFov(Hacks.CurrentCmd->viewangles + LocalInfo.PunchAns * (Options.LegitBot.Legitbot_rcsforceX) / 50.f / 5 * 4.6, Misc::CalcAngle(Hacks.LocalPlayer->GetEyePosition(), pEntity->GetBonePos(j)));
  66. if (fov > Options.LegitBot.Legitbot_fov)
  67. continue;
  68.  
  69. if (fov < bestfov)
  70. {
  71. if (!Misc::pIsVisible(vSrc, vec, Hacks.LocalPlayer, pEntity, (Options.LegitBot.Legitbot_Smokecheck)))
  72. continue;
  73. if (Hacks.LocalPlayer->IsFlashed() > Options.LegitBot.Legitbot_FlashCheckDuration && Options.LegitBot.Legitbot_FlashCheck)
  74. continue;
  75. if (!(pEntity->GetFlags() & FL_ONGROUND) && Options.LegitBot.Legitbot_JumpCheck)
  76. continue;
  77. bestfov = fov;
  78. besttarget = i;
  79. besthitbox = j;
  80. }
  81. }
  82. }
  83. else
  84. {
  85.  
  86. Vector vec = pEntity->GetBonePos(Options.LegitBot.Legitbot_hitbox + 1);
  87. if (!Misc::pIsVisible(vSrc, vec, Hacks.LocalPlayer, pEntity, (Options.LegitBot.Legitbot_Smokecheck))) //Options.LegitBot.
  88. continue;
  89. if (Hacks.LocalPlayer->IsFlashed() && (Options.LegitBot.Legitbot_FlashCheck))
  90. continue;
  91. if (!(pEntity->GetFlags() & FL_ONGROUND) && Options.LegitBot.Legitbot_JumpCheck)
  92. continue;
  93. float fov = Misc::GetFov(Hacks.CurrentCmd->viewangles + LocalInfo.PunchAns, Misc::CalcAngle(Hacks.LocalPlayer->GetEyePosition(), pEntity->GetBonePos(Options.LegitBot.Legitbot_hitbox + 1)));
  94. if (fov > (Options.LegitBot.Legitbot_fov))
  95. continue;
  96. if (fov < bestfov)
  97. {
  98. bestfov = fov;
  99. besttarget = i;
  100. besthitbox = (Options.LegitBot.Legitbot_hitbox + 1);
  101. }
  102. }
  103.  
  104. }
  105. if (bestfov == 9999999.f)
  106. {
  107. besttarget = -1;
  108. besthitbox = -1;
  109. }
  110. return;
  111.  
  112. }
  113.  
  114. void GoToTarget(int target, int hitbox)
  115. {
  116. auto pEntity = static_cast<CBaseEntity*> (Interfaces.pEntList->GetClientEntity(target));
  117. if (!pEntity)
  118. return;
  119. Vector dst = Misc::CalcAngle(Hacks.LocalPlayer->GetEyePosition(), pEntity->GetBonePos(hitbox));
  120. Vector src = Hacks.CurrentCmd->viewangles;
  121.  
  122. dst.x -= LocalInfo.PunchAns.x * (Options.LegitBot.Legitbot_rcsforceX) / 50.f;
  123. dst.y -= LocalInfo.PunchAns.y * (Options.LegitBot.Legitbot_rcsforceY) / 50.f;
  124.  
  125. Vector delta = dst - src;
  126.  
  127. delta.Normalize();
  128.  
  129. if (!delta.IsZero())
  130. {
  131.  
  132. float smoothX = Options.LegitBot.Legitbot_smoothX;
  133. float finalTimeX = delta.Length();
  134. float smoothY = Options.LegitBot.Legitbot_smoothY;
  135. float finalTimeY = delta.Length();
  136.  
  137. if (smoothX != 0)
  138. {
  139. finalTimeX = delta.Length() / smoothX;
  140. }
  141.  
  142. if (smoothY != 0)
  143. {
  144. finalTimeY = delta.Length() / smoothY;
  145. }
  146.  
  147. float curAimTimeY = curAimTime;
  148. curAimTimeY += deltaTime;
  149. curAimTime += deltaTime;
  150.  
  151. if (curAimTime > finalTimeX)
  152. curAimTime = finalTimeX;
  153.  
  154. if (curAimTimeY > finalTimeY)
  155. curAimTimeY = finalTimeY;
  156.  
  157. float percentX = curAimTime / finalTimeX;
  158. float percentY = curAimTimeY / finalTimeY;
  159.  
  160. delta.x *= percentX;
  161. delta.y *= percentY;
  162. dst = src + delta;
  163. }
  164.  
  165. Hacks.CurrentCmd->viewangles = dst.Normalize();
  166. Interfaces.pEngine->SetViewAngles(Hacks.CurrentCmd->viewangles);
  167. }
  168. public:
  169. void Run()
  170. {
  171.  
  172. // вызыватьдоилипосле
  173. bool enable = 0;
  174. if ((Options.LegitBot.Legitbot_Aimonkey && KEY_DOWN(Options.LegitBot.Legitbot_Aimonkey) || !Options.LegitBot.Legitbot_Aimonkey))
  175. {
  176. enable = Options.Legitbot.Aimbot.Enabled;
  177. double cur_time = clock();
  178. static double time = clock();
  179. int fire_delay = (Options.LegitBot.Legitbot_Firedelay);
  180. if (fire_delay > 0)
  181. {
  182. if (Hacks.CurrentCmd->buttons & IN_ATTACK)
  183. {
  184. if (cur_time - time < fire_delay)
  185. {
  186. Hacks.CurrentCmd->buttons &= ~IN_ATTACK;
  187. }
  188. }
  189. else
  190. {
  191. time = clock();
  192. }
  193. }
  194.  
  195. curAimTime = 0.f;
  196.  
  197. static float oldServerTime = Hacks.LocalPlayer->GetTickBase() * Interfaces.pGlobalVars->interval_per_tick;
  198. float serverTime = Hacks.LocalPlayer->GetTickBase() * Interfaces.pGlobalVars->interval_per_tick;
  199. deltaTime = serverTime - oldServerTime;
  200. oldServerTime = serverTime;
  201.  
  202. if (Hacks.LocalWeapon->IsMiscWeapon())
  203. return;
  204.  
  205. if (Options.LegitBot.Legitbot_hitbox == 0)
  206. {
  207. Options.LegitBot.Legitbot_hitbox == 1;
  208. }
  209.  
  210.  
  211.  
  212. static int do_or_not = 0;
  213. if (do_or_not == 0)
  214. {
  215. GetBestTarget();
  216. }
  217. else
  218. { //ырф нет, не видел, инжектор ебони, я тебескину
  219. do_or_not++;
  220. if (do_or_not>15)
  221. {
  222. do_or_not = 0;
  223. }
  224. }
  225.  
  226.  
  227.  
  228.  
  229.  
  230. if (besttarget == -1 || besthitbox == -1)
  231. return;
  232. if (Options.LegitBot.Legitbot_Psilent)
  233. DoPerfectSilent(besttarget, besthitbox);
  234. else
  235. GoToTarget(besttarget, besthitbox);
  236.  
  237.  
  238.  
  239.  
  240. }
  241. }
  242.  
  243. void DoPerfectSilent(int target, int hitbox)
  244. {
  245. auto pEntity = static_cast<CBaseEntity*> (Interfaces.pEntList->GetClientEntity(target));
  246. Vector AimbotAngle = Misc::CalcAngle(Hacks.LocalPlayer->GetEyePosition(), pEntity->GetBonePos(hitbox));
  247. float flServerTime = (float)Hacks.LocalPlayer->GetTickBase() * Interfaces.pGlobalVars->interval_per_tick;
  248. float flNextPrimaryAttack = Hacks.LocalWeapon->NextPrimaryAttack();
  249. Vector localangs;
  250. Interfaces.pEngine->GetViewAngles(localangs);
  251. bool BulletTime = true;
  252.  
  253. if (flNextPrimaryAttack > flServerTime)
  254. BulletTime = false;
  255.  
  256. if (Hacks.CurrentCmd->buttons & IN_ATTACK && BulletTime)
  257. {
  258. Hacks.SendPacket = false;
  259. Hacks.CurrentCmd->viewangles = AimbotAngle - LocalInfo.PunchAns * (Options.LegitBot.Legitbot_Prcsforce) / 50.f;
  260.  
  261.  
  262. //if (!Hacks.SendPacket)
  263. //{
  264. // /*Hacks.CurrentCmd->viewangles = localangs;
  265. // std::chrono::milliseconds(2);*/
  266. // Hacks.SendPacket = true;
  267. //}
  268. }
  269. else
  270. {
  271. Hacks.CurrentCmd->viewangles = localangs;
  272. std::chrono::milliseconds(2);
  273. Hacks.SendPacket = true;
  274. Hacks.CurrentCmd->buttons &= ~IN_ATTACK;
  275.  
  276. }
  277.  
  278.  
  279. }
  280. }Legitbot;
  281.  
  282.  
  283. /*
  284. class Legit {
  285. int GetBestPoint(Vector& aimspot, Hitbox box) {
  286. Vector Aimangles;
  287. Misc::CalcAngle(Hacks.LocalPlayer->GetEyePosition(), box.points[0], Aimangles);
  288. if (Misc::FovTo(Hacks.CurrentCmd->viewangles, Aimangles) > Menu::AimbotMenu::Selection::Fov.value) return false;
  289. float bestdamage = 0;
  290. for (int index = 0; index < 27; ++index) {
  291. Vector Aimangles;
  292. Misc::CalcAngle(Hacks.LocalPlayer->GetEyePosition(), box.points[index], Aimangles);
  293. if (Misc::FovTo(Hacks.CurrentCmd->viewangles, Aimangles) > Menu::AimbotMenu::Selection::Fov.value) continue;
  294. float damage = Autowall::GetDamage(box.points[index]);
  295. if (damage > bestdamage) {
  296. aimspot = box.points[index];
  297. bestdamage = damage;
  298. }
  299. }
  300. return bestdamage;
  301. }
  302.  
  303. bool LegitAim(float fov, int hitbox) {
  304. if (!(Menu::LegitMenu::TriggerbotEnable.active || Hacks.CurrentCmd->buttons & IN_ATTACK && Misc::bullettime() && LocalInfo.Choked < 13)) return false;
  305. std::vector<Vector> possibleaimspots;
  306. std::vector<CBaseEntity*> possibletargets;
  307. for (auto i = 0; i <= Interfaces.pEntList->GetHighestEntityIndex(); i++) {
  308. auto pEntity = static_cast<CBaseEntity*> (Interfaces.pEntList->GetClientEntity(i));
  309. if (pEntity == nullptr) continue;
  310. if (pEntity == Hacks.LocalPlayer) continue;
  311. if (!pEntity->isAlive()) continue;
  312. if (!(pEntity->GetHealth() > 0)) continue;
  313. if (pEntity->GetTeam() == Hacks.LocalPlayer->GetTeam() && !Menu::AimbotMenu::Selection::TeamEnable.active) continue;
  314. if (pEntity->IsDormant()) continue;
  315. //if(GetChockedPackets(pEntity) == 0) continue;
  316. if (pEntity->HasGunGameImmunity()) continue;
  317. player_info_t info;
  318. if (!(Interfaces.pEngine->GetPlayerInfo(pEntity->GetIndex(), &info))) continue;
  319. possibletargets.emplace_back(pEntity);
  320. }
  321. if ((int)possibletargets.size()) {
  322. for (auto pEntity : possibletargets) {
  323. Hitbox box;
  324. if (!box.GetHitbox(pEntity, hitbox)) continue;
  325. Vector Aimspot;
  326. if (GetBestPoint(Aimspot, box) != 0) {
  327. //FindActualHitbox(pEntity, Aimspot);
  328.  
  329. plist.Update();
  330. PlayerList::CPlayer* Player = plist.FindPlayer(pEntity);
  331. Player->entity = pEntity;
  332. possibleaimspots.emplace_back(Aimspot);
  333. }
  334. }
  335. }
  336. for (auto Spot : possibleaimspots) {
  337. Vector vecCurPos = Hacks.LocalPlayer->GetEyePosition();
  338. Vector angs;
  339. Misc::CalcAngle(vecCurPos, Spot, angs);
  340. Vector localangs;
  341. Interfaces.pEngine->GetViewAngles(localangs);
  342. if (Misc::FovTo(localangs, angs) <= fov) {
  343. if (!Menu::LegitMenu::SilentEnable.active) Interfaces.pEngine->SetViewAngles(angs);
  344. Hacks.CurrentCmd->viewangles = angs;
  345. Hacks.CurrentCmd->buttons |= IN_ATTACK;
  346. Hacks.SendPacket = false;
  347. return true;
  348. }
  349. }
  350. }
  351.  
  352. void GetSettings(float& fov, float& recoil, int& Hitbox) {
  353. if (Hacks.LocalWeapon->isRifle() || Hacks.LocalWeapon->isSmgW()) {
  354. fov = Menu::LegitMenu::Rifle::FOV.value;
  355. recoil = Menu::LegitMenu::Rifle::Recoil.value;
  356. Hitbox = Menu::LegitMenu::Rifle::Hitbox.activeid;
  357. }
  358. else if (Hacks.LocalWeapon->isSniper()) {
  359. fov = Menu::LegitMenu::Sniper::FOV.value;
  360. recoil = Menu::LegitMenu::Sniper::Recoil.value;
  361. Hitbox = Menu::LegitMenu::Sniper::Hitbox.activeid;
  362. }
  363. else if (Hacks.LocalWeapon->isPistol()) {
  364. fov = Menu::LegitMenu::Pistol::FOV.value;
  365. recoil = Menu::LegitMenu::Pistol::Recoil.value;
  366. Hitbox = Menu::LegitMenu::Pistol::Hitbox.activeid;
  367. }
  368. }
  369.  
  370. public:
  371. void Run() {
  372. if (!Menu::LegitMenu::LegitEnable.active) return;
  373. if (!LocalInfo.Flags & FL_ONGROUND && Hacks.LocalPlayer->GetFlags() & FL_ONGROUND && Hacks.CurrentCmd->buttons & IN_JUMP && Menu::LegitMenu::Bhop.active) Hacks.CurrentCmd->buttons &= ~IN_JUMP;
  374. float fov = 0, recoil = 0;
  375. int hitbox = 0;
  376. GetSettings(fov, recoil, hitbox);
  377. LegitAim(fov, hitbox);
  378. Hacks.CurrentCmd->viewangles -= LocalInfo.PunchAns * (recoil * 2);
  379. }
  380. } LegitBot;
  381. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement