Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 47.07 KB | None | 0 0
  1. #include "ESP.h"
  2. #include "Interfaces.h"
  3. #include "RenderManager.h"
  4. #include <stdarg.h>
  5. #include <cstdint>
  6. #include <algorithm>
  7. #include <iomanip>
  8. #include <random>
  9. #include <iostream>
  10. #include <iomanip>
  11. #include <random>
  12. #include "RageBot.h"
  13. #include "Autowall.h"
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <array>
  17. #include <stdlib.h>
  18. #include "position_adjust.h"
  19. #include "Hooks.h"
  20. #include "experimental.h"
  21. #ifdef NDEBUG
  22. #define strenc( s ) std::string( cx_make_encrypted_string( s ) )
  23. #define charenc( s ) strenc( s ).c_str()
  24. #define wstrenc( s ) std::wstring( strenc( s ).begin(), strenc( s ).end() )
  25. #define wcharenc( s ) wstrenc( s ).c_str()
  26. #else
  27. #define strenc( s ) ( s )
  28. #define charenc( s ) ( s )
  29. #define wstrenc( s ) ( s )
  30. #define wcharenc( s ) ( s )
  31. #endif
  32. #ifdef NDEBUG
  33. #define XorStr( s ) ( XorCompileTime::XorString< sizeof( s ) - 1, __COUNTER__ >( s, std::make_index_sequence< sizeof( s ) - 1>() ).decrypt() )
  34. #else
  35. #define XorStr( s ) ( s )
  36. #endif
  37. float lineLBY;
  38. float lineLBY2;
  39. float lineRealAngle;
  40. float lineFakeAngle;
  41. float lby2;
  42. float lspeed;
  43. float pitchmeme;
  44. CAimbot rageXbot;
  45.  
  46. #define colorbackground Color(51,51,51,255)
  47. #define coloroutline Color(21,21,21,255)
  48.  
  49. float inaccuracy;
  50. void CEsp::Init()
  51. {
  52. BombCarrier = nullptr;
  53. }
  54. void CEsp::Move(CUserCmd *pCmd, bool &bSendPacket)
  55. {
  56. }
  57. bool screen_transformx(const Vector& point, Vector& screen)
  58. {
  59. const matrix3x4& w2sMatrix = interfaces::engine->WorldToScreenMatrix();
  60. screen.x = w2sMatrix[0][0] * point.x + w2sMatrix[0][1] * point.y + w2sMatrix[0][2] * point.z + w2sMatrix[0][3];
  61. screen.y = w2sMatrix[1][0] * point.x + w2sMatrix[1][1] * point.y + w2sMatrix[1][2] * point.z + w2sMatrix[1][3];
  62. screen.z = 0.0f;
  63. float w = w2sMatrix[3][0] * point.x + w2sMatrix[3][1] * point.y + w2sMatrix[3][2] * point.z + w2sMatrix[3][3];
  64. if (w < 0.001f) {
  65. screen.x *= 100000;
  66. screen.y *= 100000;
  67. return true;
  68. }
  69. float invw = 1.0f / w;
  70. screen.x *= invw;
  71. screen.y *= invw;
  72. return false;
  73. }
  74. bool world_to_screenx(const Vector &origin, Vector &screen)
  75. {
  76. if (!screen_transformx(origin, screen)) {
  77. int iScreenWidth, iScreenHeight;
  78. interfaces::engine->GetScreenSize(iScreenWidth, iScreenHeight);
  79. screen.x = (iScreenWidth / 2.0f) + (screen.x * iScreenWidth) / 2;
  80. screen.y = (iScreenHeight / 2.0f) - (screen.y * iScreenHeight) / 2;
  81. return true;
  82. }
  83. return false;
  84. }
  85. void CEsp::Draw()
  86. {
  87. if (!interfaces::engine->IsConnected() || !interfaces::engine->IsInGame())
  88. return;
  89.  
  90. IClientEntity *pLocal = hackManager.pLocal();
  91.  
  92. for (int i = 0; i < interfaces::ent_list->GetHighestEntityIndex(); i++)
  93. {
  94. IClientEntity *pEntity = interfaces::ent_list->get_client_entity(i);
  95. player_info_t pinfo;
  96. if (pEntity && pEntity != pLocal && !pEntity->IsDormant())
  97. {
  98. if (options::menu.visuals_tab.OtherRadar.GetState())
  99. {
  100. DWORD m_bSpotted = NetVar.GetNetVar(0x839EB159);
  101. *(char*)((DWORD)(pEntity)+m_bSpotted) = 1;
  102. }
  103. if (options::menu.visuals_tab.show_players.GetState() && interfaces::engine->GetPlayerInfo(i, &pinfo) && pEntity->IsAlive())
  104. {
  105. DrawPlayer(pEntity, pinfo);
  106. }
  107. if (options::menu.visuals_tab.SpecList.GetState())
  108. {
  109. SpecList();
  110. }
  111. ClientClass* cClass = (ClientClass*)pEntity->GetClientClass();
  112. if (options::menu.visuals_tab.FiltersNades.GetState() && strstr(cClass->m_pNetworkName, "Projectile"))
  113. {
  114. DrawThrowable(pEntity);
  115. }
  116. if (options::menu.visuals_tab.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)))
  117. {
  118. DrawDrop(pEntity, cClass);
  119. }
  120. if (options::menu.visuals_tab.WeaponIconDrop.GetState() && cClass->m_ClassID != (int)CSGOClassID::CBaseWeaponWorldModel && ((strstr(cClass->m_pNetworkName, "Weapon") || cClass->m_ClassID == (int)CSGOClassID::CDEagle || cClass->m_ClassID == (int)CSGOClassID::CAK47)))
  121. {
  122. DrawDropIcon(pEntity, cClass);
  123. }
  124. if (options::menu.visuals_tab.FiltersC4.GetState())
  125. {
  126. if (cClass->m_ClassID == (int)CSGOClassID::CPlantedC4)
  127. DrawBombus(pEntity);
  128. if (cClass->m_ClassID == (int)CSGOClassID::CC4)
  129. DrawBomb(pEntity, cClass);
  130. }
  131. }
  132. }
  133. if (options::menu.visuals_tab.OtherNoFlash.GetState())
  134. {
  135. float alp = options::menu.visuals_tab.flashAlpha.GetValue() / 255;
  136. DWORD m_flFlashMaxAlpha = NetVar.GetNetVar(0xFE79FB98);
  137. *(float*)((DWORD)pLocal + m_flFlashMaxAlpha) = alp;
  138. }
  139. }
  140. float damage;
  141. char bombdamagestringdead[24];
  142. char bombdamagestringalive[24];
  143. inline float CSGO_Armor(float flDamage, int ArmorValue)
  144. {
  145. float flArmorRatio = 0.5f;
  146. float flArmorBonus = 0.5f;
  147. if (ArmorValue > 0) {
  148. float flNew = flDamage * flArmorRatio;
  149. float flArmor = (flDamage - flNew) * flArmorBonus;
  150. if (flArmor > static_cast<float>(ArmorValue)) {
  151. flArmor = static_cast<float>(ArmorValue) * (1.f / flArmorBonus);
  152. flNew = flDamage - flArmor;
  153. }
  154. flDamage = flNew;
  155. }
  156. return flDamage;
  157. }
  158. void CEsp::DrawBombus(IClientEntity* pEntity) {
  159. BombCarrier = nullptr;
  160. auto entity = pEntity;
  161. Vector vOrig; Vector vScreen;
  162. vOrig = entity->GetOrigin();
  163. CCSBomb* Bomb = (CCSBomb*)entity;
  164. float flBlow = Bomb->GetC4BlowTime();
  165. auto local = hackManager.pLocal();
  166. float lifetime = flBlow - (interfaces::globals->interval_per_tick * local->GetTickBase());
  167. int width = 0;
  168. int height = 0;
  169. interfaces::engine->GetScreenSize(width, height);
  170. if (world_to_screenx(vOrig, vScreen))
  171. {
  172. Render::nonamegey(vScreen.x, vScreen.y, "C4", Render::Fonts::esp, Color(255, 255, 255));
  173. }
  174. if (interfaces::engine->IsConnected() && interfaces::engine->IsInGame())
  175. {
  176. if (lifetime > 0.01f && !Bomb->IsBombDefused())
  177. {
  178. int boomval = (lifetime * 300) / 40;
  179. //Render::gradient_horizontal(0, 0, 12, boomval, Color(options::menu.ColorsTab.bomb_timer.GetValue()), Color(10, 10, 10, 55));
  180. //Render::textT(0, boomval, Render::Fonts::esp, Color(255, 255, 255), "%.1f", lifetime);
  181. Render::textT(5, 5, Render::Fonts::niggerbomb, Color(240, 20, 20, 255), "%.1fs", lifetime);
  182. }
  183. }
  184. if (interfaces::engine->IsConnected() && interfaces::engine->IsInGame())
  185. {
  186. float flDistance = local->GetEyePosition().DistTo(entity->GetEyePosition());
  187. float a = 450.7f;
  188. float b = 75.68f;
  189. float c = 789.2f;
  190. float d = ((flDistance - b) / c);
  191. float flDamage = a * exp(-d * d);
  192. damage = float((std::max)((int)ceilf(CSGO_Armor(flDamage, local->ArmorValue())), 0));
  193. sprintf_s(bombdamagestringdead, sizeof(bombdamagestringdead) - 1, "");
  194. if (lifetime > 0.01f && !Bomb->IsBombDefused() && local->IsAlive())
  195. {
  196. if (damage >= local->GetHealth() && lifetime > 0.01f)
  197. {
  198. Render::textT(5, 30, Render::Fonts::niggerbomb, Color(240, 20, 20, 255), "FATAL");
  199. }
  200. else {
  201. if (lifetime > 0.01f && local->IsAlive()) {
  202. std::string gey;
  203. gey += "-";
  204. gey += std::to_string((int)(damage));
  205. gey += "HP";
  206. Render::textT(5, 30, Render::Fonts::niggerbomb, Color(216, 215, 164, 255), gey.c_str());
  207. }
  208. }
  209. }
  210. }
  211.  
  212. if (interfaces::engine->IsConnected() && interfaces::engine->IsInGame())
  213. {
  214. if (Bomb->GetBombDefuser() > 0)
  215. {
  216. //IClientEntity *pDefuser = Interfaces::EntList->GetClientEntity(Bomb->GetBombDefuser());
  217. float countdown = Bomb->GetC4DefuseCountDown() - (local->GetTickBase() * interfaces::globals->interval_per_tick);
  218. //float maxdefuse = pDefuser->HasDefuser() ? 5.0f : 10.f;
  219. if (countdown > 0.01f)
  220. {
  221. if (lifetime > countdown)
  222. {
  223. Render::textT(5, 55, Render::Fonts::niggerbomb, Color(170, 220, 80, 255), "Defuse: %.1f", countdown);
  224. }
  225. }
  226. }
  227. }
  228. }
  229.  
  230. bool World2Screen(const Vector &origin, Vector &screen)
  231. {
  232. if (!screen_transformx(origin, screen)) {
  233. int iScreenWidth, iScreenHeight;
  234. interfaces::engine->GetScreenSize(iScreenWidth, iScreenHeight);
  235. screen.x = (iScreenWidth / 2.0f) + (screen.x * iScreenWidth) / 2;
  236. screen.y = (iScreenHeight / 2.0f) - (screen.y * iScreenHeight) / 2;
  237. return true;
  238. }
  239. return false;
  240. }
  241. bool isOnScreen(Vector origin, Vector &screen)
  242. {
  243. if (!World2Screen(origin, screen)) return false;
  244. int iScreenWidth, iScreenHeight;
  245. interfaces::engine->GetScreenSize(iScreenWidth, iScreenHeight);
  246. bool xOk = iScreenWidth > screen.x > 0, yOk = iScreenHeight > screen.y > 0;
  247. return xOk && yOk;
  248. }
  249. Vector CalcAngle_vec(Vector src, Vector dst)
  250. {
  251. Vector ret;
  252. VectorAngles(dst - src, ret);
  253. return ret;
  254. }
  255.  
  256. void CEsp::DrawWeapon(IClientEntity* pEntity, Box size)
  257. {
  258. IClientEntity* pWeapon = interfaces::ent_list->GetClientEntityFromHandle((HANDLE)pEntity->GetActiveWeaponHandle());
  259. if (pWeapon)
  260. {
  261. if (options::menu.visuals_tab.OptionsArmor.GetIndex() > 2)
  262. {
  263. RECT nameSize = Render::GetTextSize(Render::Fonts::esp, pWeapon->GetWeaponName());
  264. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y + size.h + 15,
  265. Color(options::menu.visuals_tab.WeaponTextColor.GetValue()), Render::Fonts::esp, pWeapon->GetWeaponName());
  266. }
  267.  
  268. else
  269. {
  270. RECT nameSize = Render::GetTextSize(Render::Fonts::esp, pWeapon->GetWeaponName());
  271. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y + size.h + 7,
  272. Color(options::menu.visuals_tab.WeaponTextColor.GetValue()), Render::Fonts::esp, pWeapon->GetWeaponName());
  273. }
  274. }
  275. }
  276.  
  277. void CEsp::DrawWeaponIcon(IClientEntity* pEntity, Box size)
  278. {
  279. IClientEntity* pWeapon = interfaces::ent_list->GetClientEntityFromHandle((HANDLE)pEntity->GetActiveWeaponHandle());
  280. if (pWeapon)
  281. {
  282. if (options::menu.visuals_tab.OptionsArmor.GetIndex() > 2)
  283. {
  284. RECT nameSize = Render::GetTextSize(Render::Fonts::WeaponIcon, pWeapon->getIcon());
  285. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y + size.h + 25,
  286. Color(options::menu.visuals_tab.WeaponTextColor.GetValue()), Render::Fonts::WeaponIcon, pWeapon->getIcon());
  287. }
  288.  
  289. else
  290. {
  291. RECT nameSize = Render::GetTextSize(Render::Fonts::WeaponIcon, pWeapon->getIcon());
  292. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y + size.h + 17,
  293. Color(options::menu.visuals_tab.WeaponTextColor.GetValue()), Render::Fonts::WeaponIcon, pWeapon->getIcon());
  294. }
  295. }
  296. }
  297.  
  298. void CEsp::DrawAmmo(IClientEntity* pEntity, Box size)
  299. {
  300. C_BaseCombatWeapon* pWeapon = pEntity->GetWeapon2();
  301. IClientEntity* pLocal = (IClientEntity*)interfaces::ent_list->get_client_entity(interfaces::engine->GetLocalPlayer());
  302.  
  303. if (!pEntity || pEntity == nullptr || !pLocal /*|| !pLocal->IsAlive()*/)
  304. return;
  305.  
  306. if (!pWeapon)
  307. return;
  308.  
  309. if (pWeapon->isZeus27() || pWeapon->IsMiscGAY())
  310. return;
  311.  
  312. CSWeaponInfo* weapInfo = pWeapon->GetCSWpnData();
  313.  
  314. if (weapInfo == nullptr)
  315. return;
  316.  
  317. Color arc = Color(options::menu.visuals_tab.AmmoC.GetValue());
  318. int ammoyes = pWeapon->GetAmmoInClip() * (size.w) / weapInfo->max_clip;
  319. Render::outlineyeti(size.x - 1, size.y + size.h + 3, size.w + 2, 4, Color(21, 21, 21, 255));
  320. Render::rect(size.x, size.y + size.h + 4, size.w, 2, Color(51, 51, 51, 255));
  321. Render::rect(size.x, size.y + size.h + 4, ammoyes, 2, arc);
  322. }
  323.  
  324. void CEsp::ammo_text(IClientEntity* pEntity, Box size)
  325. {
  326. C_BaseCombatWeapon* pWeapon = pEntity->GetWeapon2();
  327. IClientEntity* pLocal = (IClientEntity*)interfaces::ent_list->get_client_entity(interfaces::engine->GetLocalPlayer());
  328.  
  329. if (!pEntity || pEntity == nullptr || !pLocal || !pLocal->IsAlive())
  330. return;
  331.  
  332. if (!pWeapon)
  333. return;
  334.  
  335. if (pWeapon->isZeus27() || pWeapon->IsMiscGAY())
  336. return;
  337. //bool text_side = options::menu.visuals_tab.OptionsName.GetIndex() > 1;
  338. CSWeaponInfo* weapInfo = pWeapon->GetCSWpnData();
  339.  
  340. if (weapInfo == nullptr)
  341. return;
  342.  
  343. Color arc = Color(options::menu.visuals_tab.AmmoC.GetValue());
  344.  
  345. Vector vecOrigin = pEntity->GetOrigin();
  346. Vector vecOriginLocal = hackManager.pLocal()->GetOrigin();
  347. float dist = DistanceTo(vecOriginLocal, vecOrigin) / 3;
  348.  
  349. static RECT Size = Render::GetTextSize(Render::Fonts::esp, "Hi");
  350. char ammoBuffer[512];
  351. sprintf_s(ammoBuffer, "%d bullets", pWeapon->GetAmmoInClip());
  352. Render::Text(size.x + size.w + 5, (size.y + (14)) + (1 * Size.bottom) - dist, Color(255, 255, 255, 255), Render::Fonts::esp, ammoBuffer);
  353. //Render::Text(size.x + size.w + 5, (size.y + (text_side ? 33 : 14)) + (1 * Size.bottom) - dist, Color(255, 255, 255, 255), Render::Fonts::esp, ammoBuffer);
  354. }
  355.  
  356. void CEsp::DrawPlayer(IClientEntity* pEntity, player_info_t pinfo)
  357. {
  358. Box box;
  359. ESPBox esp_box;
  360.  
  361. Vector max = pEntity->GetCollideable()->OBBMaxs();
  362.  
  363. Vector pos, pos3D;
  364. Vector top, top3D;
  365. pos3D = pEntity->GetOrigin();
  366. top3D = pos3D + Vector(0, 0, max.z);
  367.  
  368. bool teammate = pEntity->team() == hackManager.pLocal()->team();
  369.  
  370. if (!interfaces::engine->IsConnected() || !interfaces::engine->IsInGame())
  371. return;
  372.  
  373. if (!GameUtils::World2Screen(pos3D, pos) || !GameUtils::World2Screen(top3D, top))
  374. return;
  375.  
  376. auto local_player = interfaces::ent_list->get_client_entity(interfaces::engine->GetLocalPlayer());
  377.  
  378. if (local_player == nullptr)
  379. return;
  380.  
  381. if (!teammate && options::menu.visuals_tab.OffscreenESP.GetState())
  382. enemy_out_of_range(pEntity, Color(options::menu.visuals_tab.Offscreen.GetValue()));
  383.  
  384. if (get_box(pEntity, box, options::menu.visuals_tab.Active.GetState()) && (!teammate))
  385. {
  386. if (options::menu.visuals_tab.OptionsBox.GetState())
  387. {
  388. default_box(box, options::menu.visuals_tab.BoxCol.GetValue());
  389. }
  390.  
  391. if (options::menu.visuals_tab.OptionsName.GetState())
  392. {
  393. DrawName(pinfo, box, pEntity);
  394. }
  395.  
  396. if (options::menu.visuals_tab.OptionsHealth.GetState())
  397. {
  398. hp_default(pEntity, box);
  399.  
  400. }
  401.  
  402. if (options::menu.visuals_tab.OptionsArmor.GetIndex() != 0)
  403. {
  404. switch (options::menu.visuals_tab.OptionsArmor.GetIndex())
  405. {
  406. case 1: armor_default(pEntity, box);
  407. break;
  408. case 2: armor_battery(pEntity, box);
  409. break;
  410. case 3: armor_bottom(pEntity, box);
  411. break;
  412. }
  413.  
  414. }
  415.  
  416. if (options::menu.visuals_tab.OptionsInfo.GetState() || options::menu.visuals_tab.OptionsWeapone.GetState())
  417. {
  418. DrawInfo(pEntity, box);
  419. DrawInfo2(pEntity, box);
  420. }
  421.  
  422. if (options::menu.visuals_tab.OptionsSkeleton.GetState())
  423. DrawSkeleton(pEntity);
  424.  
  425. if (options::menu.visuals_tab.Weapons.GetState())
  426. {
  427. if (options::menu.visuals_tab.WeaponArray.GetIndex() == 0 || options::menu.visuals_tab.WeaponArray.GetIndex() == 2)
  428. {
  429. DrawWeapon(pEntity, box);
  430. }
  431. if (options::menu.visuals_tab.WeaponArray.GetIndex() == 1 || options::menu.visuals_tab.WeaponArray.GetIndex() == 2)
  432. {
  433. DrawWeaponIcon(pEntity, box);
  434. }
  435. }
  436.  
  437. if (options::menu.visuals_tab.Ammo.GetState())
  438. {
  439. DrawAmmo(pEntity, box);
  440.  
  441. if (options::menu.visuals_tab.OptionsInfo.GetState())
  442. {
  443. ammo_text(pEntity, box);
  444. }
  445. }
  446. }
  447.  
  448. if (get_box(pEntity, box, options::menu.visuals_tab.Active.GetState()) && options::menu.visuals_tab.show_team.GetState() && (teammate))
  449. {
  450. if (options::menu.visuals_tab.OptionsBox.GetState())
  451. {
  452. default_box(box, options::menu.visuals_tab.BoxCol.GetValue());
  453. }
  454.  
  455. if (options::menu.visuals_tab.OptionsName.GetState())
  456. {
  457. DrawName(pinfo, box, pEntity);
  458. }
  459.  
  460. if (options::menu.visuals_tab.OptionsHealth.GetState())
  461. {
  462. hp_default(pEntity, box);
  463. }
  464.  
  465. if (options::menu.visuals_tab.OptionsArmor.GetIndex() != 0)
  466. {
  467. switch (options::menu.visuals_tab.OptionsArmor.GetIndex())
  468. {
  469. case 1: armor_default(pEntity, box);
  470. break;
  471. case 2: armor_battery(pEntity, box);
  472. break;
  473. case 3: armor_bottom(pEntity, box);
  474. break;
  475. }
  476. }
  477.  
  478. if (options::menu.visuals_tab.OptionsInfo.GetState() || options::menu.visuals_tab.OptionsWeapone.GetState())
  479. {
  480. DrawInfo(pEntity, box);
  481. DrawInfo2(pEntity, box);
  482. }
  483.  
  484. if (options::menu.visuals_tab.OptionsSkeleton.GetState())
  485. DrawSkeleton_team(pEntity);
  486.  
  487. if (options::menu.visuals_tab.Weapons.GetState()) {
  488. DrawWeapon(pEntity, box);
  489. }
  490.  
  491. if (options::menu.visuals_tab.WeaponIconESP.GetState())
  492. {
  493. DrawWeaponIcon(pEntity, box);
  494. }
  495.  
  496. if (options::menu.visuals_tab.Ammo.GetState())
  497. {
  498. DrawAmmo(pEntity, box);
  499.  
  500. if (options::menu.visuals_tab.OptionsInfo.GetState())
  501. {
  502. ammo_text(pEntity, box);
  503. }
  504. }
  505. }
  506.  
  507.  
  508. }
  509. float dot_product_t(const float* a, const float* b) {
  510. return (a[0] * b[0] + a[1] * b[1] + a[2] * b[2]);
  511. }
  512. #define rad_pi 57.295779513082f
  513. #define pi 3.14159265358979323846f
  514. #define rad(a) a * 0.01745329251
  515. #define deg(a) a * 57.295779513082
  516. float degrees_to_radians(const float deg)
  517. {
  518. return deg * (pi / 180.f);
  519. }
  520. float radians_to_degrees(const float rad)
  521. {
  522. return rad * rad_pi;
  523. }
  524.  
  525. void rotate_triangle(std::array<Vector2D, 3>& points, float rotation)
  526. {
  527. const auto points_center = (points.at(0) + points.at(1) + points.at(2)) / 3;
  528. for (auto& point : points)
  529. {
  530. point -= points_center;
  531. const auto temp_x = point.x;
  532. const auto temp_y = point.y;
  533. const auto theta = degrees_to_radians(rotation);
  534. const auto c = cosf(theta);
  535. const auto s = sinf(theta);
  536. point.x = temp_x * c - temp_y * s;
  537. point.y = temp_x * s + temp_y * c;
  538. point += points_center;
  539. }
  540. }
  541. template<class T, class U>
  542. inline T clampx(T in, U low, U high)
  543. {
  544. if (in <= low)
  545. return low;
  546. else if (in >= high)
  547. return high;
  548. else
  549. return in;
  550. }
  551. void VectorAngles(Vector &forward, QAngle &angles)
  552. {
  553. Assert(s_bMathlibInitialized);
  554. float tmp, yaw, pitch;
  555. if (forward[1] == 0 && forward[0] == 0)
  556. {
  557. yaw = 0;
  558. if (forward[2] > 0)
  559. pitch = 270;
  560. else
  561. pitch = 90;
  562. }
  563. else
  564. {
  565. yaw = (atan2(forward[1], forward[0]) * 180 / pi);
  566. if (yaw < 0)
  567. yaw += 360;
  568. tmp = sqrt(forward[0] * forward[0] + forward[1] * forward[1]);
  569. pitch = (atan2(-forward[2], tmp) * 180 / pi);
  570. if (pitch < 0)
  571. pitch += 360;
  572. }
  573. angles[0] = pitch;
  574. angles[1] = yaw;
  575. angles[2] = 0;
  576. }
  577.  
  578. void VectorAnglesXX(const Vector& forward, Vector &angles)
  579. {
  580. float tmp, yaw, pitch;
  581. if (forward[1] == 0 && forward[0] == 0)
  582. {
  583. yaw = 0;
  584. if (forward[2] > 0)
  585. pitch = 270;
  586. else
  587. pitch = 90;
  588. }
  589. else
  590. {
  591. yaw = (atan2(forward[1], forward[0]) * 180 / PI);
  592. if (yaw < 0)
  593. yaw += 360;
  594. tmp = sqrt(forward[0] * forward[0] + forward[1] * forward[1]);
  595. pitch = (atan2(-forward[2], tmp) * 180 / PI);
  596. if (pitch < 0)
  597. pitch += 360;
  598. }
  599. angles[0] = pitch;
  600. angles[1] = yaw;
  601. angles[2] = 0;
  602. }
  603. Vector CalcAngleXX(Vector src, Vector dst)
  604. {
  605. Vector ret;
  606. VectorAnglesXX(dst - src, ret);
  607. return ret;
  608. }
  609. template<class T, class U>
  610. inline T clamp(T in, U low, U high)
  611. {
  612. if (in <= low)
  613. return low;
  614. else if (in >= high)
  615. return high;
  616. else
  617. return in;
  618. }
  619. void CEsp::SpecList()
  620. {
  621. IClientEntity *pLocal = hackManager.pLocal();
  622. RECT scrn = Render::GetViewport();
  623. int ayy = 0;
  624. // Loop through all active entitys
  625. for (int i = 0; i < interfaces::ent_list->GetHighestEntityIndex(); i++)
  626. {
  627. // Get the entity
  628. IClientEntity *pEntity = interfaces::ent_list->get_client_entity(i);
  629. player_info_t pinfo;
  630. // The entity isn't some laggy peice of shit or something
  631. if (pEntity && pLocal && pEntity != pLocal)
  632. {
  633. if (interfaces::engine->GetPlayerInfo(i, &pinfo) && !pEntity->IsAlive() && !pEntity->IsDormant())
  634. {
  635. HANDLE obs = pEntity->GetObserverTargetHandle();
  636. if (obs)
  637. {
  638. IClientEntity *pTarget = interfaces::ent_list->GetClientEntityFromHandle(obs);
  639. player_info_t pinfo2;
  640. if (pTarget)
  641. {
  642. if (interfaces::engine->GetPlayerInfo(pTarget->GetIndex(), &pinfo2))
  643. {
  644. if (strlen(pinfo.name) > 16)
  645. {
  646. pinfo.name[12] = 0;
  647. strcat(pinfo.name, "...");
  648. RECT TextSize = Render::GetTextSize(Render::Fonts::nameaiz, pinfo.name);
  649. RECT nameSize = Render::GetTextSize(Render::Fonts::nameaiz, pinfo.name);
  650. Render::Text(scrn.right - TextSize.right - 4, (scrn.top / 4) + (16 * ayy), pTarget->GetIndex() == pLocal->GetIndex() ? Color(255, 255, 255, 255) : Color(255, 255, 255, 255), Render::Fonts::nameaiz, pinfo.name);
  651. ayy++;
  652. }
  653. }
  654. }
  655. }
  656. }
  657. }
  658. }
  659. }
  660. void vector_transform_a(const float *in1, const matrix3x4& in2, float *out) {
  661. out[0] = dot_product_t(in1, in2[0]) + in2[0][3];
  662. out[1] = dot_product_t(in1, in2[1]) + in2[1][3];
  663. out[2] = dot_product_t(in1, in2[2]) + in2[2][3];
  664. }
  665. inline void vector_transform_z(const Vector& in1, const matrix3x4 &in2, Vector &out) {
  666. vector_transform_a(&in1.x, in2, &out.x);
  667. }
  668. bool CEsp::get_box(IClientEntity* m_entity, Box& box, bool dynamic) {
  669. DWORD m_rgflCoordinateFrame = (DWORD)0x444; //(DWORD)0x470 - 0x30
  670. const matrix3x4& trnsf = *(matrix3x4*)((DWORD)m_entity + (DWORD)m_rgflCoordinateFrame);
  671. Vector vOrigin, min, max, sMin, sMax, sOrigin,
  672. flb, brt, blb, frt, frb, brb, blt, flt;
  673. float left, top, right, bottom;
  674. vOrigin = m_entity->GetOrigin();
  675. min = m_entity->collisionProperty()->GetMins();
  676. max = m_entity->collisionProperty()->GetMaxs();
  677. if (!dynamic) {
  678. min += vOrigin;
  679. max += vOrigin;
  680. }
  681. Vector points[] = { Vector(min.x, min.y, min.z),
  682. Vector(min.x, max.y, min.z),
  683. Vector(max.x, max.y, min.z),
  684. Vector(max.x, min.y, min.z),
  685. Vector(max.x, max.y, max.z),
  686. Vector(min.x, max.y, max.z),
  687. Vector(min.x, min.y, max.z),
  688. Vector(max.x, min.y, max.z) };
  689. Vector vector_transformed[8];
  690. if (dynamic)
  691. {
  692. for (int i = 0; i < 8; i++)
  693. {
  694. vector_transform_z(points[i], trnsf, vector_transformed[i]);
  695. points[i] = vector_transformed[i];
  696. }
  697. }
  698. if (!Render::TransformScreen(points[3], flb) || !Render::TransformScreen(points[5], brt)
  699. || !Render::TransformScreen(points[0], blb) || !Render::TransformScreen(points[4], frt)
  700. || !Render::TransformScreen(points[2], frb) || !Render::TransformScreen(points[1], brb)
  701. || !Render::TransformScreen(points[6], blt) || !Render::TransformScreen(points[7], flt))
  702. return false;
  703. Vector arr[] = { flb, brt, blb, frt, frb, brb, blt, flt };
  704. left = flb.x;
  705. top = flb.y;
  706. right = flb.x;
  707. bottom = flb.y;
  708. for (int i = 1; i < 8; i++) {
  709. if (left > arr[i].x)
  710. left = arr[i].x;
  711. if (bottom < arr[i].y)
  712. bottom = arr[i].y;
  713. if (right < arr[i].x)
  714. right = arr[i].x;
  715. if (top > arr[i].y)
  716. top = arr[i].y;
  717. }
  718. box.x = left;
  719. box.y = top;
  720. box.w = right - left;
  721. box.h = bottom - top;
  722. return true;
  723. }
  724. bool CEsp::GetBox(IClientEntity* pEntity, CEsp::ESPBox &result)
  725. {
  726. Vector vOrigin, min, max, sMin, sMax, sOrigin,
  727. flb, brt, blb, frt, frb, brb, blt, flt;
  728. float left, top, right, bottom;
  729. vOrigin = pEntity->GetOrigin();
  730. min = pEntity->collisionProperty()->GetMins() + vOrigin;
  731. max = pEntity->collisionProperty()->GetMaxs() + vOrigin;
  732. Vector points[] = { Vector(min.x, min.y, min.z),
  733. Vector(min.x, max.y, min.z),
  734. Vector(max.x, max.y, min.z),
  735. Vector(max.x, min.y, min.z),
  736. Vector(max.x, max.y, max.z),
  737. Vector(min.x, max.y, max.z),
  738. Vector(min.x, min.y, max.z),
  739. Vector(max.x, min.y, max.z) };
  740. if (!Render::TransformScreen(points[3], flb) || !Render::TransformScreen(points[5], brt)
  741. || !Render::TransformScreen(points[0], blb) || !Render::TransformScreen(points[4], frt)
  742. || !Render::TransformScreen(points[2], frb) || !Render::TransformScreen(points[1], brb)
  743. || !Render::TransformScreen(points[6], blt) || !Render::TransformScreen(points[7], flt))
  744. return false;
  745. Vector arr[] = { flb, brt, blb, frt, frb, brb, blt, flt };
  746. left = flb.x;
  747. top = flb.y;
  748. right = flb.x;
  749. bottom = flb.y;
  750. for (int i = 1; i < 8; i++)
  751. {
  752. if (left > arr[i].x)
  753. left = arr[i].x;
  754. if (bottom < arr[i].y)
  755. bottom = arr[i].y;
  756. if (right < arr[i].x)
  757. right = arr[i].x;
  758. if (top > arr[i].y)
  759. top = arr[i].y;
  760. }
  761. result.x = left;
  762. result.y = top;
  763. result.w = right - left;
  764. result.h = bottom - top;
  765. return true;
  766. }
  767. Color CEsp::GetPlayerColor(IClientEntity* pEntity)
  768. {
  769. int TeamNum = pEntity->team();
  770. bool IsVis = GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)csgo_hitboxes::head);
  771. Color color;
  772. if (TeamNum == TEAM_CS_T)
  773. {
  774. }
  775. else
  776. {
  777. }
  778. return color;
  779. }
  780. std::string CleanItemName(std::string name)
  781. {
  782. std::string Name = name;
  783. if (Name[0] == 'C')
  784. Name.erase(Name.begin());
  785. auto startOfWeap = Name.find("Weapon");
  786. if (startOfWeap != std::string::npos)
  787. Name.erase(Name.begin() + startOfWeap, Name.begin() + startOfWeap + 6);
  788. return Name;
  789. }
  790. void CEsp::DrawGun(IClientEntity* pEntity, CEsp::ESPBox size)
  791. {
  792. IClientEntity* pWeapon = interfaces::ent_list->GetClientEntityFromHandle((HANDLE)pEntity->GetActiveWeaponHandle());
  793. ClientClass* cClass = (ClientClass*)pWeapon->GetClientClass();
  794. if (cClass)
  795. {
  796. std::string meme = CleanItemName(cClass->m_pNetworkName);
  797. RECT nameSize = Render::GetTextSize(Render::Fonts::esp, meme.c_str());
  798. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y + size.h + 1,
  799. Color(255, 255, 255, 255), Render::Fonts::esp, meme.c_str());
  800. }
  801. }
  802. void CEsp::corner_box(Box size, Color color, IClientEntity* pEntity)
  803. {
  804. int VertLine = (((float)size.w) * (0.20f));
  805. int HorzLine = (((float)size.h) * (0.30f));
  806. Render::Clear(size.x, size.y - 1, VertLine, 1, Color(0, 0, 0, 255));
  807. Render::Clear(size.x + size.w - VertLine, size.y - 1, VertLine, 1, Color(0, 0, 0, 255));
  808. Render::Clear(size.x, size.y + size.h - 1, VertLine, 1, Color(0, 0, 0, 255));
  809. Render::Clear(size.x + size.w - VertLine, size.y + size.h - 1, VertLine, 1, Color(0, 0, 0, 255));
  810. Render::Clear(size.x - 1, size.y, 1, HorzLine, Color(0, 0, 0, 255));
  811. Render::Clear(size.x - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(0, 0, 0, 255));
  812. Render::Clear(size.x + size.w - 1, size.y, 1, HorzLine, Color(0, 0, 0, 255));
  813. Render::Clear(size.x + size.w - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(0, 0, 0, 255));
  814. Render::Clear(size.x, size.y, VertLine, 1, color);
  815. Render::Clear(size.x + size.w - VertLine, size.y, VertLine, 1, color);
  816. Render::Clear(size.x, size.y + size.h, VertLine, 1, color);
  817. Render::Clear(size.x + size.w - VertLine, size.y + size.h, VertLine, 1, color);
  818. Render::Clear(size.x, size.y, 1, HorzLine, color);
  819. Render::Clear(size.x, size.y + size.h - HorzLine, 1, HorzLine, color);
  820. Render::Clear(size.x + size.w, size.y, 1, HorzLine, color);
  821. Render::Clear(size.x + size.w, size.y + size.h - HorzLine, 1, HorzLine, color);
  822. }
  823. void CEsp::FilledBox(CEsp::ESPBox size, Color color)
  824. {
  825. int VertLine = (((float)size.w) * (0.20f));
  826. int HorzLine = (((float)size.h) * (0.20f));
  827. Render::Clear(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(0, 0, 0, 40));
  828. Render::Clear(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(0, 0, 0, 40));
  829. Render::Clear(size.x, size.y, VertLine, 1, color);
  830. Render::Clear(size.x + size.w - VertLine, size.y, VertLine, 1, color);
  831. Render::Clear(size.x, size.y + size.h, VertLine, 1, color);
  832. Render::Clear(size.x + size.w - VertLine, size.y + size.h, VertLine, 1, color);
  833. Render::Clear(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(0, 0, 0, 40));
  834. Render::Clear(size.x, size.y, 1, HorzLine, color);
  835. Render::Clear(size.x, size.y + size.h - HorzLine, 1, HorzLine, color);
  836. Render::Clear(size.x + size.w, size.y, 1, HorzLine, color);
  837. Render::Clear(size.x + size.w, size.y + size.h - HorzLine, 1, HorzLine, color);
  838. Render::Clear(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(0, 0, 0, 40));
  839. CEsp::ESPBox box = size;
  840. Render::Outline(box.x - 1, box.y - 1, box.w + 2, box.h + 2, Color(21, 21, 21, 150));
  841. Render::Outline(box.x + 1, box.y + 1, box.w - 2, box.h - 2, Color(21, 21, 21, 150));
  842. }
  843. void CEsp::default_box(Box box, Color color)
  844. {
  845. Render::Outline(box.x, box.y, box.w, box.h, color);
  846. Render::Outline(box.x - 1, box.y - 1, box.w + 2, box.h + 2, Color(21, 21, 21, 150));
  847. Render::Outline(box.x + 1, box.y + 1, box.w - 2, box.h - 2, Color(21, 21, 21, 150));
  848. Render::Outline(box.x - 1, box.y - 1, box.w + 2, box.h + 2, Color(21, 21, 21, 150));
  849. Render::Outline(box.x + 1, box.y + 1, box.w - 2, box.h - 2, Color(21, 21, 21, 150));
  850. }
  851. void CEsp::bracket_box(Box size, Color color)
  852. {
  853. int VertLine = (((float)size.w) * (0.30f));
  854. int HorzLine = (((float)size.h) * (1.00f));
  855. Render::Clear(size.x, size.y, VertLine, 1.2, color);
  856. Render::Clear(size.x + size.w - VertLine, size.y, VertLine, 1.2, color);
  857. Render::Clear(size.x, size.y + size.h, VertLine, 1.2, color);
  858. Render::Clear(size.x + size.w - VertLine, size.y + size.h, VertLine, 1.2, color);
  859. Render::Clear(size.x, size.y, 1, HorzLine, color);
  860. Render::Clear(size.x, size.y + size.h - HorzLine, 1, HorzLine, color);
  861. Render::Clear(size.x + size.w, size.y, 1, HorzLine, color);
  862. Render::Clear(size.x + size.w, size.y + size.h - HorzLine, 1, HorzLine, color);
  863. Box box = size;
  864. Render::Outline(box.x - 1, box.y - 1, box.w + 2, box.h + 2, Color(21, 21, 21, 150));
  865. Render::Outline(box.x + 1, box.y + 1, box.w - 2, box.h - 2, Color(21, 21, 21, 150));
  866. }
  867. static wchar_t* CharToWideChar(const char* text)
  868. {
  869. size_t size = strlen(text) + 1;
  870. wchar_t* wa = new wchar_t[size];
  871. mbstowcs_s(NULL, wa, size / 4, text, size);
  872. return wa;
  873. }
  874. //converting like that will fuck the unicode characters lmao who made that
  875. void CEsp::DrawName(player_info_t pinfo, Box size, IClientEntity* pEntity)
  876. {
  877. if (!pEntity || !pEntity->IsAlive() || !hackManager.pLocal())
  878. return;
  879. wchar_t buffer[36];
  880. auto name = pinfo.name;
  881. if (MultiByteToWideChar(CP_UTF8, 0, pinfo.name, -1, buffer, 36) > 0)
  882. {
  883. RECT nameSize = Render::GetTextSize(Render::Fonts::NameESP, pinfo.name);
  884. Render::TEXTUNICODE(size.x + (size.w / 2) - (nameSize.right / 2), size.y - 13 /*11*/, pinfo.name, Render::Fonts::NameESP, Color(options::menu.visuals_tab.NameCol.GetValue()));
  885. }
  886. }
  887.  
  888. void CEsp::hp_battery(IClientEntity* pEntity, Box size)
  889. {
  890. Box HealthBar = size;
  891. HealthBar.y += (HealthBar.h + 6);
  892. HealthBar.h = 4;
  893.  
  894. float HealthValue = pEntity->GetHealth();
  895. float HealthPerc = HealthValue / 100.f;
  896. float Width = (size.w * HealthPerc);
  897. HealthBar.w = Width;
  898.  
  899. // -- Main Bar -- //
  900.  
  901. float flBoxes = std::ceil(pEntity->GetHealth() / 10);
  902. float flX = size.x - 7; float flY = size.y - 1;
  903. float flHeight = size.h / 10.f;
  904. float flHeight2 = size.h / 10.f;
  905. float flMultiplier = 10 / 360.f; flMultiplier *= flBoxes - 1;
  906.  
  907. int rectHeight = flHeight * flBoxes + 1;
  908.  
  909. Render::DrawRect(flX, flY, 4, size.h + 2, Color(60, 60, 60, 255));
  910. Render::Outline(flX, flY, 4, size.h + 2, Color(0, 0, 0, 255));
  911.  
  912. Render::DrawRect(flX + 1, flY + size.h + (flMultiplier - rectHeight) + 1, 2, rectHeight, pEntity->IsDormant() ? Color(0, 0, 0, 140) : Color(0, 250, 90, 255));
  913.  
  914. for (int i = 0; i < 10; i++) //
  915. Render::Line(flX, flY + i * flHeight2, flX + 4, flY + i * flHeight2, Color(0, 0, 0, 255));
  916. }
  917.  
  918.  
  919. void CEsp::armor_battery(IClientEntity* pEntity, Box size)
  920. {
  921. Box ArmorBar = size;
  922. ArmorBar.y += (ArmorBar.h + 6);
  923. ArmorBar.h = 4;
  924.  
  925. float ArmorValue = pEntity->ArmorValue();
  926. float ArmorPerc = ArmorValue / 100.f;
  927. float Width = (size.w * ArmorPerc);
  928. ArmorBar.w = Width;
  929.  
  930. // -- Main Bar -- //
  931.  
  932. float flBoxes = std::ceil(pEntity->ArmorValue() / 10);
  933. float flX = size.x - (options::menu.visuals_tab.OptionsHealth.GetState() ? 7 : 12); float flY = size.y - 1;
  934. float flHeight = size.h / 10.f;
  935. float flHeight2 = size.h / 10.f;
  936. float flMultiplier = 10 / 360.f; flMultiplier *= flBoxes - 1;
  937. Color ColArmor = Color::FromHSB(flMultiplier, 1, 1);
  938. int rectHeight = flHeight * flBoxes + 1;
  939.  
  940.  
  941. Render::DrawRect(flX, flY, 4, size.h + 2, Color(60, 60, 60, 255));
  942. Render::Outline(flX, flY, 4, size.h + 2, Color(0, 0, 0, 255));
  943.  
  944. Render::DrawRect(flX + 1, flY + size.h + (flMultiplier - rectHeight) + 1, 2, rectHeight, Color(0, 100, 250, 140));
  945.  
  946. for (int i = 0; i < 10; i++) //
  947. Render::Line(flX, flY + i * flHeight2, flX + 4, flY + i * flHeight2, Color(0, 0, 0, 255));
  948.  
  949.  
  950. }
  951.  
  952. void CEsp::armor_default(IClientEntity* pEntity, Box size)
  953. {
  954. Box box = size;
  955. int player_ar = pEntity->ArmorValue() > 100 ? 100 : pEntity->ArmorValue();
  956. if (player_ar)
  957. {
  958. if (player_ar > 100) {
  959. player_ar = 100;
  960. }
  961. int color[3] = { 0, 120, 250 };
  962.  
  963. Render::Outline(box.x - 7, box.y - 1, 4, box.h + 2, Color(21, 21, 21, 255));
  964. int health_height = player_ar * box.h / 100;
  965. int add_space = box.h - health_height;
  966. Color hec = Color(color[0], color[1], color[2], 255);
  967. Render::rect(box.x - 11, box.y, 2, box.h, Color(21, 21, 21, 255));
  968. Render::rect(box.x - 11, box.y + add_space, 2, health_height, hec);
  969.  
  970. }
  971. } // DrawAmmo_vital(pEntity, box)
  972.  
  973. void CEsp::hp_default(IClientEntity* pEntity, Box size)
  974. {
  975. Box box = size;
  976. int player_health = pEntity->GetHealth() > 100 ? 100 : pEntity->GetHealth();
  977. if (player_health) {
  978.  
  979. int color[3] = { 0, 0, 0 };
  980. color[0] = 83; color[1] = 250; color[2] = 90;
  981.  
  982. Render::Outline(box.x - 7, box.y - 1, 4, box.h + 2, Color(21, 21, 21, 255));
  983. int health_height = player_health * box.h / 100;
  984. int add_space = box.h - health_height;
  985. Color hec = Color(color[0], color[1], color[2], 255);
  986. Render::rect(box.x - 6, box.y, 2, box.h, Color(21, 21, 21, 255));
  987. Render::rect(box.x - 6, box.y + add_space, 2, health_height, Color(255 - (player_health * 1.55f), 100 + (player_health * 1.55f), 10, 255));
  988.  
  989. }
  990. }
  991.  
  992. float CEsp::DistanceTo(Vector vecSrc, Vector vecDst)
  993. {
  994. Vector vDelta = vecDst - vecSrc;
  995.  
  996. float fDistance = ::sqrtf((vDelta.Length()));
  997.  
  998. if (fDistance < 1.0f)
  999. return 1.0f;
  1000.  
  1001. return fDistance;
  1002. }
  1003.  
  1004. void CEsp::armor_bottom(IClientEntity* pEntity, Box size)
  1005. {
  1006. Color arc = Color(10, 100, 230, 255);
  1007. int hp = pEntity->ArmorValue() * (size.w) / 100;
  1008.  
  1009. if (options::menu.visuals_tab.OptionsHealth.GetState())
  1010. {
  1011. Render::outlineyeti(size.x - 1, size.y + size.h + 5, size.w + 2, 4, Color(21, 21, 21, 255));
  1012. Render::rect(size.x, size.y + size.h + 6, size.w, 2, Color(51, 51, 51, 255));
  1013. Render::rect(size.x, size.y + size.h + 6, hp, 2, arc);
  1014. }
  1015. else
  1016. {
  1017. Render::outlineyeti(size.x - 1, size.y + size.h + 9, size.w + 2, 4, Color(21, 21, 21, 255));
  1018. Render::rect(size.x, size.y + size.h + 10, size.w, 2, Color(51, 51, 51, 255));
  1019. Render::rect(size.x, size.y + size.h + 10, hp, 2, arc);
  1020. }
  1021. // Render::Text(size.x + hp, (size.y + 7 ) + size.h, Color(255, 255, 255), Render::Fonts::smallassfont, std::to_string(pEntity->GetHealth()).c_str());
  1022. }
  1023.  
  1024.  
  1025. void CEsp::DrawInfo(IClientEntity* pEntity, Box size)
  1026. {
  1027. IClientEntity *g_LocalPlayer = hackManager.pLocal();
  1028. if (!g_LocalPlayer)
  1029. return;
  1030. std::vector<std::pair<std::string, Color>> stored_info;
  1031. auto entity = pEntity;
  1032. static float old_simtime[65];
  1033.  
  1034. if (entity->GetFlashDuration() > 0)
  1035. stored_info.push_back(std::pair<std::string, Color>("FLASHED", Color(250, 250, 250, 250)));
  1036. if (BombCarrier == entity)
  1037. stored_info.push_back(std::pair<std::string, Color>("BOMB", Color(250, 250, 250, 220)));
  1038.  
  1039.  
  1040.  
  1041. int i = 0;
  1042. for (auto Text : stored_info)
  1043. {
  1044. RECT TextSize = Render::GetTextSize(Render::Fonts::esp, Text.first.c_str());
  1045. Render::Text(size.x + size.w + 1, (size.y + 30) + i - ((TextSize.bottom / 2) - 5), Text.second, Render::Fonts::esp, Text.first.c_str());
  1046. i += 8;
  1047. }
  1048.  
  1049. }
  1050.  
  1051. void CEsp::DrawInfo2(IClientEntity* pEntity, Box size)
  1052. {
  1053. RECT defSize = Render::GetTextSize(Render::Fonts::esp, "");
  1054. std::vector<std::string> Info;
  1055.  
  1056. // Player Weapon ESP
  1057. IClientEntity* pWeapon = interfaces::ent_list->GetClientEntityFromHandle((HANDLE)pEntity->GetActiveWeaponHandle());
  1058. static RECT Size = Render::GetTextSize(Render::Fonts::Default, "Hi");
  1059. RECT named = Render::GetTextSize(Render::Fonts::esp, "Scoped");
  1060.  
  1061. if (options::menu.visuals_tab.OptionsInfo.GetState())
  1062. {
  1063. char hp[50];
  1064. sprintf_s(hp, sizeof(hp), "%i", pEntity->ArmorValue());
  1065. RECT nameSize = Render::GetTextSize(Render::Fonts::esp, hp);
  1066.  
  1067. if (pEntity->ArmorValue() > 0)
  1068. {
  1069. if (pEntity->HasHelmet())
  1070. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y + size.h + 23, Color(255, 255, 255, 255), Render::Fonts::esp, "HK");
  1071. else
  1072. Render::Text(size.x + (size.w / 2) - ((nameSize.right / 2)), size.y + size.h + 23, Color(210, 210, 210, 255), Render::Fonts::esp, "K");
  1073. }
  1074. else
  1075. {
  1076. if (pEntity->ArmorValue() > 0)
  1077. {
  1078. if (pEntity->HasHelmet())
  1079. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y + size.h + 15, Color(255, 255, 255, 255), Render::Fonts::esp, "HK");
  1080. else
  1081. Render::Text(size.x + (size.w / 2) - ((nameSize.right / 2)), size.y + size.h + 15, Color(210, 210, 210, 255), Render::Fonts::esp, "K");
  1082. }
  1083. }
  1084. }
  1085. if (options::menu.visuals_tab.OptionsInfo.GetState())
  1086. {
  1087. if (pEntity->IsScoped())
  1088. {
  1089. Render::Text(size.x + (size.w / 2) - (named.right / 2), size.y - 20, Color(250, 250, 250, 255), Render::Fonts::esp, "SCOPED");
  1090. }
  1091. }
  1092.  
  1093.  
  1094. int i = 0;
  1095. for (auto Text : Info)
  1096. {
  1097. Render::Text(size.x + size.w + 3, size.y + (i*(Size.bottom + 2)), Color(255, 255, 255, 255), Render::Fonts::esp, Text.c_str());
  1098. i++;
  1099. }
  1100. }
  1101.  
  1102.  
  1103. void CEsp::DrawCross(IClientEntity* pEntity)
  1104. {
  1105. Vector cross = pEntity->GetHeadPos(), screen;
  1106. vec_t Scale = 2;
  1107. if (Render::TransformScreen(cross, screen))
  1108. {
  1109. Render::Clear(screen.x - Scale, screen.y - (Scale * 2), (Scale * 2), (Scale * 4), Color(20, 20, 20, 160));
  1110. Render::Clear(screen.x - (Scale * 2), screen.y - Scale, (Scale * 4), (Scale * 2), Color(20, 20, 20, 160));
  1111. Render::Clear(screen.x - Scale - 1, screen.y - (Scale * 2) - 1, (Scale * 2) - 2, (Scale * 4) - 2, Color(250, 250, 250, 160));
  1112. Render::Clear(screen.x - (Scale * 2) - 1, screen.y - Scale - 1, (Scale * 4) - 2, (Scale * 2) - 2, Color(250, 250, 250, 160));
  1113. }
  1114. }
  1115.  
  1116. void CEsp::DrawDrop(IClientEntity* pEntity, ClientClass* cClass)
  1117. {
  1118. Color color;
  1119. Box Box;
  1120. IClientEntity* Weapon = (IClientEntity*)pEntity;
  1121.  
  1122. IClientEntity* plr = interfaces::ent_list->GetClientEntityFromHandle((HANDLE)Weapon->GetOwnerHandle());
  1123.  
  1124. if (Weapon && !plr)
  1125. {
  1126. if (get_box(pEntity, Box, options::menu.visuals_tab.FiltersWeapons.GetState()))
  1127. {
  1128. if (options::menu.visuals_tab.FiltersWeapons.GetState())
  1129. {
  1130. //DrawBoxx(Box, Color(255, 255, 255, 255));
  1131. }
  1132. if (options::menu.visuals_tab.DroppedWeaponsType.GetIndex() == 0)
  1133. {
  1134. RECT TextSize = Render::GetTextSize(Render::Fonts::esp, Weapon->GetWeaponName());
  1135. Render::Text(Box.x + (Box.w / 2) - (TextSize.right / 2), Box.y + Box.h + 5, Color(options::menu.visuals_tab.DroppedWeaponNameCLR.GetValue()), Render::Fonts::esp, Weapon->GetWeaponName());
  1136. }
  1137. else if (options::menu.visuals_tab.DroppedWeaponsType.GetIndex() == 1)
  1138. {
  1139. RECT TextSize = Render::GetTextSize(Render::Fonts::WeaponIcon, Weapon->getIcon());
  1140. Render::Text(Box.x + (Box.w / 2) - (TextSize.right / 2), Box.y + Box.h + 5, Color(options::menu.visuals_tab.DroppedWeaponNameCLR.GetValue()), Render::Fonts::WeaponIcon, Weapon->getIcon());
  1141. }
  1142. else
  1143. {
  1144. RECT TextSize = Render::GetTextSize(Render::Fonts::esp, Weapon->GetWeaponName());
  1145. Render::Text(Box.x + (Box.w / 2) - (TextSize.right / 2), Box.y + Box.h + 5, Color(options::menu.visuals_tab.DroppedWeaponNameCLR.GetValue()), Render::Fonts::esp, Weapon->GetWeaponName());
  1146.  
  1147. RECT TextSizeE = Render::GetTextSize(Render::Fonts::WeaponIcon, Weapon->getIcon());
  1148. Render::Text(Box.x + (Box.w / 2) - (TextSizeE.right / 2), Box.y + Box.h + 17, Color(options::menu.visuals_tab.DroppedWeaponNameCLR.GetValue()), Render::Fonts::WeaponIcon, Weapon->getIcon());
  1149. }
  1150. if (options::menu.visuals_tab.DroppedWeaponAmmo.GetState())
  1151. {
  1152. //CSWeaponInfo* wepinfo;
  1153. //auto ammo_calc = clamp(Weapon->GetAmmoInClip() * Box.w / wepinfo->max_clip, 0, Box.w);
  1154. //Render::DrawFilledRect(Box.x, Box.y + Box.h + 3, ammo_calc, 2, Color(options::menu.visuals_tab.DroppedWeaponAmmoCLR.GetValue()));
  1155. //Render::DrawOutlinedRect(Box.x, Box.y, Box.h + 3, Box.w, Color(0, 0, 0, 255));
  1156. }
  1157. }
  1158. }
  1159. }
  1160.  
  1161. void CEsp::DrawDropIcon(IClientEntity* pEntity, ClientClass* cClass)
  1162. {
  1163. Color color;
  1164. Box Box;
  1165. IClientEntity* Weapon = (IClientEntity*)pEntity;
  1166.  
  1167. IClientEntity* plr = interfaces::ent_list->GetClientEntityFromHandle((HANDLE)Weapon->GetOwnerHandle());
  1168.  
  1169. if (Weapon && !plr)
  1170. {
  1171. if (get_box(pEntity, Box, options::menu.visuals_tab.FiltersWeapons.GetState()))
  1172. {
  1173. if (options::menu.visuals_tab.FiltersWeapons.GetState())
  1174. {
  1175. //DrawBoxx(Box, Color(255, 255, 255, 255));
  1176. }
  1177. RECT TextSize = Render::GetTextSize(Render::Fonts::nameaiz, Weapon->GetWeaponName());
  1178. Render::Text(Box.x + (Box.w / 2) - (TextSize.right / 2), Box.y + Box.h + 5 + 20, Color(255, 255, 255, 255), Render::Fonts::WeaponIcon, Weapon->getIcon());
  1179. }
  1180. }
  1181. }
  1182.  
  1183. void CEsp::DrawBombPlanted(IClientEntity* pEntity, ClientClass* cClass)
  1184. {
  1185. BombCarrier = nullptr;
  1186. Vector vOrig; Vector vScreen;
  1187. vOrig = pEntity->GetOrigin();
  1188. CCSBomb* Bomb = (CCSBomb*)pEntity;
  1189. float flBlow = Bomb->GetC4BlowTime();
  1190. float TimeRemaining = flBlow - (interfaces::globals->interval_per_tick * hackManager.pLocal()->GetTickBase());
  1191. char buffer[64];
  1192. sprintf_s(buffer, "%.1fs", TimeRemaining);
  1193. float TimeRemaining2;
  1194. bool exploded = true;
  1195. if (TimeRemaining < 0)
  1196. {
  1197. !exploded;
  1198. TimeRemaining2 = 0;
  1199. }
  1200. else
  1201. {
  1202. exploded = true;
  1203. TimeRemaining2 = TimeRemaining;
  1204. }
  1205. if (exploded)
  1206. {
  1207. sprintf_s(buffer, " Bomb: %.1f", TimeRemaining2);
  1208. }
  1209. else
  1210. {
  1211. sprintf_s(buffer, " Bomb Undefusable", TimeRemaining2);
  1212. }
  1213. //Render::Text(10, 45, Color(0, 255, 0, 255), Render::Fonts::Clock, buffer);
  1214. }
  1215. void CEsp::DrawBomb(IClientEntity* pEntity, ClientClass* cClass)
  1216. {
  1217. BombCarrier = nullptr;
  1218. C_BaseCombatWeapon *BombWeapon = (C_BaseCombatWeapon *)pEntity;
  1219. Vector vOrig; Vector vScreen;
  1220. vOrig = pEntity->GetOrigin();
  1221. bool adopted = true;
  1222. HANDLE parent = BombWeapon->GetOwnerHandle();
  1223. if (parent || (vOrig.x == 0 && vOrig.y == 0 && vOrig.z == 0))
  1224. {
  1225. IClientEntity* pParentEnt = (interfaces::ent_list->GetClientEntityFromHandle(parent));
  1226. if (pParentEnt && pParentEnt->IsAlive())
  1227. {
  1228. BombCarrier = pParentEnt;
  1229. adopted = false;
  1230. }
  1231. }
  1232. }
  1233.  
  1234. void CEsp::DrawSkeleton(IClientEntity* pEntity)
  1235. {
  1236. studiohdr_t* pStudioHdr = interfaces::model_info->GetStudiomodel(pEntity->GetModel());
  1237. if (!pStudioHdr)
  1238. return;
  1239. Vector vParent, vChild, sParent, sChild;
  1240. for (int j = 0; j < pStudioHdr->numbones; j++)
  1241. {
  1242. mstudiobone_t* pBone = pStudioHdr->GetBone(j);
  1243. if (pBone && (pBone->flags & BONE_USED_BY_HITBOX) && (pBone->parent != -1))
  1244. {
  1245. vChild = pEntity->GetBonePos(j);
  1246. vParent = pEntity->GetBonePos(pBone->parent);
  1247. if (Render::TransformScreen(vParent, sParent) && Render::TransformScreen(vChild, sChild))
  1248. {
  1249. Render::Line(sParent[0], sParent[1], sChild[0], sChild[1], Color(options::menu.visuals_tab.Skeleton.GetValue()[0], options::menu.visuals_tab.Skeleton.GetValue()[1], options::menu.visuals_tab.Skeleton.GetValue()[2], options::menu.visuals_tab.Skeleton.GetValue()[3]));
  1250. }
  1251. }
  1252. }
  1253. }
  1254.  
  1255. void CEsp::DrawSkeleton_team(IClientEntity* pEntity)
  1256. {
  1257. studiohdr_t* pStudioHdr = interfaces::model_info->GetStudiomodel(pEntity->GetModel());
  1258. if (!pStudioHdr)
  1259. return;
  1260. Vector vParent, vChild, sParent, sChild;
  1261. for (int j = 0; j < pStudioHdr->numbones; j++)
  1262. {
  1263. mstudiobone_t* pBone = pStudioHdr->GetBone(j);
  1264. if (pBone && (pBone->flags & BONE_USED_BY_HITBOX) && (pBone->parent != -1))
  1265. {
  1266. vChild = pEntity->GetBonePos(j);
  1267. vParent = pEntity->GetBonePos(pBone->parent);
  1268. if (Render::TransformScreen(vParent, sParent) && Render::TransformScreen(vChild, sChild))
  1269. {
  1270. Render::Line(sParent[0], sParent[1], sChild[0], sChild[1], Color(options::menu.visuals_tab.Skeletonteam.GetValue()[0], options::menu.visuals_tab.Skeletonteam.GetValue()[1], options::menu.visuals_tab.Skeletonteam.GetValue()[2], options::menu.visuals_tab.Skeletonteam.GetValue()[3]));
  1271. }
  1272. }
  1273. }
  1274. }
  1275.  
  1276. void CEsp::BoxAndText(IClientEntity* entity, std::string text)
  1277. {
  1278. Box Box;
  1279. std::vector<std::string> Info;
  1280. RECT nameSize = Render::GetTextSize(Render::Fonts::esp, "");
  1281. if (get_box(entity, Box, options::menu.visuals_tab.FiltersNades.GetState()))
  1282. {
  1283. Info.push_back(text);
  1284. if (options::menu.visuals_tab.FiltersNades.GetState())
  1285. {
  1286. int i = 0;
  1287. for (auto kek : Info)
  1288. {
  1289. //default_box(Box, Color(255, 255, 255, 255));
  1290. Render::Text(Box.x + (Box.w / 2) - (nameSize.right / 2) - 10, Box.y - 11, Color(options::menu.visuals_tab.ThrownNadesColor.GetValue()), Render::Fonts::esp, kek.c_str());
  1291. i++;
  1292. }
  1293. }
  1294. }
  1295. }
  1296. void CEsp::DrawThrowable(IClientEntity* throwable)
  1297. {
  1298. model_t* nadeModel = (model_t*)throwable->GetModel();
  1299. if (!nadeModel)
  1300. return;
  1301. studiohdr_t* hdr = interfaces::model_info->GetStudiomodel(nadeModel);
  1302. if (!hdr)
  1303. return;
  1304. if (!strstr(hdr->name, "thrown") && !strstr(hdr->name, "dropped"))
  1305. return;
  1306. std::string nadeName = "Unknown Grenade";
  1307. IMaterial* mats[32];
  1308. interfaces::model_info->GetModelMaterials(nadeModel, hdr->numtextures, mats);
  1309. for (int i = 0; i < hdr->numtextures; i++)
  1310. {
  1311. IMaterial* mat = mats[i];
  1312. if (!mat)
  1313. continue;
  1314. if (strstr(mat->GetName(), "flashbang"))
  1315. {
  1316. nadeName = "flash";
  1317. break;
  1318. }
  1319. else if (strstr(mat->GetName(), "m67_grenade") || strstr(mat->GetName(), "hegrenade"))
  1320. {
  1321. nadeName = "he_grenade";
  1322. break;
  1323. }
  1324. else if (strstr(mat->GetName(), "smoke"))
  1325. {
  1326. nadeName = "smoke";
  1327. break;
  1328. }
  1329. else if (strstr(mat->GetName(), "decoy"))
  1330. {
  1331. nadeName = "decoy";
  1332. break;
  1333. }
  1334. else if (strstr(mat->GetName(), "incendiary") || strstr(mat->GetName(), "molotov"))
  1335. {
  1336. nadeName = "fire";
  1337. break;
  1338. }
  1339. }
  1340. BoxAndText(throwable, nadeName);
  1341. }
  1342.  
  1343. // ---- thanks for b1g trapware code
  1344. void CEsp::draw_direction_arrow(Vector2D center, float flYaw, float flDistCenter, float flLength, Color clr)
  1345. {
  1346. Vector2D vSlope = { sin(DEG2RAD(-flYaw)), -cos(DEG2RAD(flYaw)) };
  1347. Vector2D vDirection = vSlope * flLength;
  1348. Vector2D vStart = center + (vSlope * flDistCenter);
  1349. Vector2D vEnd = vStart + (vDirection);
  1350.  
  1351. float flLeft = flYaw - 1.5f;
  1352. Vector2D vLSlope = { sin(DEG2RAD(-flLeft)), -cos(DEG2RAD(flLeft)) };
  1353. Vector2D vLStart = center + (vLSlope * flDistCenter);
  1354.  
  1355. float flRight = flYaw + 1.5f;
  1356. Vector2D vRSlope = { sin(DEG2RAD(-flRight)), -cos(DEG2RAD(flRight)) };
  1357. Vector2D vRStart = center + (vRSlope * flDistCenter);
  1358.  
  1359. interfaces::surface->DrawSetColor(clr);
  1360.  
  1361. Vertex_t vert[3] =
  1362. {
  1363.  
  1364. { vLStart, vLStart },
  1365. { vRStart, vRStart },
  1366. { vEnd, vEnd },
  1367.  
  1368. };
  1369.  
  1370. Render::Polygon(3, vert, clr);
  1371. }
  1372.  
  1373. void CEsp::enemy_out_of_range(IClientEntity *player, Color color)
  1374. {
  1375. auto g_local_player = (IClientEntity*)interfaces::ent_list->get_client_entity(interfaces::engine->GetLocalPlayer());
  1376. if (!g_local_player)
  1377. return;
  1378.  
  1379. int iScreenWidth, iScreenHeight;
  1380. interfaces::engine->GetScreenSize(iScreenWidth, iScreenHeight);
  1381.  
  1382. Vector v_real_angles;
  1383. interfaces::engine->get_viewangles(v_real_angles);
  1384.  
  1385. const auto screen_center = Vector2D(iScreenWidth / 2.f, iScreenHeight / 2.f);
  1386. float radius = 400.f;
  1387. float length = 25.f;
  1388. auto at_target_yaw = CalcAngleA(Vector(g_local_player->GetAbsOrigin().x, g_local_player->GetAbsOrigin().y, 0), Vector(player->GetAbsOrigin().x, player->GetAbsOrigin().y, 0));
  1389.  
  1390. Vector min, max;
  1391. player->GetRenderBounds(min, max);
  1392. Vector pos, pos_3d, top, top_3d;
  1393. pos_3d = player->GetAbsOrigin() - Vector(0, 0, 10);
  1394. top_3d = pos_3d + Vector(0, 0, max.z + 10);
  1395.  
  1396. if (GameUtils::World2Screen(pos_3d, pos) || GameUtils::World2Screen(top_3d, pos))
  1397. draw_direction_arrow(screen_center, (at_target_yaw.y - v_real_angles.y) * -1, radius, length, color);
  1398. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement