Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.40 KB | None | 0 0
  1. /*
  2. Syn's AyyWare Framework 2015
  3. */
  4.  
  5. #include "ESP.h"
  6. #include "Interfaces.h"
  7. #include "RenderManager.h"
  8.  
  9. void CEsp::Init()
  10. {
  11. BombCarrier = nullptr;
  12. }
  13.  
  14. // Yeah dude we're defo gunna do some sick moves for the esp yeah
  15. void CEsp::Move(CUserCmd *pCmd,bool &bSendPacket)
  16. {
  17.  
  18. }
  19.  
  20. // Main ESP Drawing loop
  21. void CEsp::Draw()
  22. {
  23. IClientEntity *pLocal = hackManager.pLocal();
  24.  
  25. if (Menu::Window.MiscTab.OtherSpectators.GetState())
  26. {
  27. SpecList();
  28. }
  29.  
  30. // Loop through all active entitys
  31. for (int i = 0; i < Interfaces::EntList->GetHighestEntityIndex(); i++)
  32. {
  33. // Get the entity
  34. IClientEntity *pEntity = Interfaces::EntList->GetClientEntity(i);
  35. player_info_t pinfo;
  36.  
  37. // The entity isn't some laggy peice of shit or something
  38. if (pEntity && pEntity != pLocal && !pEntity->IsDormant())
  39. {
  40. // Radar
  41. if (Menu::Window.VisualsTab.OtherRadar.GetState())
  42. {
  43. DWORD m_bSpotted = NetVar.GetNetVar(0x839EB159);
  44. *(char*)((DWORD)(pEntity) + m_bSpotted) = 1;
  45. }
  46.  
  47. // Is it a player?!
  48. if (Menu::Window.VisualsTab.FiltersPlayers.GetState() && Interfaces::Engine->GetPlayerInfo(i, &pinfo) && pEntity->IsAlive())
  49. {
  50. DrawPlayer(pEntity, pinfo);
  51. }
  52.  
  53. // ~ Other ESP's here (items and shit) ~ //
  54. ClientClass* cClass = (ClientClass*)pEntity->GetClientClass();
  55.  
  56. // Dropped weapons
  57. 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)))
  58. {
  59. DrawDrop(pEntity, cClass);
  60. }
  61.  
  62. // If entity is the bomb
  63. if (Menu::Window.VisualsTab.FiltersC4.GetState())
  64. {
  65. if (cClass->m_ClassID == (int)CSGOClassID::CPlantedC4)
  66. DrawBombPlanted(pEntity, cClass);
  67.  
  68. if (cClass->m_ClassID == (int)CSGOClassID::CC4)
  69. DrawBomb(pEntity, cClass);
  70. }
  71.  
  72. // If entity is a chicken
  73. if (Menu::Window.VisualsTab.FiltersChickens.GetState())
  74. {
  75. if (cClass->m_ClassID == (int)CSGOClassID::CChicken)
  76. DrawChicken(pEntity, cClass);
  77. }
  78. }
  79. }
  80.  
  81. // Anti Flash
  82. if (Menu::Window.VisualsTab.OtherNoFlash.GetState())
  83. {
  84. DWORD m_flFlashMaxAlpha = NetVar.GetNetVar(0xFE79FB98);
  85. *(float*)((DWORD)pLocal + m_flFlashMaxAlpha) = 0;
  86. }
  87. }
  88.  
  89. void CEsp::SpecList()
  90. {
  91. IClientEntity *pLocal = hackManager.pLocal();
  92.  
  93. RECT scrn = Render::GetViewport();
  94. int ayy = 0;
  95.  
  96. // Loop through all active entitys
  97. for (int i = 0; i < Interfaces::EntList->GetHighestEntityIndex(); i++)
  98. {
  99. // Get the entity
  100. IClientEntity *pEntity = Interfaces::EntList->GetClientEntity(i);
  101. player_info_t pinfo;
  102.  
  103. // The entity isn't some laggy peice of shit or something
  104. if (pEntity && pEntity != pLocal)
  105. {
  106. if (Interfaces::Engine->GetPlayerInfo(i, &pinfo) && !pEntity->IsAlive() && !pEntity->IsDormant())
  107. {
  108. HANDLE obs = pEntity->GetObserverTargetHandle();
  109.  
  110. if (obs)
  111. {
  112. IClientEntity *pTarget = Interfaces::EntList->GetClientEntityFromHandle(obs);
  113. player_info_t pinfo2;
  114. if (pTarget)
  115. {
  116. if (Interfaces::Engine->GetPlayerInfo(pTarget->GetIndex(), &pinfo2))
  117. {
  118. char buf[255]; sprintf_s(buf, "%s => %s", pinfo.name, pinfo2.name);
  119. RECT TextSize = Render::GetTextSize(Render::Fonts::ESP, buf);
  120. Render::Clear(scrn.right - 260, (scrn.bottom / 2) + (16 * ayy), 260, 16, Color(0, 0, 0, 140));
  121. Render::Text(scrn.right - TextSize.right - 4, (scrn.bottom / 2) + (16 * ayy), pTarget->GetIndex() == pLocal->GetIndex() ? Color(240, 70, 80, 255) : Color(255, 255, 255, 255), Render::Fonts::ESP, buf);
  122. ayy++;
  123. }
  124. }
  125. }
  126. }
  127. }
  128. }
  129.  
  130. Render::Outline(scrn.right - 261, (scrn.bottom / 2) - 1, 262, (16 * ayy) + 2, Color(23, 23, 23, 255));
  131. Render::Outline(scrn.right - 260, (scrn.bottom / 2), 260, (16 * ayy), Color(90, 90, 90, 255));
  132. }
  133.  
  134. // Yeah m8
  135. void CEsp::DrawPlayer(IClientEntity* pEntity, player_info_t pinfo)
  136. {
  137. ESPBox Box;
  138. Color Color;
  139.  
  140. // Show own team false? well gtfo teammate lol
  141. if (Menu::Window.VisualsTab.FiltersEnemiesOnly.GetState() && (pEntity->GetTeamNum() == hackManager.pLocal()->GetTeamNum()))
  142. return;
  143.  
  144. if (GetBox(pEntity, Box))
  145. {
  146. Color = GetPlayerColor(pEntity);
  147.  
  148. /*if (Menu::Window.VisualsTab.OptionsGlow.GetState())
  149. {
  150. int TeamNum = pEntity->GetTeamNum();
  151.  
  152. if (TeamNum == TEAM_CS_T)
  153. {
  154. DrawGlow(pEntity, 255, 0, 0, 160);
  155. }
  156. else if (TeamNum == TEAM_CS_CT)
  157. {
  158. DrawGlow(pEntity, 0, 0, 255, 160);
  159. }
  160. }*/
  161.  
  162. if (Menu::Window.VisualsTab.OptionsBox.GetState())
  163. DrawBox(Box, Color);
  164.  
  165. if (Menu::Window.VisualsTab.OptionsName.GetState())
  166. DrawName(pinfo, Box);
  167.  
  168. if (Menu::Window.VisualsTab.OptionsHealth.GetState())
  169. DrawHealth(pEntity, Box);
  170.  
  171. if (Menu::Window.VisualsTab.OptionsInfo.GetState() || Menu::Window.VisualsTab.OptionsWeapon.GetState())
  172. DrawInfo(pEntity, Box);
  173.  
  174. if (Menu::Window.VisualsTab.OptionsAimSpot.GetState())
  175. DrawCross(pEntity);
  176.  
  177. if (Menu::Window.VisualsTab.OptionsSkeleton.GetState())
  178. DrawSkeleton(pEntity);
  179. }
  180. }
  181.  
  182. // glow shit
  183. /*struct Glowobject
  184. {
  185. IClientEntity* pEntity;
  186. Vector Color;
  187. float Alpha;
  188. byte PAD[16];
  189. bool RenderWhenOccluded;
  190. bool RenderWhenUnOccluded;
  191. bool FullBloomRender;
  192. byte PAD2[17];
  193. };
  194.  
  195. // simple sexy glow
  196. void CEsp::DrawGlow(IClientEntity *pEntity, int r, int g, int b, int a)
  197. {
  198. static uintptr_t Module = (uintptr_t)GetModuleHandle("client.dll");
  199.  
  200. Glowobject* GlowManager = *(Glowobject**)(Module + 0x4B71C6C);
  201.  
  202. if (GlowManager)
  203. {
  204. Glowobject* GlowObject = &GlowManager[pEntity->GetGlowIndex()];
  205.  
  206. if (GlowObject)
  207. {
  208. GlowObject->RenderWhenOccluded = 1;
  209. GlowObject->RenderWhenUnOccluded = 0;
  210.  
  211. float glowr = (1 / 255.0f)*r;
  212. float glowg = (1 / 255.0f)*g;
  213. float glowb = (1 / 255.0f)*b;
  214. float glowa = (1 / 255.0f)*a;
  215. GlowObject->Color = Vector((1 / 255.0f)*r, (1 / 255.0f)*g, (1 / 255.0f)*b);
  216. GlowObject->Alpha = (1 / 255.0f)*a;
  217. }
  218. }
  219. }*/
  220.  
  221. // Gets the 2D bounding box for the entity
  222. // Returns false on failure nigga don't fail me
  223. bool CEsp::GetBox(IClientEntity* pEntity, CEsp::ESPBox &result)
  224. {
  225. // Variables
  226. Vector vOrigin, min, max, sMin, sMax, sOrigin,
  227. flb, brt, blb, frt, frb, brb, blt, flt;
  228. float left, top, right, bottom;
  229.  
  230. // Get the locations
  231. vOrigin = pEntity->GetOrigin();
  232. min = pEntity->collisionProperty()->GetMins() + vOrigin;
  233. max = pEntity->collisionProperty()->GetMaxs() + vOrigin;
  234.  
  235. // Points of a 3d bounding box
  236. Vector points[] = { Vector(min.x, min.y, min.z),
  237. Vector(min.x, max.y, min.z),
  238. Vector(max.x, max.y, min.z),
  239. Vector(max.x, min.y, min.z),
  240. Vector(max.x, max.y, max.z),
  241. Vector(min.x, max.y, max.z),
  242. Vector(min.x, min.y, max.z),
  243. Vector(max.x, min.y, max.z) };
  244.  
  245. // Get screen positions
  246. if (!Render::WorldToScreen(points[3], flb) || !Render::WorldToScreen(points[5], brt)
  247. || !Render::WorldToScreen(points[0], blb) || !Render::WorldToScreen(points[4], frt)
  248. || !Render::WorldToScreen(points[2], frb) || !Render::WorldToScreen(points[1], brb)
  249. || !Render::WorldToScreen(points[6], blt) || !Render::WorldToScreen(points[7], flt))
  250. return false;
  251.  
  252. // Put them in an array (maybe start them off in one later for speed?)
  253. Vector arr[] = { flb, brt, blb, frt, frb, brb, blt, flt };
  254.  
  255. // Init this shit
  256. left = flb.x;
  257. top = flb.y;
  258. right = flb.x;
  259. bottom = flb.y;
  260.  
  261. // Find the bounding corners for our box
  262. for (int i = 1; i < 8; i++)
  263. {
  264. if (left > arr[i].x)
  265. left = arr[i].x;
  266. if (bottom < arr[i].y)
  267. bottom = arr[i].y;
  268. if (right < arr[i].x)
  269. right = arr[i].x;
  270. if (top > arr[i].y)
  271. top = arr[i].y;
  272. }
  273.  
  274. // Width / height
  275. result.x = left;
  276. result.y = top;
  277. result.w = right - left;
  278. result.h = bottom - top;
  279.  
  280. return true;
  281. }
  282.  
  283. // Get an entities color depending on team and vis ect
  284. Color CEsp::GetPlayerColor(IClientEntity* pEntity)
  285. {
  286. int TeamNum = pEntity->GetTeamNum();
  287. bool IsVis = GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Head);
  288.  
  289. Color color;
  290.  
  291. if (TeamNum == TEAM_CS_T)
  292. {
  293. if (IsVis)
  294. color = Color(235, 200, 0, 255);
  295. else
  296. color = Color(235, 50, 0, 255);
  297. }
  298. else
  299. {
  300. if (IsVis)
  301. color = Color(120, 210, 26, 255);
  302. else
  303. color = Color(15, 110, 220, 255);
  304. }
  305.  
  306.  
  307. return color;
  308. }
  309.  
  310. // 2D Esp box
  311. void CEsp::DrawBox(CEsp::ESPBox size, Color color)
  312. {
  313. //if (PlayerBoxes->GetStringIndex() == 1)
  314. //{
  315. // Full Box
  316. //Render::Clear(size.x, size.y, size.w, size.h, color);
  317. //Render::Clear(size.x - 1, size.y - 1, size.w + 2, size.h + 2, Color(10, 10, 10, 150));
  318. //Render::Clear(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(10, 10, 10, 150));
  319. //}
  320. //else
  321. {
  322.  
  323.  
  324. // Corner Box
  325. int VertLine = (((float)size.w) * (0.20f));
  326. int HorzLine = (((float)size.h) * (0.20f));
  327.  
  328. /*
  329.  
  330. Render::Clear(size.x, size.y - 1, VertLine, 1, Color(10, 10, 10, 150));
  331. Render::Clear(size.x + size.w - VertLine, size.y - 1, VertLine, 1, Color(10, 10, 10, 150));
  332. Render::Clear(size.x, size.y + size.h - 1, VertLine, 1, Color(10, 10, 10, 150));
  333. Render::Clear(size.x + size.w - VertLine, size.y + size.h - 1, VertLine, 1, Color(10, 10, 10, 150));
  334.  
  335. Render::Clear(size.x - 1, size.y, 1, HorzLine, Color(10, 10, 10, 150));
  336. Render::Clear(size.x - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(10, 10, 10, 150));
  337. Render::Clear(size.x + size.w - 1, size.y, 1, HorzLine, Color(10, 10, 10, 150));
  338. Render::Clear(size.x + size.w - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(10, 10, 10, 150));
  339.  
  340. Render::Clear(size.x, size.y, VertLine, 1, color);
  341. Render::Clear(size.x + size.w - VertLine, size.y, VertLine, 1, color);
  342. Render::Clear(size.x, size.y + size.h, VertLine, 1, color);
  343. Render::Clear(size.x + size.w - VertLine, size.y + size.h, VertLine, 1, color);
  344.  
  345. Render::Clear(size.x, size.y, 1, HorzLine, color);
  346. Render::Clear(size.x, size.y + size.h - HorzLine, 1, HorzLine, color);
  347. Render::Clear(size.x + size.w, size.y, 1, HorzLine, color);
  348. Render::Clear(size.x + size.w, size.y + size.h - HorzLine, 1, HorzLine, color);
  349.  
  350. */
  351.  
  352. Render::Outline(size.x - 1, size.y - 1, size.w + 2, size.h + 2, color);
  353. Render::Outline(size.x + 1, size.y + 1, size.w - 2, size.h - 2, color);
  354.  
  355. }
  356. }
  357.  
  358.  
  359. // Unicode Conversions
  360. static wchar_t* CharToWideChar(const char* text)
  361. {
  362. size_t size = strlen(text) + 1;
  363. wchar_t* wa = new wchar_t[size];
  364. mbstowcs_s(NULL, wa, size/4, text, size);
  365. return wa;
  366. }
  367.  
  368. // Player name
  369. void CEsp::DrawName(player_info_t pinfo, CEsp::ESPBox size)
  370. {
  371. RECT nameSize = Render::GetTextSize(Render::Fonts::ESP, pinfo.name);
  372. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y - 16,
  373. Color(255, 255, 255, 255), Render::Fonts::ESP, pinfo.name);
  374. }
  375.  
  376. // Draw a health bar. For Tf2 when a bar is bigger than max health a second bar is displayed
  377. void CEsp::DrawHealth(IClientEntity* pEntity, CEsp::ESPBox size)
  378. {
  379.  
  380. /*
  381. ESPBox HealthBar = size;
  382. HealthBar.y += (HealthBar.h + 6);
  383. HealthBar.h = 4;
  384.  
  385. float HealthValue = pEntity->GetHealth();
  386. float HealthPerc = HealthValue / 100.f;
  387. float Width = (size.w * HealthPerc);
  388. HealthBar.w = Width;
  389.  
  390. // -- Main Bar -- //
  391.  
  392. Vertex_t Verts[4];
  393. Verts[0].Init(Vector2D(HealthBar.x, HealthBar.y));
  394. Verts[1].Init(Vector2D(HealthBar.x + size.w + 5, HealthBar.y));
  395. Verts[2].Init(Vector2D(HealthBar.x + size.w, HealthBar.y + 5));
  396. Verts[3].Init(Vector2D(HealthBar.x - 5, HealthBar.y + 5));
  397.  
  398. Render::PolygonOutline(4, Verts, Color(10, 10, 10, 255), Color(255, 255, 255, 170));
  399.  
  400. Vertex_t Verts2[4];
  401. Verts2[0].Init(Vector2D(HealthBar.x + 1, HealthBar.y + 1));
  402. Verts2[1].Init(Vector2D(HealthBar.x + HealthBar.w + 4, HealthBar.y + 1));
  403. Verts2[2].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 5));
  404. Verts2[3].Init(Vector2D(HealthBar.x - 4, HealthBar.y + 5));
  405.  
  406. Color c = GetPlayerColor(pEntity);
  407. Render::Polygon(4, Verts2, c);
  408.  
  409. Verts2[0].Init(Vector2D(HealthBar.x + 1, HealthBar.y + 1));
  410. Verts2[1].Init(Vector2D(HealthBar.x + HealthBar.w + 2, HealthBar.y + 1));
  411. Verts2[2].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 2));
  412. Verts2[3].Init(Vector2D(HealthBar.x - 2, HealthBar.y + 2));
  413.  
  414. Render::Polygon(4, Verts2, Color(255, 255, 255, 40));
  415. */
  416.  
  417. float HealthValue = pEntity->GetHealth();
  418.  
  419. int color[3] = { 0, 0, 0 };
  420.  
  421. if (HealthValue >= 85) {
  422. color[0] = 83; color[1] = 200; color[2] = 84;
  423. }
  424. else if (HealthValue >= 70) {
  425. color[0] = 107; color[1] = 142; color[2] = 35;
  426. }
  427. else if (HealthValue >= 55) {
  428. color[0] = 173; color[1] = 255; color[2] = 47;
  429. }
  430. else if (HealthValue >= 40) {
  431. color[0] = 255; color[1] = 215; color[2] = 0;
  432. }
  433. else if (HealthValue >= 25) {
  434. color[0] = 255; color[1] = 127; color[2] = 80;
  435. }
  436. else if (HealthValue >= 10) {
  437. color[0] = 205; color[1] = 92; color[2] = 92;
  438. }
  439. else if (HealthValue >= 0) {
  440. color[0] = 178; color[1] = 34; color[2] = 34;
  441. }
  442.  
  443. Render::Outline(size.x - 7, size.y - 1, 4, size.h + 2, Color(21, 21, 21, 255));
  444.  
  445. int health_height = HealthValue * size.h / 100;
  446. int add_space = size.h - health_height;
  447.  
  448. Color hec = Color(color[0], color[1], color[2], 255);
  449.  
  450. Render::Clear(size.x - 6, size.y, 2, size.h, Color(21, 21, 21, 255));
  451. Render::Clear(size.x - 6, size.y + add_space, 2, health_height, hec);
  452.  
  453. }
  454.  
  455. // Cleans the internal class name up to something human readable and nice
  456. std::string CleanItemName(std::string name)
  457. {
  458. std::string Name = name;
  459. // Tidy up the weapon Name
  460. if (Name[0] == 'C')
  461. Name.erase(Name.begin());
  462.  
  463. // Remove the word Weapon
  464. auto startOfWeap = Name.find("Weapon");
  465. if (startOfWeap != std::string::npos)
  466. Name.erase(Name.begin() + startOfWeap, Name.begin() + startOfWeap + 6);
  467.  
  468. return Name;
  469. }
  470.  
  471. // Anything else: weapons, class state? idk
  472. void CEsp::DrawInfo(IClientEntity* pEntity, CEsp::ESPBox size)
  473. {
  474. std::vector<std::string> Info;
  475.  
  476. // Player Weapon ESP
  477. IClientEntity* pWeapon = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)pEntity->GetActiveWeaponHandle());
  478. if (Menu::Window.VisualsTab.OptionsWeapon.GetState() && pWeapon)
  479. {
  480. ClientClass* cClass = (ClientClass*)pWeapon->GetClientClass();
  481. if (cClass)
  482. {
  483. // Draw it
  484. Info.push_back(CleanItemName(cClass->m_pNetworkName));
  485. }
  486. }
  487.  
  488. // Bomb Carrier
  489. if (Menu::Window.VisualsTab.OptionsInfo.GetState() && pEntity == BombCarrier)
  490. {
  491. Info.push_back("Bomb Carrier");
  492. }
  493.  
  494. static RECT Size = Render::GetTextSize(Render::Fonts::Default, "Hi");
  495. int i = 0;
  496. for (auto Text : Info)
  497. {
  498. Render::Text(size.x + size.w + 3, size.y + (i*(Size.bottom + 2)), Color(255, 255, 255, 255), Render::Fonts::ESP, Text.c_str());
  499. i++;
  500. }
  501. }
  502.  
  503. // Little cross on their heads
  504. void CEsp::DrawCross(IClientEntity* pEntity)
  505. {
  506. Vector cross = pEntity->GetHeadPos(), screen;
  507. static int Scale = 2;
  508. if (Render::WorldToScreen(cross, screen))
  509. {
  510. Render::Clear(screen.x - Scale, screen.y - (Scale * 2), (Scale * 2), (Scale * 4), Color(20, 20, 20, 160));
  511. Render::Clear(screen.x - (Scale * 2), screen.y - Scale, (Scale * 4), (Scale * 2), Color(20, 20, 20, 160));
  512. Render::Clear(screen.x - Scale - 1, screen.y - (Scale * 2) - 1, (Scale * 2) - 2, (Scale * 4) - 2, Color(250, 250, 250, 160));
  513. Render::Clear(screen.x - (Scale * 2) - 1, screen.y - Scale - 1, (Scale * 4) - 2, (Scale * 2) - 2, Color(250, 250, 250, 160));
  514. }
  515. }
  516.  
  517. // Draws a dropped CS:GO Item
  518. void CEsp::DrawDrop(IClientEntity* pEntity, ClientClass* cClass)
  519. {
  520. Vector Box;
  521. CBaseCombatWeapon* Weapon = (CBaseCombatWeapon*)pEntity;
  522. IClientEntity* plr = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)Weapon->GetOwnerHandle());
  523. if (!plr && Render::WorldToScreen(Weapon->GetOrigin(), Box))
  524. {
  525. if (Menu::Window.VisualsTab.OptionsBox.GetState())
  526. {
  527. Render::Outline(Box.x - 2, Box.y - 2, 4, 4, Color(255, 255, 255, 255));
  528. Render::Outline(Box.x - 3, Box.y - 3, 6, 6, Color(10, 10, 10, 150));
  529. }
  530.  
  531. if (Menu::Window.VisualsTab.OptionsInfo.GetState())
  532. {
  533. std::string ItemName = CleanItemName(cClass->m_pNetworkName);
  534. RECT TextSize = Render::GetTextSize(Render::Fonts::ESP, ItemName.c_str());
  535. Render::Text(Box.x - (TextSize.right / 2), Box.y - 16, Color(255, 255, 255, 255), Render::Fonts::ESP, ItemName.c_str());
  536. }
  537. }
  538. }
  539.  
  540. // Draws a chicken
  541. void CEsp::DrawChicken(IClientEntity* pEntity, ClientClass* cClass)
  542. {
  543. ESPBox Box;
  544.  
  545. if (GetBox(pEntity, Box))
  546. {
  547. player_info_t pinfo; strcpy_s(pinfo.name, "Chicken");
  548. if (Menu::Window.VisualsTab.OptionsBox.GetState())
  549. DrawBox(Box, Color(255,255,255,255));
  550.  
  551. if (Menu::Window.VisualsTab.OptionsName.GetState())
  552. DrawName(pinfo, Box);
  553. }
  554. }
  555.  
  556. // Draw the planted bomb and timer
  557. void CEsp::DrawBombPlanted(IClientEntity* pEntity, ClientClass* cClass)
  558. {
  559. // Null it out incase bomb has been dropped or planted
  560. BombCarrier = nullptr;
  561.  
  562. Vector vOrig; Vector vScreen;
  563. vOrig = pEntity->GetOrigin();
  564. CCSBomb* Bomb = (CCSBomb*)pEntity;
  565.  
  566. if (Render::WorldToScreen(vOrig, vScreen))
  567. {
  568. float flBlow = Bomb->GetC4BlowTime();
  569. float TimeRemaining = flBlow - (Interfaces::Globals->interval_per_tick * hackManager.pLocal()->GetTickBase());
  570. char buffer[64];
  571. sprintf_s(buffer, "Bomb: %.1f", TimeRemaining);
  572. Render::Text(vScreen.x, vScreen.y, Color(250, 42, 42, 255), Render::Fonts::ESP, buffer);
  573. }
  574. }
  575.  
  576. // Draw the bomb if it's dropped, or store the player who's carrying
  577. void CEsp::DrawBomb(IClientEntity* pEntity, ClientClass* cClass)
  578. {
  579. // Null it out incase bomb has been dropped or planted
  580. BombCarrier = nullptr;
  581. CBaseCombatWeapon *BombWeapon = (CBaseCombatWeapon *)pEntity;
  582. Vector vOrig; Vector vScreen;
  583. vOrig = pEntity->GetOrigin();
  584. bool adopted = true;
  585. HANDLE parent = BombWeapon->GetOwnerHandle();
  586. if (parent || (vOrig.x == 0 && vOrig.y == 0 && vOrig.z == 0))
  587. {
  588. IClientEntity* pParentEnt = (Interfaces::EntList->GetClientEntityFromHandle(parent));
  589. if (pParentEnt && pParentEnt->IsAlive())
  590. {
  591. BombCarrier = pParentEnt;
  592. adopted = false;
  593. }
  594. }
  595.  
  596. if (adopted)
  597. {
  598. if (Render::WorldToScreen(vOrig, vScreen))
  599. {
  600. Render::Text(vScreen.x, vScreen.y, Color(112, 230, 20, 255), Render::Fonts::ESP, "Bomb");
  601. }
  602. }
  603. }
  604.  
  605. void DrawBoneArray(int* boneNumbers, int amount, IClientEntity* pEntity, Color color)
  606. {
  607. Vector LastBoneScreen;
  608. for (int i = 0; i < amount; i++)
  609. {
  610. Vector Bone = pEntity->GetBonePos(boneNumbers[i]);
  611. Vector BoneScreen;
  612.  
  613. if (Render::WorldToScreen(Bone, BoneScreen))
  614. {
  615. if (i>0)
  616. {
  617. Render::Line(LastBoneScreen.x, LastBoneScreen.y, BoneScreen.x, BoneScreen.y, color);
  618. }
  619. }
  620. LastBoneScreen = BoneScreen;
  621. }
  622. }
  623.  
  624. void DrawBoneTest(IClientEntity *pEntity)
  625. {
  626. for (int i = 0; i < 127; i++)
  627. {
  628. Vector BoneLoc = pEntity->GetBonePos(i);
  629. Vector BoneScreen;
  630. if (Render::WorldToScreen(BoneLoc, BoneScreen))
  631. {
  632. char buf[10];
  633. _itoa_s(i, buf, 10);
  634. Render::Text(BoneScreen.x, BoneScreen.y, Color(255, 255, 255, 180), Render::Fonts::ESP, buf);
  635. }
  636. }
  637. }
  638.  
  639. void CEsp::DrawSkeleton(IClientEntity* pEntity)
  640. {
  641. studiohdr_t* pStudioHdr = Interfaces::ModelInfo->GetStudiomodel(pEntity->GetModel());
  642.  
  643. if (!pStudioHdr)
  644. return;
  645.  
  646. Vector vParent, vChild, sParent, sChild;
  647.  
  648. for (int j = 0; j < pStudioHdr->numbones; j++)
  649. {
  650. mstudiobone_t* pBone = pStudioHdr->GetBone(j);
  651.  
  652. if (pBone && (pBone->flags & BONE_USED_BY_HITBOX) && (pBone->parent != -1))
  653. {
  654. vChild = pEntity->GetBonePos(j);
  655. vParent = pEntity->GetBonePos(pBone->parent);
  656.  
  657. if (Render::WorldToScreen(vParent, sParent) && Render::WorldToScreen(vChild, sChild))
  658. {
  659. Render::Line(sParent[0], sParent[1], sChild[0], sChild[1], Color(255,255,255,255));
  660. }
  661. }
  662. }
  663. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement