Advertisement
Guest User

Untitled

a guest
Jul 15th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.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. // Corner Box
  323. int VertLine = (((float)size.w) * (0.20f));
  324. int HorzLine = (((float)size.h) * (0.20f));
  325.  
  326. Render::Clear(size.x, size.y - 1, VertLine, 1, Color(10, 10, 10, 150));
  327. Render::Clear(size.x + size.w - VertLine, size.y - 1, VertLine, 1, Color(10, 10, 10, 150));
  328. Render::Clear(size.x, size.y + size.h - 1, VertLine, 1, Color(10, 10, 10, 150));
  329. Render::Clear(size.x + size.w - VertLine, size.y + size.h - 1, VertLine, 1, Color(10, 10, 10, 150));
  330.  
  331. Render::Clear(size.x - 1, size.y, 1, HorzLine, Color(10, 10, 10, 150));
  332. Render::Clear(size.x - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(10, 10, 10, 150));
  333. Render::Clear(size.x + size.w - 1, size.y, 1, HorzLine, Color(10, 10, 10, 150));
  334. Render::Clear(size.x + size.w - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(10, 10, 10, 150));
  335.  
  336. Render::Clear(size.x, size.y, VertLine, 1, color);
  337. Render::Clear(size.x + size.w - VertLine, size.y, VertLine, 1, color);
  338. Render::Clear(size.x, size.y + size.h, VertLine, 1, color);
  339. Render::Clear(size.x + size.w - VertLine, size.y + size.h, VertLine, 1, color);
  340.  
  341. Render::Clear(size.x, size.y, 1, HorzLine, color);
  342. Render::Clear(size.x, size.y + size.h - HorzLine, 1, HorzLine, color);
  343. Render::Clear(size.x + size.w, size.y, 1, HorzLine, color);
  344. Render::Clear(size.x + size.w, size.y + size.h - HorzLine, 1, HorzLine, color);
  345. }
  346. }
  347.  
  348.  
  349. // Unicode Conversions
  350. static wchar_t* CharToWideChar(const char* text)
  351. {
  352. size_t size = strlen(text) + 1;
  353. wchar_t* wa = new wchar_t[size];
  354. mbstowcs_s(NULL, wa, size/4, text, size);
  355. return wa;
  356. }
  357.  
  358. // Player name
  359. void CEsp::DrawName(player_info_t pinfo, CEsp::ESPBox size)
  360. {
  361. RECT nameSize = Render::GetTextSize(Render::Fonts::ESP, pinfo.name);
  362. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y - 16,
  363. Color(255, 255, 255, 255), Render::Fonts::ESP, "B-Baka Onii-chan!!!");
  364.  
  365. // Replace "your text" with pinfo.name without quotes to show the actual weapon name
  366. }
  367.  
  368. // Draw a health bar. For Tf2 when a bar is bigger than max health a second bar is displayed
  369. void CEsp::DrawHealth(IClientEntity* pEntity, CEsp::ESPBox size)
  370. {
  371. ESPBox HealthBar = size;
  372. HealthBar.y += (HealthBar.h + 6);
  373. HealthBar.h = 4;
  374.  
  375. float HealthValue = pEntity->GetHealth();
  376. float HealthPerc = HealthValue / 100.f;
  377. float Width = (size.w * HealthPerc);
  378. HealthBar.w = Width;
  379.  
  380. // -- Main Bar -- //
  381.  
  382. Vertex_t Verts[4];
  383. Verts[0].Init(Vector2D(HealthBar.x, HealthBar.y));
  384. Verts[1].Init(Vector2D(HealthBar.x + size.w + 5, HealthBar.y));
  385. Verts[2].Init(Vector2D(HealthBar.x + size.w, HealthBar.y + 5));
  386. Verts[3].Init(Vector2D(HealthBar.x - 5, HealthBar.y + 5));
  387.  
  388. Render::PolygonOutline(4, Verts, Color(10, 10, 10, 255), Color(255, 255, 255, 170));
  389.  
  390. Vertex_t Verts2[4];
  391. Verts2[0].Init(Vector2D(HealthBar.x + 1, HealthBar.y + 1));
  392. Verts2[1].Init(Vector2D(HealthBar.x + HealthBar.w + 4, HealthBar.y + 1));
  393. Verts2[2].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 5));
  394. Verts2[3].Init(Vector2D(HealthBar.x - 4, HealthBar.y + 5));
  395.  
  396. Color c = GetPlayerColor(pEntity);
  397. Render::Polygon(4, Verts2, c);
  398.  
  399. Verts2[0].Init(Vector2D(HealthBar.x + 1, HealthBar.y + 1));
  400. Verts2[1].Init(Vector2D(HealthBar.x + HealthBar.w + 2, HealthBar.y + 1));
  401. Verts2[2].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 2));
  402. Verts2[3].Init(Vector2D(HealthBar.x - 2, HealthBar.y + 2));
  403.  
  404. Render::Polygon(4, Verts2, Color(255, 255, 255, 40));
  405.  
  406. }
  407.  
  408. // Cleans the internal class name up to something human readable and nice
  409. std::string CleanItemName(std::string name)
  410. {
  411. std::string Name = name;
  412. // Tidy up the weapon Name
  413. if (Name[0] == 'C')
  414. Name.erase(Name.begin());
  415.  
  416. // Remove the word Weapon
  417. auto startOfWeap = Name.find("Weapon");
  418. if (startOfWeap != std::string::npos)
  419. Name.erase(Name.begin() + startOfWeap, Name.begin() + startOfWeap + 6);
  420.  
  421. return Name;
  422. }
  423.  
  424. // Anything else: weapons, class state? idk
  425. void CEsp::DrawInfo(IClientEntity* pEntity, CEsp::ESPBox size)
  426. {
  427. std::vector<std::string> Info;
  428.  
  429. // Player Weapon ESP
  430. IClientEntity* pWeapon = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)pEntity->GetActiveWeaponHandle());
  431. if (Menu::Window.VisualsTab.OptionsWeapon.GetState() && pWeapon)
  432. {
  433. ClientClass* cClass = (ClientClass*)pWeapon->GetClientClass();
  434. if (cClass)
  435. {
  436. // Draw it
  437. Info.push_back("B-Baka Onii-chan!!!");
  438. // Replace Info.push_back("weapon text"); with Info.push_back(CleanItemName(cClass->m_pNetworkName)); to show the actual player name //
  439. }
  440. }
  441.  
  442. // Bomb Carrier
  443. if (Menu::Window.VisualsTab.OptionsInfo.GetState() && pEntity == BombCarrier)
  444. {
  445. Info.push_back("Bomb Carrier");
  446. }
  447.  
  448. static RECT Size = Render::GetTextSize(Render::Fonts::Default, "Hi");
  449. int i = 0;
  450. for (auto Text : Info)
  451. {
  452. Render::Text(size.x + size.w + 3, size.y + (i*(Size.bottom + 2)), Color(255, 0, 0, 255), Render::Fonts::ESP, Text.c_str());
  453. i++;
  454. }
  455. }
  456.  
  457. // Little cross on their heads
  458. void CEsp::DrawCross(IClientEntity* pEntity)
  459. {
  460. Vector cross = pEntity->GetHeadPos(), screen;
  461. static int Scale = 2;
  462. if (Render::WorldToScreen(cross, screen))
  463. {
  464. Render::Clear(screen.x - Scale, screen.y - (Scale * 2), (Scale * 2), (Scale * 4), Color(20, 20, 20, 160));
  465. Render::Clear(screen.x - (Scale * 2), screen.y - Scale, (Scale * 4), (Scale * 2), Color(20, 20, 20, 160));
  466. Render::Clear(screen.x - Scale - 1, screen.y - (Scale * 2) - 1, (Scale * 2) - 2, (Scale * 4) - 2, Color(250, 250, 250, 160));
  467. Render::Clear(screen.x - (Scale * 2) - 1, screen.y - Scale - 1, (Scale * 4) - 2, (Scale * 2) - 2, Color(250, 250, 250, 160));
  468. }
  469. }
  470.  
  471. // Draws a dropped CS:GO Item
  472. void CEsp::DrawDrop(IClientEntity* pEntity, ClientClass* cClass)
  473. {
  474. Vector Box;
  475. CBaseCombatWeapon* Weapon = (CBaseCombatWeapon*)pEntity;
  476. IClientEntity* plr = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)Weapon->GetOwnerHandle());
  477. if (!plr && Render::WorldToScreen(Weapon->GetOrigin(), Box))
  478. {
  479. if (Menu::Window.VisualsTab.OptionsBox.GetState())
  480. {
  481. Render::Outline(Box.x - 2, Box.y - 2, 4, 4, Color(255, 255, 255, 255));
  482. Render::Outline(Box.x - 3, Box.y - 3, 6, 6, Color(10, 10, 10, 150));
  483. }
  484.  
  485. if (Menu::Window.VisualsTab.OptionsInfo.GetState())
  486. {
  487. std::string ItemName = CleanItemName(cClass->m_pNetworkName);
  488. RECT TextSize = Render::GetTextSize(Render::Fonts::ESP, ItemName.c_str());
  489. Render::Text(Box.x - (TextSize.right / 2), Box.y - 16, Color(255, 255, 255, 255), Render::Fonts::ESP, ItemName.c_str());
  490. }
  491. }
  492. }
  493.  
  494. // Draws a chicken
  495. void CEsp::DrawChicken(IClientEntity* pEntity, ClientClass* cClass)
  496. {
  497. ESPBox Box;
  498.  
  499. if (GetBox(pEntity, Box))
  500. {
  501. player_info_t pinfo; strcpy_s(pinfo.name, "Chicken");
  502. if (Menu::Window.VisualsTab.OptionsBox.GetState())
  503. DrawBox(Box, Color(255,255,255,255));
  504.  
  505. if (Menu::Window.VisualsTab.OptionsName.GetState())
  506. DrawName(pinfo, Box);
  507. }
  508. }
  509.  
  510. // Draw the planted bomb and timer
  511. void CEsp::DrawBombPlanted(IClientEntity* pEntity, ClientClass* cClass)
  512. {
  513. // Null it out incase bomb has been dropped or planted
  514. BombCarrier = nullptr;
  515.  
  516. Vector vOrig; Vector vScreen;
  517. vOrig = pEntity->GetOrigin();
  518. CCSBomb* Bomb = (CCSBomb*)pEntity;
  519.  
  520. if (Render::WorldToScreen(vOrig, vScreen))
  521. {
  522. float flBlow = Bomb->GetC4BlowTime();
  523. float TimeRemaining = flBlow - (Interfaces::Globals->interval_per_tick * hackManager.pLocal()->GetTickBase());
  524. char buffer[64];
  525. sprintf_s(buffer, "Bomb: %.1f", TimeRemaining);
  526. Render::Text(vScreen.x, vScreen.y, Color(250, 42, 42, 255), Render::Fonts::ESP, buffer);
  527. }
  528. }
  529.  
  530. // Draw the bomb if it's dropped, or store the player who's carrying
  531. void CEsp::DrawBomb(IClientEntity* pEntity, ClientClass* cClass)
  532. {
  533. // Null it out incase bomb has been dropped or planted
  534. BombCarrier = nullptr;
  535. CBaseCombatWeapon *BombWeapon = (CBaseCombatWeapon *)pEntity;
  536. Vector vOrig; Vector vScreen;
  537. vOrig = pEntity->GetOrigin();
  538. bool adopted = true;
  539. HANDLE parent = BombWeapon->GetOwnerHandle();
  540. if (parent || (vOrig.x == 0 && vOrig.y == 0 && vOrig.z == 0))
  541. {
  542. IClientEntity* pParentEnt = (Interfaces::EntList->GetClientEntityFromHandle(parent));
  543. if (pParentEnt && pParentEnt->IsAlive())
  544. {
  545. BombCarrier = pParentEnt;
  546. adopted = false;
  547. }
  548. }
  549.  
  550. if (adopted)
  551. {
  552. if (Render::WorldToScreen(vOrig, vScreen))
  553. {
  554. Render::Text(vScreen.x, vScreen.y, Color(112, 230, 20, 255), Render::Fonts::ESP, "Bomb");
  555. }
  556. }
  557. }
  558.  
  559. void DrawBoneArray(int* boneNumbers, int amount, IClientEntity* pEntity, Color color)
  560. {
  561. Vector LastBoneScreen;
  562. for (int i = 0; i < amount; i++)
  563. {
  564. Vector Bone = pEntity->GetBonePos(boneNumbers[i]);
  565. Vector BoneScreen;
  566.  
  567. if (Render::WorldToScreen(Bone, BoneScreen))
  568. {
  569. if (i>0)
  570. {
  571. Render::Line(LastBoneScreen.x, LastBoneScreen.y, BoneScreen.x, BoneScreen.y, color);
  572. }
  573. }
  574. LastBoneScreen = BoneScreen;
  575. }
  576. }
  577.  
  578. void DrawBoneTest(IClientEntity *pEntity)
  579. {
  580. for (int i = 0; i < 127; i++)
  581. {
  582. Vector BoneLoc = pEntity->GetBonePos(i);
  583. Vector BoneScreen;
  584. if (Render::WorldToScreen(BoneLoc, BoneScreen))
  585. {
  586. char buf[10];
  587. _itoa_s(i, buf, 10);
  588. Render::Text(BoneScreen.x, BoneScreen.y, Color(255, 255, 255, 180), Render::Fonts::ESP, buf);
  589. }
  590. }
  591. }
  592.  
  593. void CEsp::DrawSkeleton(IClientEntity* pEntity)
  594. {
  595. studiohdr_t* pStudioHdr = Interfaces::ModelInfo->GetStudiomodel(pEntity->GetModel());
  596.  
  597. if (!pStudioHdr)
  598. return;
  599.  
  600. Vector vParent, vChild, sParent, sChild;
  601.  
  602. for (int j = 0; j < pStudioHdr->numbones; j++)
  603. {
  604. mstudiobone_t* pBone = pStudioHdr->GetBone(j);
  605.  
  606. if (pBone && (pBone->flags & BONE_USED_BY_HITBOX) && (pBone->parent != -1))
  607. {
  608. vChild = pEntity->GetBonePos(j);
  609. vParent = pEntity->GetBonePos(pBone->parent);
  610.  
  611. if (Render::WorldToScreen(vParent, sParent) && Render::WorldToScreen(vChild, sChild))
  612. {
  613. Render::Line(sParent[0], sParent[1], sChild[0], sChild[1], Color(255,255,255,255));
  614. }
  615. }
  616. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement