Advertisement
Guest User

Untitled

a guest
Nov 4th, 2017
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.23 KB | None | 0 0
  1. #include "ESP.h"
  2. #include "Interfaces.h"
  3. #include "RenderManager.h"
  4. #include "GlowManager.h"
  5.  
  6. DWORD GlowManager = *(DWORD*)(Utilities::Memory::FindPatternV2("client.dll", "0F 11 05 ?? ?? ?? ?? 83 C8 01 C7 05 ?? ?? ?? ?? 00 00 00 00") + 3);
  7.  
  8. #ifdef NDEBUG
  9. #define strenc( s ) std::string( cx_make_encrypted_string( s ) )
  10. #define charenc( s ) strenc( s ).c_str()
  11. #define wstrenc( s ) std::wstring( strenc( s ).begin(), strenc( s ).end() )
  12. #define wcharenc( s ) wstrenc( s ).c_str()
  13. #else
  14. #define strenc( s ) ( s )
  15. #define charenc( s ) ( s )
  16. #define wstrenc( s ) ( s )
  17. #define wcharenc( s ) ( s )
  18. #endif
  19.  
  20. #ifdef NDEBUG
  21. #define XorStr( s ) ( XorCompileTime::XorString< sizeof( s ) - 1, __COUNTER__ >( s, std::make_index_sequence< sizeof( s ) - 1>() ).decrypt() )
  22. #else
  23. #define XorStr( s ) ( s )
  24. #endif
  25.  
  26.  
  27. void CEsp::Init()
  28. {
  29. BombCarrier = nullptr;
  30. }
  31.  
  32. void CEsp::Move(CUserCmd *pCmd,bool &bSendPacket)
  33. {
  34.  
  35. }
  36.  
  37. void CEsp::Draw()
  38. {
  39. IClientEntity *pLocal = hackManager.pLocal();
  40.  
  41. for (int i = 0; i < Interfaces::EntList->GetHighestEntityIndex(); i++)
  42. {
  43. IClientEntity *pEntity = Interfaces::EntList->GetClientEntity(i);
  44. player_info_t pinfo;
  45.  
  46. if (pEntity && pEntity != pLocal && !pEntity->IsDormant())
  47. {
  48. if (Menu::Window.VisualsTab.OtherRadar.GetState())
  49. {
  50. DWORD m_bSpotted = NetVar.GetNetVar(0x839EB159);
  51. *(char*)((DWORD)(pEntity)+m_bSpotted) = 1;
  52. }
  53.  
  54. if (Menu::Window.VisualsTab.FiltersPlayers.GetState() && Interfaces::Engine->GetPlayerInfo(i, &pinfo) && pEntity->IsAlive())
  55. {
  56. DrawPlayer(pEntity, pinfo);
  57. }
  58.  
  59. ClientClass* cClass = (ClientClass*)pEntity->GetClientClass();
  60.  
  61. if (Menu::Window.VisualsTab.FiltersNades.GetState())
  62. {
  63. if (cClass->m_ClassID == (int)CSGOClassID::CBaseCSGrenadeProjectile)
  64. DrawHE(pEntity, cClass);
  65.  
  66. if (cClass->m_ClassID == (int)CSGOClassID::CMolotovProjectile)
  67. DrawMolotov(pEntity, cClass);
  68.  
  69. if (cClass->m_ClassID == (int)CSGOClassID::CDecoyProjectile)
  70. DrawDecoy(pEntity, cClass);
  71.  
  72. if (cClass->m_ClassID == (int)CSGOClassID::CSensorGrenadeProjectile)
  73. DrawMolotov(pEntity, cClass);
  74.  
  75. if (cClass->m_ClassID == (int)CSGOClassID::CSmokeGrenadeProjectile)
  76. DrawSmoke(pEntity, cClass);
  77. }
  78.  
  79. if (Menu::Window.VisualsTab.FiltersWeapons.GetState() && cClass->m_ClassID != (int)CSGOClassID::CBaseWeaponWorldModel && ((strstr(cClass->m_pNetworkName, "Weapon") || cClass->m_ClassID == (int)CSGOClassID::CDEagle || cClass->m_ClassID == (int)CSGOClassID::CAK47)))
  80. {
  81. DrawDrop(pEntity, cClass);
  82. }
  83.  
  84. if (Menu::Window.VisualsTab.FiltersC4.GetState())
  85. {
  86. if (cClass->m_ClassID == (int)CSGOClassID::CPlantedC4)
  87. DrawBombPlanted(pEntity, cClass);
  88.  
  89. if (cClass->m_ClassID == (int)CSGOClassID::CC4)
  90. DrawBomb(pEntity, cClass);
  91. }
  92.  
  93. if (Menu::Window.VisualsTab.FiltersChickens.GetState())
  94. {
  95. if (cClass->m_ClassID == (int)CSGOClassID::CChicken)
  96. DrawChicken(pEntity, cClass);
  97. }
  98. }
  99. }
  100.  
  101. if (Menu::Window.VisualsTab.OtherNoFlash.GetState())
  102. {
  103. DWORD m_flFlashMaxAlpha = NetVar.GetNetVar(0xFE79FB98);
  104. *(float*)((DWORD)pLocal + m_flFlashMaxAlpha) = 0;
  105. }
  106.  
  107. if (Menu::Window.VisualsTab.OptionsGlow.GetState())
  108. {
  109. DrawGlow();
  110. }
  111. if (Menu::Window.VisualsTab.EntityGlow.GetState())
  112. {
  113. EntityGlow();
  114. }
  115.  
  116. if (Menu::Window.VisualsTab.GrenadeTrace.GetState())
  117. {
  118. GrenadeTrace();
  119. }
  120. }
  121.  
  122. void CEsp::DrawPlayer(IClientEntity* pEntity, player_info_t pinfo)
  123. {
  124. ESPBox Box;
  125. Color Color;
  126.  
  127. if (Menu::Window.VisualsTab.FiltersEnemiesOnly.GetState() && (pEntity->GetTeamNum() == hackManager.pLocal()->GetTeamNum()))
  128. return;
  129.  
  130. if (GetBox(pEntity, Box))
  131. {
  132. Color = GetPlayerColor(pEntity);
  133.  
  134. switch (Menu::Window.VisualsTab.OptionsBox.GetIndex())
  135. {
  136. case 0:
  137. break;
  138. case 1:
  139. DrawBox(Box, Color);
  140. break;
  141. case 2:
  142. FilledBox(Box, Color);
  143. break;
  144. case 3:
  145. Corners(Box, Color, pEntity);
  146. break;
  147. }
  148.  
  149. switch (Menu::Window.VisualsTab.OptionsWeapon.GetIndex())
  150. {
  151. case 0:
  152. break;
  153. case 1:
  154. DrawWeapon(pEntity, Box);
  155. break;
  156. case 2:
  157. DrawIcon(pEntity, Box);
  158. break;
  159. }
  160.  
  161. if (Menu::Window.VisualsTab.OptionsName.GetState())
  162. DrawName(pinfo, Box);
  163.  
  164. if (Menu::Window.VisualsTab.OptionsHealth.GetState())
  165. DrawHealth(pEntity, Box);
  166.  
  167. if (Menu::Window.VisualsTab.OptionsInfo.GetState())
  168. DrawInfo(pEntity, Box);
  169.  
  170. if (Menu::Window.VisualsTab.OptionsArmor.GetState())
  171. Armor(pEntity, Box);
  172.  
  173. if (Menu::Window.VisualsTab.Barrels.GetState())
  174. Barrel(Box, Color, pEntity);
  175.  
  176. if (Menu::Window.VisualsTab.OptionsDefusing.GetState())
  177. IsPlayerDefusing(pinfo, Box, pEntity);
  178.  
  179. if (Menu::Window.VisualsTab.OptionsAimSpot.GetState())
  180. DrawCross(pEntity);
  181.  
  182. if (Menu::Window.VisualsTab.OptionsSkeleton.GetState())
  183. DrawSkeleton(pEntity);
  184.  
  185. if (Menu::Window.VisualsTab.Money.GetState())
  186. DrawMoney(pEntity, Box);
  187.  
  188. if (Menu::Window.VisualsTab.Distance.GetState())
  189. DrawDistance(Box, pEntity);
  190.  
  191. Info(pEntity, Box);
  192.  
  193. }
  194. }
  195.  
  196. bool CEsp::GetBox(IClientEntity* pEntity, CEsp::ESPBox &result)
  197. {
  198. Vector vOrigin, min, max, sMin, sMax, sOrigin,
  199. flb, brt, blb, frt, frb, brb, blt, flt;
  200. float left, top, right, bottom;
  201.  
  202. vOrigin = pEntity->GetOrigin();
  203. min = pEntity->collisionProperty()->GetMins() + vOrigin;
  204. max = pEntity->collisionProperty()->GetMaxs() + vOrigin;
  205.  
  206. Vector points[] = { Vector(min.x, min.y, min.z),
  207. Vector(min.x, max.y, min.z),
  208. Vector(max.x, max.y, min.z),
  209. Vector(max.x, min.y, min.z),
  210. Vector(max.x, max.y, max.z),
  211. Vector(min.x, max.y, max.z),
  212. Vector(min.x, min.y, max.z),
  213. Vector(max.x, min.y, max.z) };
  214.  
  215. if (!Render::WorldToScreen(points[3], flb) || !Render::WorldToScreen(points[5], brt)
  216. || !Render::WorldToScreen(points[0], blb) || !Render::WorldToScreen(points[4], frt)
  217. || !Render::WorldToScreen(points[2], frb) || !Render::WorldToScreen(points[1], brb)
  218. || !Render::WorldToScreen(points[6], blt) || !Render::WorldToScreen(points[7], flt))
  219. return false;
  220.  
  221. Vector arr[] = { flb, brt, blb, frt, frb, brb, blt, flt };
  222.  
  223. left = flb.x;
  224. top = flb.y;
  225. right = flb.x;
  226. bottom = flb.y;
  227.  
  228. for (int i = 1; i < 8; i++)
  229. {
  230. if (left > arr[i].x)
  231. left = arr[i].x;
  232. if (bottom < arr[i].y)
  233. bottom = arr[i].y;
  234. if (right < arr[i].x)
  235. right = arr[i].x;
  236. if (top > arr[i].y)
  237. top = arr[i].y;
  238. }
  239.  
  240. result.x = left;
  241. result.y = top;
  242. result.w = right - left;
  243. result.h = bottom - top;
  244.  
  245. return true;
  246. }
  247.  
  248. Color CEsp::GetPlayerColor(IClientEntity* pEntity)
  249. {
  250. int TeamNum = pEntity->GetTeamNum();
  251. bool IsVis = GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Head);
  252.  
  253. Color color;
  254.  
  255. if (TeamNum == TEAM_CS_T)
  256. {
  257. if (IsVis)
  258. color = Color(Menu::Window.ColorsTab.TColorVisR.GetValue(), Menu::Window.ColorsTab.TColorVisG.GetValue(), Menu::Window.ColorsTab.TColorVisB.GetValue(), 255);
  259. else
  260. color = Color(Menu::Window.ColorsTab.TColorNoVisR.GetValue(), Menu::Window.ColorsTab.TColorNoVisG.GetValue(), Menu::Window.ColorsTab.TColorNoVisB.GetValue(), 255);
  261. }
  262. else
  263. {
  264. if (IsVis)
  265. color = Color(Menu::Window.ColorsTab.CTColorVisR.GetValue(), Menu::Window.ColorsTab.CTColorVisG.GetValue(), Menu::Window.ColorsTab.CTColorVisB.GetValue(), 255);
  266. else
  267. color = Color(Menu::Window.ColorsTab.CTColorNoVisR.GetValue(), Menu::Window.ColorsTab.CTColorNoVisG.GetValue(), Menu::Window.ColorsTab.CTColorNoVisB.GetValue(), 255);
  268. }
  269.  
  270. return color;
  271. }
  272.  
  273. void CEsp::Corners(CEsp::ESPBox size, Color color, IClientEntity* pEntity)
  274. {
  275. int VertLine = (((float)size.w) * (0.20f));
  276. int HorzLine = (((float)size.h) * (0.30f));
  277.  
  278. Render::Clear(size.x, size.y - 1, VertLine, 1, Color(0, 0, 0, 255));
  279. Render::Clear(size.x + size.w - VertLine, size.y - 1, VertLine, 1, Color(0, 0, 0, 255));
  280. Render::Clear(size.x, size.y + size.h - 1, VertLine, 1, Color(0, 0, 0, 255));
  281. Render::Clear(size.x + size.w - VertLine, size.y + size.h - 1, VertLine, 1, Color(0, 0, 0, 255));
  282.  
  283. Render::Clear(size.x - 1, size.y, 1, HorzLine, Color(0, 0, 0, 255));
  284. Render::Clear(size.x - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(0, 0, 0, 255));
  285. Render::Clear(size.x + size.w - 1, size.y, 1, HorzLine, Color(0, 0, 0, 255));
  286. Render::Clear(size.x + size.w - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(0, 0, 0, 255));
  287.  
  288. Render::Clear(size.x, size.y, VertLine, 1, color);
  289. Render::Clear(size.x + size.w - VertLine, size.y, VertLine, 1, color);
  290. Render::Clear(size.x, size.y + size.h, VertLine, 1, color);
  291. Render::Clear(size.x + size.w - VertLine, size.y + size.h, VertLine, 1, color);
  292.  
  293. Render::Clear(size.x, size.y, 1, HorzLine, color);
  294. Render::Clear(size.x, size.y + size.h - HorzLine, 1, HorzLine, color);
  295. Render::Clear(size.x + size.w, size.y, 1, HorzLine, color);
  296. Render::Clear(size.x + size.w, size.y + size.h - HorzLine, 1, HorzLine, color);
  297. }
  298.  
  299. void CEsp::FilledBox(CEsp::ESPBox size, Color color)
  300. {
  301. int VertLine = (((float)size.w) * (0.20f));
  302. int HorzLine = (((float)size.h) * (0.20f));
  303.  
  304. Render::Clear(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(0, 0, 0, 40));
  305. Render::Clear(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(0, 0, 0, 40));
  306. Render::Clear(size.x, size.y, VertLine, 1, color);
  307. Render::Clear(size.x + size.w - VertLine, size.y, VertLine, 1, color);
  308. Render::Clear(size.x, size.y + size.h, VertLine, 1, color);
  309. Render::Clear(size.x + size.w - VertLine, size.y + size.h, VertLine, 1, color);
  310. Render::Clear(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(0, 0, 0, 40));
  311. Render::Clear(size.x, size.y, 1, HorzLine, color);
  312. Render::Clear(size.x, size.y + size.h - HorzLine, 1, HorzLine, color);
  313. Render::Clear(size.x + size.w, size.y, 1, HorzLine, color);
  314. Render::Clear(size.x + size.w, size.y + size.h - HorzLine, 1, HorzLine, color);
  315. Render::Clear(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(0, 0, 0, 40));
  316. }
  317.  
  318. void CEsp::DrawBox(CEsp::ESPBox size, Color color)
  319. {
  320. Render::Outline(size.x, size.y, size.w, size.h, color);
  321. Render::Outline(size.x - 1, size.y - 1, size.w + 2, size.h + 2, Color(10, 10, 10, 150));
  322. Render::Outline(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(10, 10, 10, 150));
  323. }
  324.  
  325. void CEsp::Barrel(CEsp::ESPBox size, Color color, IClientEntity* pEntity)
  326. {
  327. Vector src3D, src;
  328. src3D = pEntity->GetOrigin() - Vector(0, 0, 0);
  329.  
  330. if (!Render::WorldToScreen(src3D, src))
  331. return;
  332.  
  333. int ScreenWidth, ScreenHeight;
  334. Interfaces::Engine->GetScreenSize(ScreenWidth, ScreenHeight);
  335.  
  336. int x = (int)(ScreenWidth * 0.5f);
  337. int y = 0;
  338.  
  339.  
  340. y = ScreenHeight;
  341.  
  342. Render::Line((int)(src.x), (int)(src.y), x, y, Color(0, 255, 0, 255));
  343. }
  344.  
  345. void CEsp::DrawWeapon(IClientEntity* pEntity, CEsp::ESPBox size)
  346. {
  347. IClientEntity* pWeapon = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)pEntity->GetActiveWeaponHandle());
  348. if (Menu::Window.VisualsTab.OptionsWeapon.GetIndex() == 1 && pWeapon)
  349. {
  350. RECT nameSize = Render::GetTextSize(Render::Fonts::ESP, pWeapon->GetpWeaponName());
  351. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y + size.h + 8,
  352. Color(255, 255, 255, 255), Render::Fonts::ESP, pWeapon->GetpWeaponName());
  353. }
  354. }
  355.  
  356. void CEsp::DrawIcon(IClientEntity* pEntity, CEsp::ESPBox size)
  357. {
  358. IClientEntity* pWeapon = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)pEntity->GetActiveWeaponHandle());
  359. if (Menu::Window.VisualsTab.OptionsWeapon.GetIndex() == 2 && pWeapon)
  360. {
  361. RECT nameSize = Render::GetTextSize(Render::Fonts::Icon, pWeapon->GetGunIcon());
  362. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y + size.h + 8,
  363. Color(255, 255, 255, 255), Render::Fonts::Icon, pWeapon->GetGunIcon());
  364. }
  365. }
  366.  
  367. void CEsp::DrawGlow()
  368. {
  369. int GlowR = Menu::Window.ColorsTab.GlowR.GetValue();
  370. int GlowG = Menu::Window.ColorsTab.GlowG.GetValue();
  371. int GlowB = Menu::Window.ColorsTab.GlowB.GetValue();
  372. int GlowZ = Menu::Window.VisualsTab.GlowZ.GetValue();
  373.  
  374. CGlowObjectManager* GlowObjectManager = (CGlowObjectManager*)GlowManager;
  375.  
  376. for (int i = 0; i < GlowObjectManager->size; ++i)
  377. {
  378. CGlowObjectManager::GlowObjectDefinition_t* glowEntity = &GlowObjectManager->m_GlowObjectDefinitions[i];
  379. IClientEntity* Entity = glowEntity->getEntity();
  380.  
  381. if (glowEntity->IsEmpty() || !Entity)
  382. continue;
  383.  
  384. switch (Entity->GetClientClass()->m_ClassID)
  385. {
  386. case 35:
  387. if (Menu::Window.VisualsTab.OptionsGlow.GetState())
  388. {
  389. if (!Menu::Window.VisualsTab.FiltersPlayers.GetState() && !(Entity->GetTeamNum() == hackManager.pLocal()->GetTeamNum()))
  390. break;
  391. if (Menu::Window.VisualsTab.FiltersEnemiesOnly.GetState() && (Entity->GetTeamNum() == hackManager.pLocal()->GetTeamNum()))
  392. break;
  393.  
  394. if (GameUtils::IsVisible(hackManager.pLocal(), Entity, 0))
  395. {
  396. glowEntity->set((Entity->GetTeamNum() == hackManager.pLocal()->GetTeamNum()) ? Color(GlowR, GlowG, GlowB, GlowZ) : Color(GlowR, GlowG, GlowB, GlowZ));
  397. }
  398.  
  399. else
  400. {
  401. glowEntity->set((Entity->GetTeamNum() == hackManager.pLocal()->GetTeamNum()) ? Color(GlowR, GlowG, GlowB, GlowZ) : Color(GlowR, GlowG, GlowB, GlowZ));
  402. }
  403. }
  404. }
  405. }
  406. }
  407.  
  408. void CEsp::EntityGlow()
  409. {
  410. int GlowR = Menu::Window.ColorsTab.GlowR.GetValue();
  411. int GlowG = Menu::Window.ColorsTab.GlowG.GetValue();
  412. int GlowB = Menu::Window.ColorsTab.GlowB.GetValue();
  413. int GlowZ = Menu::Window.VisualsTab.GlowZ.GetValue();
  414.  
  415. CGlowObjectManager* GlowObjectManager = (CGlowObjectManager*)GlowManager;
  416.  
  417. for (int i = 0; i < GlowObjectManager->size; ++i)
  418. {
  419. CGlowObjectManager::GlowObjectDefinition_t* glowEntity = &GlowObjectManager->m_GlowObjectDefinitions[i];
  420. IClientEntity* Entity = glowEntity->getEntity();
  421.  
  422. if (glowEntity->IsEmpty() || !Entity)
  423. continue;
  424.  
  425. switch (Entity->GetClientClass()->m_ClassID)
  426. {
  427. case 1:
  428. if (Menu::Window.VisualsTab.EntityGlow.GetState())
  429. {
  430. if (Menu::Window.VisualsTab.EntityGlow.GetState())
  431. glowEntity->set(Color(GlowR, GlowG, GlowB, GlowZ));
  432. }
  433. case 9:
  434. if (Menu::Window.VisualsTab.FiltersNades.GetState())
  435. {
  436. if (Menu::Window.VisualsTab.EntityGlow.GetState())
  437. glowEntity->set(Color(GlowR, GlowG, GlowB, GlowZ));
  438. }
  439. case 29:
  440. if (Menu::Window.VisualsTab.EntityGlow.GetState())
  441. {
  442. glowEntity->set(Color(GlowR, GlowG, GlowB, GlowZ));
  443. }
  444. case 39:
  445. if (Menu::Window.VisualsTab.EntityGlow.GetState())
  446. {
  447. if (Menu::Window.VisualsTab.FiltersC4.GetState())
  448. glowEntity->set(Color(GlowR, GlowG, GlowB, GlowZ));
  449. }
  450. case 41:
  451. if (Menu::Window.VisualsTab.EntityGlow.GetState())
  452. {
  453. glowEntity->set(Color(GlowR, GlowG, GlowB, GlowZ));
  454. }
  455. case 66:
  456. if (Menu::Window.VisualsTab.EntityGlow.GetState())
  457. {
  458. glowEntity->set(Color(GlowR, GlowG, GlowB, GlowZ));
  459. }
  460. case 87:
  461. if (Menu::Window.VisualsTab.FiltersNades.GetState())
  462. {
  463. glowEntity->set(Color(GlowR, GlowG, GlowB, GlowZ));
  464. }
  465. case 98:
  466. if (Menu::Window.VisualsTab.FiltersNades.GetState())
  467. {
  468. glowEntity->set(Color(GlowR, GlowG, GlowB, GlowZ));
  469. }
  470. case 108:
  471. if (Menu::Window.VisualsTab.FiltersC4.GetState())
  472. {
  473. glowEntity->set(Color(GlowR, GlowG, GlowB, GlowZ));
  474. }
  475. case 130:
  476. if (Menu::Window.VisualsTab.FiltersNades.GetState())
  477. {
  478. glowEntity->set(Color(GlowR, GlowG, GlowB, GlowZ));
  479. }
  480. case 134:
  481. if (Menu::Window.VisualsTab.FiltersNades.GetState())
  482. {
  483. glowEntity->set(Color(GlowR, GlowG, GlowB, GlowZ));
  484. }
  485. default:
  486. if (Menu::Window.VisualsTab.EntityGlow.GetState())
  487. {
  488. if (strstr(Entity->GetClientClass()->m_pNetworkName, "Weapon"))
  489. glowEntity->set(Color(GlowR, GlowG, GlowB, GlowZ));
  490. }
  491. }
  492. }
  493. }
  494.  
  495. static wchar_t* CharToWideChar(const char* text)
  496. {
  497. size_t size = strlen(text) + 1;
  498. wchar_t* wa = new wchar_t[size];
  499. mbstowcs_s(NULL, wa, size/4, text, size);
  500. return wa;
  501. }
  502.  
  503. void CEsp::DrawName(player_info_t pinfo, CEsp::ESPBox size)
  504. {
  505. RECT nameSize = Render::GetTextSize(Render::Fonts::ESP, pinfo.name);
  506. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y - 16,
  507. Color(255, 255, 255, 255), Render::Fonts::ESP, pinfo.name);
  508. }
  509.  
  510. void CEsp::DrawHealth(IClientEntity* pEntity, CEsp::ESPBox size)
  511. {
  512. int HPEnemy = 100;
  513. HPEnemy = pEntity->GetHealth();
  514. char nameBuffer[512];
  515. sprintf_s(nameBuffer, "%d", HPEnemy);
  516.  
  517.  
  518. float h = (size.h);
  519. float offset = (h / 4.f) + 5;
  520. float w = h / 64.f;
  521. float health = pEntity->GetHealth();
  522. UINT hp = h - (UINT)((h * health) / 100);
  523.  
  524. int Red = 255 - (health*2.55);
  525. int Green = health*2.55;
  526.  
  527. Render::DrawOutlinedRect((size.x - 6) - 1, size.y - 1, 3, h + 2, Color(0, 0, 0, 180));
  528.  
  529. Render::DrawLine((size.x - 6), size.y + hp, (size.x - 6), size.y + h, Color(Red, Green, 0, 180));
  530.  
  531. if (health < 100) {
  532.  
  533. Render::Text(size.x - 9, size.y + hp, Color(255, 255, 255, 255), Render::Fonts::ESP, nameBuffer);
  534. }
  535. }
  536.  
  537. std::string CleanItemName(std::string name)
  538. {
  539. std::string Name = name;
  540. if (Name[0] == 'C')
  541. Name.erase(Name.begin());
  542.  
  543. auto startOfWeap = Name.find("Weapon");
  544. if (startOfWeap != std::string::npos)
  545. Name.erase(Name.begin() + startOfWeap, Name.begin() + startOfWeap + 6);
  546.  
  547. return Name;
  548. }
  549.  
  550. void CEsp::DrawInfo(IClientEntity* pEntity, CEsp::ESPBox size)
  551. {
  552. std::vector<std::string> Info;
  553.  
  554. if (Menu::Window.VisualsTab.OptionsInfo.GetState() && pEntity == BombCarrier)
  555. {
  556. Info.push_back("Bomb Carrier");
  557. }
  558.  
  559. static RECT Size = Render::GetTextSize(Render::Fonts::Default, "Hi");
  560. int i = 0;
  561. for (auto Text : Info)
  562. {
  563. Render::Text(size.x + size.w + 3, size.y + (i*(Size.bottom + 2)), Color(255, 255, 255, 255), Render::Fonts::ESP, Text.c_str());
  564. i++;
  565. }
  566. }
  567.  
  568. void CEsp::DrawCross(IClientEntity* pEntity)
  569. {
  570. Vector cross = pEntity->GetHeadPos(), screen;
  571. static int Scale = 2;
  572. if (Render::WorldToScreen(cross, screen))
  573. {
  574. Render::Clear(screen.x - Scale, screen.y - (Scale * 2), (Scale * 2), (Scale * 4), Color(20, 20, 20, 160));
  575. Render::Clear(screen.x - (Scale * 2), screen.y - Scale, (Scale * 4), (Scale * 2), Color(20, 20, 20, 160));
  576. Render::Clear(screen.x - Scale - 1, screen.y - (Scale * 2) - 1, (Scale * 2) - 2, (Scale * 4) - 2, Color(250, 250, 250, 160));
  577. Render::Clear(screen.x - (Scale * 2) - 1, screen.y - Scale - 1, (Scale * 4) - 2, (Scale * 2) - 2, Color(250, 250, 250, 160));
  578. }
  579. }
  580.  
  581. void CEsp::DrawDrop(IClientEntity* pEntity, ClientClass* cClass)
  582. {
  583. Vector Box;
  584. IClientEntity* Weapon = (IClientEntity*)pEntity;
  585. IClientEntity* plr = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)Weapon->GetOwnerHandle());
  586. if (!plr && Render::WorldToScreen(Weapon->GetOrigin(), Box))
  587. {
  588. if (Menu::Window.VisualsTab.FiltersWeapons.GetState())
  589. {
  590. Render::Outline(Box.x - 6, Box.y - 6, 12, 12, Color(255, 255, 255, 255));
  591. }
  592. if (Menu::Window.VisualsTab.FiltersWeapons.GetState())
  593. {
  594. RECT TextSize = Render::GetTextSize(Render::Fonts::Icon, Weapon->GetGunIcon());
  595. Render::Text(Box.x - (TextSize.right / 1), Box.y - 16, Color(255, 255, 255, 255), Render::Fonts::Icon, Weapon->GetGunIcon());
  596. }
  597. }
  598. }
  599.  
  600. void CEsp::DrawChicken(IClientEntity* pEntity, ClientClass* cClass)
  601. {
  602. ESPBox Box;
  603.  
  604. if (GetBox(pEntity, Box))
  605. {
  606. player_info_t pinfo; strcpy_s(pinfo.name, "Chicken");
  607. if (Menu::Window.VisualsTab.FiltersChickens.GetState())
  608. DrawBox(Box, Color(255,255,255,255));
  609.  
  610. if (Menu::Window.VisualsTab.FiltersChickens.GetState())
  611. DrawName(pinfo, Box);
  612. }
  613. }
  614.  
  615. void CEsp::DrawBombPlanted(IClientEntity* pEntity, ClientClass* cClass)
  616. {
  617. BombCarrier = nullptr;
  618.  
  619. Vector vOrig; Vector vScreen;
  620. vOrig = pEntity->GetOrigin();
  621. CCSBomb* Bomb = (CCSBomb*)pEntity;
  622.  
  623. if (Render::WorldToScreen(vOrig, vScreen))
  624. {
  625. float flBlow = Bomb->GetC4BlowTime();
  626. float TimeRemaining = flBlow - (Interfaces::Globals->interval_per_tick * hackManager.pLocal()->GetTickBase());
  627. char buffer[64];
  628. sprintf_s(buffer, "explodes in %.1f", TimeRemaining);
  629. Render::Text(vScreen.x, vScreen.y, Color(255, 255, 255, 255), Render::Fonts::ESP, buffer);
  630. }
  631. }
  632.  
  633. void CEsp::DrawBomb(IClientEntity* pEntity, ClientClass* cClass)
  634. {
  635. BombCarrier = nullptr;
  636. CBaseCombatWeapon *BombWeapon = (CBaseCombatWeapon *)pEntity;
  637. Vector vOrig; Vector vScreen;
  638. vOrig = pEntity->GetOrigin();
  639. bool adopted = true;
  640. HANDLE parent = BombWeapon->GetOwnerHandle();
  641. if (parent || (vOrig.x == 0 && vOrig.y == 0 && vOrig.z == 0))
  642. {
  643. IClientEntity* pParentEnt = (Interfaces::EntList->GetClientEntityFromHandle(parent));
  644. if (pParentEnt && pParentEnt->IsAlive())
  645. {
  646. BombCarrier = pParentEnt;
  647. adopted = false;
  648. }
  649. }
  650.  
  651. if (adopted)
  652. {
  653. if (Render::WorldToScreen(vOrig, vScreen))
  654. {
  655. Render::Text(vScreen.x, vScreen.y, Color(112, 230, 20, 255), Render::Fonts::ESP, "Bomb");
  656. }
  657. }
  658. }
  659.  
  660. void CEsp::DrawGranades()
  661. {
  662. auto granade = Interfaces::CVar->FindVar("sv_grenade_trajectory");
  663. auto granadespoof = new SpoofedConvar(granade);
  664. granadespoof->SetInt(1);
  665. }
  666.  
  667. void DrawBoneArray(int* boneNumbers, int amount, IClientEntity* pEntity, Color color)
  668. {
  669. Vector LastBoneScreen;
  670. for (int i = 0; i < amount; i++)
  671. {
  672. Vector Bone = pEntity->GetBonePos(boneNumbers[i]);
  673. Vector BoneScreen;
  674.  
  675. if (Render::WorldToScreen(Bone, BoneScreen))
  676. {
  677. if (i>0)
  678. {
  679. Render::Line(LastBoneScreen.x, LastBoneScreen.y, BoneScreen.x, BoneScreen.y, color);
  680. }
  681. }
  682. LastBoneScreen = BoneScreen;
  683. }
  684. }
  685.  
  686. void DrawBoneTest(IClientEntity *pEntity)
  687. {
  688. for (int i = 0; i < 127; i++)
  689. {
  690. Vector BoneLoc = pEntity->GetBonePos(i);
  691. Vector BoneScreen;
  692. if (Render::WorldToScreen(BoneLoc, BoneScreen))
  693. {
  694. char buf[10];
  695. _itoa_s(i, buf, 10);
  696. Render::Text(BoneScreen.x, BoneScreen.y, Color(255, 255, 255, 180), Render::Fonts::ESP, buf);
  697. }
  698. }
  699. }
  700.  
  701. void CEsp::DrawSkeleton(IClientEntity* pEntity)
  702. {
  703. studiohdr_t* pStudioHdr = Interfaces::ModelInfo->GetStudiomodel(pEntity->GetModel());
  704.  
  705. if (!pStudioHdr)
  706. return;
  707.  
  708. Vector vParent, vChild, sParent, sChild;
  709.  
  710. for (int j = 0; j < pStudioHdr->numbones; j++)
  711. {
  712. mstudiobone_t* pBone = pStudioHdr->GetBone(j);
  713.  
  714. if (pBone && (pBone->flags & BONE_USED_BY_HITBOX) && (pBone->parent != -1))
  715. {
  716. vChild = pEntity->GetBonePos(j);
  717. vParent = pEntity->GetBonePos(pBone->parent);
  718.  
  719. if (Render::WorldToScreen(vParent, sParent) && Render::WorldToScreen(vChild, sChild))
  720. {
  721. Render::Line(sParent[0], sParent[1], sChild[0], sChild[1], Color(255,255,255,255));
  722. }
  723. }
  724. }
  725. }
  726.  
  727. void CEsp::IsPlayerDefusing(player_info_t pinfo, CEsp::ESPBox size, IClientEntity* pEntity)
  728. {
  729. RECT defSize = Render::GetTextSize(Render::Fonts::ESP, "");
  730. if (pEntity->IsDefusing())
  731. {
  732. Render::Text(size.x + size.w + 3, size.y + (0.3*(defSize.bottom + 15)),
  733. Color(255, 0, 0, 255), Render::Fonts::ESP, charenc("Defusing"));
  734. }
  735. }
  736.  
  737. void CEsp::DrawMoney(IClientEntity* pEntity, CEsp::ESPBox size)
  738. {
  739. ESPBox ArmorBar = size;
  740.  
  741. int MoneyEnemy = 100;
  742. MoneyEnemy = pEntity->GetMoney();
  743. char nameBuffer[512];
  744. sprintf_s(nameBuffer, "%d $", MoneyEnemy);
  745.  
  746. RECT nameSize = Render::GetTextSize(Render::Fonts::ESP, nameBuffer);
  747. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y - 27, Color(255, 255, 0, 255), Render::Fonts::ESP, nameBuffer);
  748. }
  749.  
  750. void CEsp::Armor(IClientEntity* pEntity, CEsp::ESPBox size)
  751. {
  752. ESPBox ArBar = size;
  753. ArBar.y += (ArBar.h + 3);
  754. ArBar.h = 6;
  755.  
  756. float ArValue = pEntity->ArmorValue();
  757. float ArPerc = ArValue / 100.f;
  758. float Width = (size.w * ArPerc);
  759. ArBar.w = Width;
  760.  
  761. Vertex_t Verts[4];
  762. Verts[0].Init(Vector2D(ArBar.x, ArBar.y));
  763. Verts[1].Init(Vector2D(ArBar.x + size.w + 0, ArBar.y));
  764. Verts[2].Init(Vector2D(ArBar.x + size.w, ArBar.y + 2));
  765. Verts[3].Init(Vector2D(ArBar.x - 0, ArBar.y + 2));
  766.  
  767. Render::PolygonOutline(4, Verts, Color(50, 50, 50, 255), Color(50, 50, 50, 255));
  768.  
  769. Vertex_t Verts2[4];
  770. Verts2[0].Init(Vector2D(ArBar.x, ArBar.y + 1));
  771. Verts2[1].Init(Vector2D(ArBar.x + ArBar.w + 0, ArBar.y + 1));
  772. Verts2[2].Init(Vector2D(ArBar.x + ArBar.w, ArBar.y + 2));
  773. Verts2[3].Init(Vector2D(ArBar.x, ArBar.y + 2));
  774.  
  775. Color c = GetPlayerColor(pEntity);
  776. Render::Polygon(4, Verts2, Color(0, 120, 255, 200));
  777. }
  778.  
  779.  
  780. void CEsp::DrawMolotov(IClientEntity* pEntity, ClientClass* cClass)
  781. {
  782. ESPBox Box;
  783.  
  784. if (GetBox(pEntity, Box))
  785. {
  786. player_info_t pinfo; strcpy_s(pinfo.name, "Fire");
  787.  
  788. if (Menu::Window.VisualsTab.FiltersNades.GetState())
  789. DrawName(pinfo, Box);
  790. }
  791. }
  792.  
  793. void CEsp::DrawSmoke(IClientEntity* pEntity, ClientClass* cClass)
  794. {
  795. ESPBox Box;
  796.  
  797. if (GetBox(pEntity, Box))
  798. {
  799. player_info_t pinfo; strcpy_s(pinfo.name, "Smoke");
  800.  
  801. if (Menu::Window.VisualsTab.FiltersNades.GetState() == 1)
  802. DrawName(pinfo, Box);
  803. }
  804. }
  805.  
  806. void CEsp::DrawDecoy(IClientEntity* pEntity, ClientClass* cClass)
  807. {
  808. ESPBox Box;
  809.  
  810. if (GetBox(pEntity, Box))
  811. {
  812. player_info_t pinfo; strcpy_s(pinfo.name, "Decoy");
  813.  
  814. if (Menu::Window.VisualsTab.FiltersNades.GetState())
  815. DrawName(pinfo, Box);
  816. }
  817. }
  818.  
  819. void CEsp::DrawHE(IClientEntity* pEntity, ClientClass* cClass)
  820. {
  821. ESPBox Box;
  822.  
  823. if (GetBox(pEntity, Box))
  824. {
  825. player_info_t pinfo; strcpy_s(pinfo.name, "HE or Flash");
  826.  
  827. if (Menu::Window.VisualsTab.FiltersNades.GetState())
  828. DrawName(pinfo, Box);
  829. }
  830. }
  831.  
  832. void CEsp::Info(IClientEntity* pEntity, CEsp::ESPBox size)
  833. {
  834. std::vector<std::string> Info;
  835.  
  836. if (Menu::Window.VisualsTab.HasDefuser.GetState() && pEntity->HasDefuser())
  837. {
  838. Info.push_back("Has Defuser");
  839. }
  840.  
  841. if (Menu::Window.VisualsTab.IsScoped.GetState() && pEntity->IsScoped())
  842. {
  843. Info.push_back("Scoped");
  844. }
  845.  
  846. static RECT Size = Render::GetTextSize(Render::Fonts::ESP, "Hi");
  847. int i = 0;
  848. for (auto Text : Info)
  849. {
  850. Render::Text(size.x + size.w + 3, size.y + (i*(Size.bottom + 2)), Color(255, 255, 255, 255), Render::Fonts::ESP, Text.c_str());
  851. i++;
  852. }
  853. }
  854.  
  855. void CEsp::GrenadeTrace()
  856. {
  857. auto granade = Interfaces::CVar->FindVar("sv_grenade_trajectory");
  858. auto granadespoof = new SpoofedConvar(granade);
  859. granadespoof->SetInt(1);
  860. }
  861.  
  862. void CEsp::DrawDistance(CEsp::ESPBox size, IClientEntity* pEntity)
  863. {
  864. IClientEntity *pLocal = hackManager.pLocal();
  865.  
  866. Vector vecOrigin = pEntity->GetOrigin();
  867. Vector vecOriginLocal = pLocal->GetOrigin();
  868. static RECT defSize = Render::GetTextSize(Render::Fonts::Default, "");
  869.  
  870. char dist_to[32];
  871. sprintf_s(dist_to, "%.0f ft", DistanceTo(vecOriginLocal, vecOrigin));
  872.  
  873. Render::Text(size.x + size.w + 3, size.y + (0.6*(defSize.bottom + 28)), Color(255, 255, 255, 255), Render::Fonts::ESP, dist_to);
  874. }
  875.  
  876. float CEsp::DistanceTo(Vector vecSrc, Vector vecDst)
  877. {
  878. Vector vDelta = vecDst - vecSrc;
  879.  
  880. float fDistance = ::sqrtf((vDelta.Length()));
  881.  
  882. if (fDistance < 1.0f)
  883. return 1.0f;
  884.  
  885. return fDistance;
  886. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement