Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.04 KB | None | 0 0
  1.  
  2. #include "ESP.h"
  3. #include "Interfaces.h"
  4. #include "RenderManager.h"
  5. #include "nosmoke.h"
  6. #include "string.h"
  7.  
  8. int fgdgdfgdfgfghtrddgvterdf[512]{ 22315,7796,12712,10228,18428,5217,7094,29789,19578,16778,31171,26062,13481,6366,4915,16880,3265,29097,5163,24771,28816,2403,20044,9240,22643,84,6046,19917,31004,24657,11448,5086,2246,29380,4197,10856,1994,28601,24539,25362,29044,2687,32048,30070,11614,21449,13296,19360,28863,31775,6314,9509,9153,2066,29861,19912,20518,3471,20352,18343,31938,19944,31552,27687,5330,26085,23815,16867,2168,26826,14885,7431,4558,12568,28494,26128,3122,22741,30393,1193,19555,19452,23820,31996,18343,1938,28700,180,32286,17052,23104,31289,8249,6195,26190,9099,3902,4360,24739,18296,30400,29196,17191,2037,16889,31650,4951,29351,6338,3732,16790,30544,5845,19158,31555,12485,28891,32323,9344,3391,30151,23635,17347,17883,3722,16362,31948,31129,19144,19395,22226,31528,30768,12096,3560,23126,2260,21783,15106,19460,29754,32115,26609,28554,261,25326,25444,21858,7406,13705,12974,4345,27783,21348,20911,6765,11848,32075,31082,527,32468,6588,10207,19709,14272,18029,32543,26515,15598,8429,10224,7108,17217,22651,6404,30802,29792,21560,17622,11162,23685,10090,23723,5439,6420,17880,3744,9419,23952,29561,11277,2952,23467,14578,19758,23165,21908,6899,14281,14999,25550,31695,6260,31743,3480,5866,19895,5132,14944,22876,9739,23054,14452,19919,9609,22378,15632,4767,13289,29159,14284,23123,2563,18803,29918,7271,16407,2638,2892,16005,8894,22893,7279,2622,18378,24757,3830,24746,1958,554,30752,31379,27242,1075,19821,20990,21266,3547,4969,30147,7533,17140,26377,17889,714,2427,29131,20223,1825,28975,22225,17256,2239,31706,13981,19612,15775,11830,1541,17618,18547,23652,2809,12734,31173,15671,28648,1487,31749,8928,18771,12859,30436,5512,8471,24521,29283,22156,1907,15951,28393,16373,22921,5749,11095,13495,29140,28302,19861,208,5214,9436,2006,20117,11599,16648,14331,13642,19482,17810,6545,27643,21241,25663,10204,9365,19587,29493,23234,22227,23096,26385,9922,18356,21992,2174,730,29826,1639,17678,19298,345,14393,31540,3713,9335,10853,10318,26679,24590,10189,15641,2673,16864,9406,749,27899,30025,28312,1729,26675,32413,5067,30400,9879,11596,32281,16417,30891,9425,15917,17272,12002,1804,31278,6199,13249,22468,21950,869,31279,9268,2814,31411,12037,7454,23711,25824,8950,21242,7041,3472,1513,32676,23769,19652,28045,16760,21660,24884,9820,27202,12193,17254,8672,25684,3638,869,18353,3206,20267,5431,8074,27443,3217,17407,29599,6422,18362,2424,20651,6456,7467,9649,2383,12444,15758,12093,10802,11625,10921,29256,807,29832,23815,4077,29841,18326,22739,19120,3816,22842,7471,5743,975,1610,28164,6836,29459,6362,22820,21622,31164,19235,4233,3364,19735,2544,14870,28994,9925,24311,22834,6727,25051,23777,4624,11008,3628,31906,20332,11272,16450,32009,31375,30575,31751,1723,8673,773,17046,8922,15401,4439,21572,22066,30859,14338,25599,20450,17108,27296,3455,26511,9194,12271,8,744,13459,9964,29752,17155,3207,30319,18796,11547,5171,31921,20626,6424,4379,18012,26637,14097,11947,1003,8910,18394,17921,2985,25685,23052 };
  9.  
  10. void CEsp::Init()
  11. {
  12. BombCarrier = nullptr;
  13. }
  14.  
  15. // Yeah dude we're defo gunna do some sick moves for the esp yeah
  16. void CEsp::Move(CUserCmd *pCmd,bool &bSendPacket)
  17. {
  18.  
  19. }
  20.  
  21. // Main ESP Drawing loop
  22. void CEsp::Draw()
  23. {
  24.  
  25. IClientEntity *pLocal = hackManager.pLocal();
  26.  
  27. if (Menu::Window.VisualsTab.FiltersDead.GetState())
  28. {
  29. if (pLocal->IsAlive())
  30. {
  31. //Nothing :)
  32. }
  33. else
  34. {
  35. // Loop through all active entitys
  36. for (int i = 0; i < Interfaces::EntList->GetHighestEntityIndex(); i++)
  37. {
  38. // Get the entity
  39. IClientEntity *pEntity = Interfaces::EntList->GetClientEntity(i);
  40. player_info_t pinfo;
  41.  
  42. // The entity isn't some laggy peice of shit or something
  43. if (pEntity && pEntity != pLocal && !pEntity->IsDormant())
  44. {
  45. // Radar
  46. if (Menu::Window.VisualsTab.OtherRadar.GetState())
  47. {
  48. DWORD m_bSpotted = NetVar.GetNetVar(0x839EB159);
  49. *(char*)((DWORD)(pEntity)+m_bSpotted) = 1;
  50. }
  51.  
  52. // Is it a player?!
  53. if (Menu::Window.VisualsTab.FiltersPlayers.GetState() && Interfaces::Engine->GetPlayerInfo(i, &pinfo) && pEntity->IsAlive())
  54. {
  55. DrawPlayer(pEntity, pinfo);
  56. }
  57.  
  58. // ~ Other ESP's here (items and shit) ~ //
  59. ClientClass* cClass = (ClientClass*)pEntity->GetClientClass();
  60.  
  61. // Dropped weapons
  62. 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)))
  63. {
  64. DrawDrop(pEntity, cClass);
  65. }
  66.  
  67. // If entity is the bomb
  68. if (Menu::Window.VisualsTab.FiltersC4.GetState())
  69. {
  70. if (cClass->m_ClassID == (int)CSGOClassID::CPlantedC4)
  71. DrawBombPlanted(pEntity, cClass);
  72.  
  73. if (cClass->m_ClassID == (int)CSGOClassID::CC4)
  74. DrawBomb(pEntity, cClass);
  75. }
  76.  
  77. // If entity is a chicken
  78. if (Menu::Window.VisualsTab.FiltersChickens.GetState())
  79. {
  80. if (cClass->m_ClassID == (int)CSGOClassID::CChicken)
  81. DrawChicken(pEntity, cClass);
  82. }
  83. }
  84. }
  85. }
  86. }
  87. else
  88. {
  89. // Loop through all active entitys
  90. for (int i = 0; i < Interfaces::EntList->GetHighestEntityIndex(); i++)
  91. {
  92. // Get the entity
  93. IClientEntity *pEntity = Interfaces::EntList->GetClientEntity(i);
  94. player_info_t pinfo;
  95.  
  96. // The entity isn't some laggy peice of shit or something
  97. if (pEntity && pEntity != pLocal && !pEntity->IsDormant())
  98. {
  99. // Radar
  100. if (Menu::Window.VisualsTab.OtherRadar.GetState())
  101. {
  102. DWORD m_bSpotted = NetVar.GetNetVar(0x839EB159);
  103. *(char*)((DWORD)(pEntity)+m_bSpotted) = 1;
  104. }
  105.  
  106. // Is it a player?!
  107. if (Menu::Window.VisualsTab.FiltersPlayers.GetState() && Interfaces::Engine->GetPlayerInfo(i, &pinfo) && pEntity->IsAlive())
  108. {
  109. DrawPlayer(pEntity, pinfo);
  110. }
  111.  
  112. // ~ Other ESP's here (items and shit) ~ //
  113. ClientClass* cClass = (ClientClass*)pEntity->GetClientClass();
  114.  
  115. // Dropped weapons
  116. 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)))
  117. {
  118. DrawDrop(pEntity, cClass);
  119. }
  120.  
  121. // If entity is the bomb
  122. if (Menu::Window.VisualsTab.FiltersC4.GetState())
  123. {
  124. if (cClass->m_ClassID == (int)CSGOClassID::CPlantedC4)
  125. DrawBombPlanted(pEntity, cClass);
  126.  
  127. if (cClass->m_ClassID == (int)CSGOClassID::CC4)
  128. DrawBomb(pEntity, cClass);
  129. }
  130.  
  131. // If entity is a chicken
  132. if (Menu::Window.VisualsTab.FiltersChickens.GetState())
  133. {
  134. if (cClass->m_ClassID == (int)CSGOClassID::CChicken)
  135. DrawChicken(pEntity, cClass);
  136. }
  137. }
  138. }
  139. }
  140.  
  141. //Those are good like this, no edit needed :)
  142. if (Menu::Window.MiscTab.OtherSpectators.GetState())
  143. {
  144. SpecList();
  145. }
  146. // Anti Flash
  147. if (Menu::Window.VisualsTab.OtherNoFlash.GetState())
  148. {
  149. DWORD m_flFlashMaxAlpha = NetVar.GetNetVar(0xFE79FB98);
  150. *(float*)((DWORD)pLocal + m_flFlashMaxAlpha) = Menu::Window.VisualsTab.OtherNoFlashVal.GetValue();
  151. }
  152. }
  153.  
  154. void CEsp::NoSky()
  155. {
  156.  
  157. }
  158. void CEsp::DoFOV()
  159. {
  160. float FoV;
  161. std::vector<int> HitBoxesToScan;
  162. IClientEntity* pLocal = hackManager.pLocal();
  163. CBaseCombatWeapon* pWeapon = (CBaseCombatWeapon*)Interfaces::EntList->GetClientEntityFromHandle(pLocal->GetActiveWeaponHandle());
  164.  
  165. if (!pWeapon)
  166. return;
  167.  
  168. if (GameUtils::IsPistol(pWeapon))
  169. {
  170. FoV = Menu::Window.LegitBotTab.WeaponPistFoV.GetValue();
  171.  
  172. }
  173. else if (GameUtils::IsSniper(pWeapon))
  174. {
  175. FoV = Menu::Window.LegitBotTab.WeaponSnipFoV.GetValue();
  176.  
  177. }
  178. else
  179. {
  180. FoV = Menu::Window.LegitBotTab.WeaponMainFoV.GetValue();
  181. }
  182.  
  183.  
  184.  
  185. int w, h;
  186. Interfaces::Engine->GetScreenSize(w, h);
  187. float CenterX = (float)w / 2;
  188. float CenterY = (float)h / 2;
  189.  
  190.  
  191. Offsets::VMT::Surface_DrawOutlinedCircle;//(CenterX, CenterY, FoV, 360, 0, 255, 0, 255); //(int x, int y, int radius, int segments, int r, int g, int b, int a)
  192. }
  193. void CEsp::SpecList()
  194. {
  195.  
  196. IClientEntity *pLocal = hackManager.pLocal();
  197.  
  198. RECT scrn = Render::GetViewport();
  199. int AC = 0;
  200.  
  201.  
  202. // Loop through all active entitys
  203. for (int i = 0; i < Interfaces::EntList->GetHighestEntityIndex(); i++)
  204. {
  205. // Get the entity
  206. IClientEntity *pEntity = Interfaces::EntList->GetClientEntity(i);
  207. player_info_t pinfo;
  208.  
  209. Render::Text(scrn.left, (scrn.bottom / 2 - 16), Color(0, 150, 255, 255), Render::Fonts::ESP, "Spectators:");
  210.  
  211.  
  212. // The entity isn't some laggy peice of shit or something
  213. if (pEntity && pEntity != pLocal)
  214. {
  215.  
  216. if (Interfaces::Engine->GetPlayerInfo(i, &pinfo) && !pEntity->IsAlive() && !pEntity->IsDormant())
  217. {
  218.  
  219. HANDLE obs = pEntity->GetObserverTargetHandle();
  220.  
  221. if (obs)
  222. {
  223. IClientEntity *pTarget = Interfaces::EntList->GetClientEntityFromHandle(obs);
  224. player_info_t pinfo2;
  225. if (pTarget)
  226. {
  227. if (Interfaces::Engine->GetPlayerInfo(pTarget->GetIndex(), &pinfo2))
  228. {
  229. char buf[255]; sprintf_s(buf, "%s", pinfo.name, pinfo2.name);
  230. RECT TextSize = Render::GetTextSize(Render::Fonts::ESP, buf);
  231. //Render::Clear(scrn.left, (scrn.bottom / 3) + (16 * AC), 260, 16, Color(0, 0, 0, 140));
  232. //Render::Text(scrn.left, (scrn.bottom / 2 - 16), pTarget->GetIndex() == pLocal->GetIndex() ? Color(240, 70, 80, 255) : Color(255, 255, 255, 0), Render::Fonts::ESP, "Spectating me list:");
  233. Render::Text(scrn.left , (scrn.bottom / 2) + (16 * AC), pTarget->GetIndex() == pLocal->GetIndex() ? Color(240, 70, 80, 255) : Color(255, 255, 255, 0), Render::Fonts::ESP, buf);
  234. AC++;
  235. }
  236. }
  237. }
  238. }
  239. }
  240. }
  241.  
  242. //Render::Outline(scrn.right - 261, (scrn.bottom / 2) - 1, 262, (16 * AC) + 2, Color(23, 23, 23, 255));
  243. //Render::Outline(scrn.right - 260, (scrn.bottom / 2), 260, (16 * AC), Color(90, 90, 90, 255));
  244. }
  245.  
  246. // Yeah m8
  247.  
  248. //-----------------------------------------------------------------------------
  249. // Purpose: draws the zoom effect
  250. //-----------------------------------------------------------------------------
  251.  
  252.  
  253. void CEsp::DrawPlayer(IClientEntity* pEntity, player_info_t pinfo)
  254. {
  255. //Here is our very advanced system yay
  256.  
  257. ESPBox Box;
  258. Color Color;
  259.  
  260. // Show own team false? well gtfo teammate lol
  261. if (Menu::Window.VisualsTab.FiltersEnemiesOnly.GetState() && (pEntity->GetTeamNum() == hackManager.pLocal()->GetTeamNum()))
  262. return;
  263.  
  264. if (GetBox(pEntity, Box))
  265. {
  266. Color = GetPlayerColor(pEntity);
  267.  
  268. /*if (Menu::Window.VisualsTab.OptionsGlow.GetState())
  269. {
  270. int TeamNum = pEntity->GetTeamNum();
  271.  
  272. if (TeamNum == TEAM_CS_T)
  273. {
  274. DrawGlow(pEntity, 255, 0, 0, 160);
  275. }
  276. else if (TeamNum == TEAM_CS_CT)
  277. {
  278. DrawGlow(pEntity, 0, 0, 255, 160);
  279. }
  280. }*/
  281.  
  282. if (Menu::Window.VisualsTab.OptionsBox.GetState())
  283. DrawBox(Box, Color);
  284.  
  285. if (Menu::Window.VisualsTab.OptionsName.GetState())
  286. DrawName(pinfo, Box, pEntity);
  287.  
  288. if (Menu::Window.VisualsTab.OptionsHealth.GetState())
  289. DrawHealth2(pEntity, Box);
  290.  
  291.  
  292.  
  293. if (Menu::Window.VisualsTab.OptionsInfo.GetState() || Menu::Window.VisualsTab.OptionsWeapon.GetState())
  294. DrawInfo(pEntity, Box);
  295.  
  296. if (Menu::Window.VisualsTab.OptionsAimSpot.GetState())
  297. DrawCross(pEntity);
  298.  
  299. if (Menu::Window.VisualsTab.OptionsSkeleton.GetState())
  300. DrawSkeleton(pEntity);
  301.  
  302. if (Menu::Window.VisualsTab.OtherGlow.GetState())
  303. {
  304. bool IsVis;
  305. float r;
  306. float b;
  307. float g;
  308. for (int i = 0; i < Interfaces::EntList->GetHighestEntityIndex(); i++)
  309. {
  310. IClientEntity *pEntity = Interfaces::EntList->GetClientEntity(i);
  311. }
  312. if (GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Chest) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Head) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Neck) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::NeckLower) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Pelvis) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Chest) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::LeftFoot) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::LeftHand) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::LeftLowerArm) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::LeftShin) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::LeftThigh) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::LeftUpperArm) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::LowerChest) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::RightFoot) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::RightHand) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::RightLowerArm) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::RightShin) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::RightThigh) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::RightUpperArm))
  313. {
  314. IsVis = true;
  315. }
  316. else
  317. {
  318. IsVis = false;
  319. }
  320.  
  321. int TeamNum = pEntity->GetTeamNum();
  322. if (TeamNum = TEAM_CS_T)
  323. {
  324. if (IsVis = true)
  325. {
  326. r = Menu::Window.ColorTab.TVisColorR.GetValue();
  327. g = Menu::Window.ColorTab.TVisColorG.GetValue();
  328. b = Menu::Window.ColorTab.TVisColorB.GetValue();
  329.  
  330. }
  331. else
  332. {
  333. r = Menu::Window.ColorTab.TNVisColorR.GetValue();
  334. g = Menu::Window.ColorTab.TNVisColorG.GetValue();
  335. b = Menu::Window.ColorTab.TNVisColorB.GetValue();
  336.  
  337. }
  338. }
  339. else
  340. {
  341. if (IsVis = true)
  342. {
  343. r = Menu::Window.ColorTab.CTVisColorR.GetValue();
  344. g = Menu::Window.ColorTab.CTVisColorG.GetValue();
  345. b = Menu::Window.ColorTab.CTVisColorB.GetValue();
  346.  
  347. }
  348. else
  349. {
  350. r = Menu::Window.ColorTab.CTNVisColorR.GetValue();
  351. g = Menu::Window.ColorTab.CTNVisColorG.GetValue();
  352. b = Menu::Window.ColorTab.CTNVisColorB.GetValue();
  353.  
  354. }
  355. }
  356.  
  357. CEsp::DrawGlow(pEntity, r, g, b, 255);
  358.  
  359. }
  360. }
  361. }
  362. // glow shit
  363. struct Glowobject
  364. {
  365. IClientEntity* pEntity;
  366. Vector Color;
  367. float Alpha;
  368. byte PAD[16];
  369. bool RenderWhenOccluded;
  370. bool RenderWhenUnOccluded;
  371. bool FullBloomRender;
  372. byte PAD2[17];
  373. };
  374. void CEsp::DrawGlow(IClientEntity *pEntity, int r, int g, int b, int a)
  375. {
  376. static uintptr_t Module = (uintptr_t)GetModuleHandle("client.dll");
  377.  
  378. Glowobject* GlowManager = *(Glowobject**)(Module + 0x4FA23C8);
  379.  
  380. if (GlowManager)
  381. {
  382. Glowobject* GlowObject = &GlowManager[pEntity->GetGlowIndex()];
  383.  
  384. if (GlowObject)
  385. {
  386. GlowObject->RenderWhenOccluded = 1;
  387. GlowObject->RenderWhenUnOccluded = 0;
  388.  
  389. float glowr = r;
  390. float glowg = g;
  391. float glowb = b;
  392. float glowa = (1);
  393. GlowObject->Color = Vector(r, g, b);
  394. GlowObject->Alpha = a;
  395. }
  396. }
  397. }
  398.  
  399. // Gets the 2D bounding box for the entity
  400. // Returns false on failure nigga don't fail me
  401. bool CEsp::GetBox(IClientEntity* pEntity, CEsp::ESPBox &result)
  402. {
  403. // Variables
  404. Vector vOrigin, min, max, sMin, sMax, sOrigin,
  405. flb, brt, blb, frt, frb, brb, blt, flt;
  406. float left, top, right, bottom;
  407.  
  408. // Get the locations
  409. vOrigin = pEntity->GetOrigin();
  410. min = pEntity->collisionProperty()->GetMins() + vOrigin;
  411. max = pEntity->collisionProperty()->GetMaxs() + vOrigin;
  412.  
  413. // Points of a 3d bounding box
  414. Vector points[] = { Vector(min.x, min.y, min.z),
  415. Vector(min.x, max.y, min.z),
  416. Vector(max.x, max.y, min.z),
  417. Vector(max.x, min.y, min.z),
  418. Vector(max.x, max.y, max.z),
  419. Vector(min.x, max.y, max.z),
  420. Vector(min.x, min.y, max.z),
  421. Vector(max.x, min.y, max.z) };
  422.  
  423. // Get screen positions
  424. if (!Render::WorldToScreen(points[3], flb) || !Render::WorldToScreen(points[5], brt)
  425. || !Render::WorldToScreen(points[0], blb) || !Render::WorldToScreen(points[4], frt)
  426. || !Render::WorldToScreen(points[2], frb) || !Render::WorldToScreen(points[1], brb)
  427. || !Render::WorldToScreen(points[6], blt) || !Render::WorldToScreen(points[7], flt))
  428. return false;
  429.  
  430. // Put them in an array (maybe start them off in one later for speed?)
  431. Vector arr[] = { flb, brt, blb, frt, frb, brb, blt, flt };
  432.  
  433. // Init this shit
  434. left = flb.x;
  435. top = flb.y;
  436. right = flb.x;
  437. bottom = flb.y;
  438.  
  439. // Find the bounding corners for our box
  440. for (int i = 1; i < 8; i++)
  441. {
  442. if (left > arr[i].x)
  443. left = arr[i].x;
  444. if (bottom < arr[i].y)
  445. bottom = arr[i].y;
  446. if (right < arr[i].x)
  447. right = arr[i].x;
  448. if (top > arr[i].y)
  449. top = arr[i].y;
  450. }
  451.  
  452. // Width / height
  453. result.x = left;
  454. result.y = top;
  455. result.w = right - left;
  456. result.h = bottom - top;
  457.  
  458. return true;
  459. }
  460.  
  461. // Get an entities color depending on team and vis ect
  462. Color CEsp::GetPlayerColor(IClientEntity* pEntity)
  463. {
  464. //#define hitboxes (int)CSGOHitboxID::Head, (int)CSGOHitboxID::Neck, (int)CSGOHitboxID::NeckLower, (int)CSGOHitboxID::Stomach, (int)CSGOHitboxID::Pelvis, (int)CSGOHitboxID::UpperChest,(int)CSGOHitboxID::Chest, (int)CSGOHitboxID::LowerChest,(int)CSGOHitboxID::LeftUpperArm, (int)CSGOHitboxID::RightUpperArm, (int)CSGOHitboxID::LeftThigh, (int)CSGOHitboxID::RightThigh, (int)CSGOHitboxID::LeftHand, (int)CSGOHitboxID::RightHand, (int)CSGOHitboxID::LeftFoot, (int)CSGOHitboxID::RightFoot, (int)CSGOHitboxID::LeftShin, (int)CSGOHitboxID::RightShin, (int)CSGOHitboxID::LeftLowerArm, (int)CSGOHitboxID::RightLowerArm
  465. int TeamNum = pEntity->GetTeamNum();
  466. bool IsVis;
  467. if (GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Chest) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Head) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Neck) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::NeckLower) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Pelvis) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Chest) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::LeftFoot) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::LeftHand) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::LeftLowerArm) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::LeftShin) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::LeftThigh) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::LeftUpperArm) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::LowerChest) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::RightFoot) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::RightHand) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::RightLowerArm) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::RightShin) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::RightThigh) || GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::RightUpperArm))
  468. {
  469. IsVis = true;
  470. }
  471. else
  472. {
  473. IsVis = false;
  474. }
  475.  
  476. Color color;
  477.  
  478. if (TeamNum == TEAM_CS_T)
  479. {
  480. if (IsVis)
  481. color = Color(Menu::Window.ColorTab.TVisColorR.GetValue(), Menu::Window.ColorTab.TVisColorG.GetValue(), Menu::Window.ColorTab.TVisColorB.GetValue(), 255);
  482. else
  483. {
  484.  
  485. color = Color(Menu::Window.ColorTab.TNVisColorR.GetValue(), Menu::Window.ColorTab.TNVisColorG.GetValue(), Menu::Window.ColorTab.TNVisColorB.GetValue(), 255);
  486.  
  487.  
  488.  
  489. }
  490.  
  491. }
  492. else
  493. {
  494. if (IsVis)
  495. color = Color(Menu::Window.ColorTab.CTVisColorR.GetValue(), Menu::Window.ColorTab.CTVisColorG.GetValue(), Menu::Window.ColorTab.CTVisColorB.GetValue(), 255);
  496. else
  497. color = Color(Menu::Window.ColorTab.CTNVisColorR.GetValue(), Menu::Window.ColorTab.CTNVisColorG.GetValue(), Menu::Window.ColorTab.CTNVisColorB.GetValue(), 255);
  498. }
  499.  
  500.  
  501. return color;
  502. }
  503.  
  504. // 2D Esp box
  505. void CEsp::DrawBox(CEsp::ESPBox size, Color color)
  506. {
  507. if (Menu::Window.VisualsTab.OptionsBoxFill.GetState())
  508. {
  509. //Render::Clear(size.x, size.y, size.w, size.h, color);
  510. if (!Menu::Window.VisualsTab.OptionsBoxFillColor.GetState())
  511. {
  512. Render::Clear(size.x - 1, size.y - 1, size.w + 2, size.h + 2, Color(10, 10, 10, 100));
  513. Render::Clear(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(10, 10, 10, 100));
  514. }
  515. else
  516. {
  517. Render::Clear(size.x - 1, size.y - 1, size.w + 2, size.h + 2, Color(10, 10, 10, 150));
  518. Render::Clear(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(10, 10, 10, 150));
  519. }
  520. }
  521. //if (PlayerBoxes->GetStringIndex() == 1)
  522. //{
  523. // Full Box
  524. //Render::Clear(size.x, size.y, size.w, size.h, color);
  525. //Render::Clear(size.x - 1, size.y - 1, size.w + 2, size.h + 2, Color(10, 10, 10, 150));
  526. //Render::Clear(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(10, 10, 10, 150));
  527. //}
  528. //else
  529. {
  530. // Corner Box
  531. //bool IsVis = GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Chest); da dream
  532.  
  533. int VertLine = (((float)size.w) * (1.0f));
  534. int HorzLine = (((float)size.h) * (1.0f));
  535.  
  536. Render::Clear(size.x, size.y - 1, VertLine, 1, Color(10, 10, 10, 150));
  537. Render::Clear(size.x + size.w - VertLine, size.y - 1, VertLine, 1, Color(10, 10, 10, 150));
  538. Render::Clear(size.x, size.y + size.h - 1, VertLine, 1, Color(10, 10, 10, 150));
  539. Render::Clear(size.x + size.w - VertLine, size.y + size.h - 1, VertLine, 1, Color(10, 10, 10, 150));
  540.  
  541. Render::Clear(size.x - 1, size.y, 1, HorzLine, Color(10, 10, 10, 150));
  542. Render::Clear(size.x - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(10, 10, 10, 150));
  543. Render::Clear(size.x + size.w - 1, size.y, 1, HorzLine, Color(10, 10, 10, 150));
  544. Render::Clear(size.x + size.w - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(10, 10, 10, 150));
  545.  
  546. Render::Clear(size.x, size.y, VertLine, 1, color);
  547. Render::Clear(size.x + size.w - VertLine, size.y, VertLine, 1, color);
  548. Render::Clear(size.x, size.y + size.h, VertLine, 1, color);
  549. Render::Clear(size.x + size.w - VertLine, size.y + size.h, VertLine, 1, color);
  550.  
  551. Render::Clear(size.x, size.y, 1, HorzLine, color);
  552. Render::Clear(size.x, size.y + size.h - HorzLine, 1, HorzLine, color);
  553. Render::Clear(size.x + size.w, size.y, 1, HorzLine, color);
  554. Render::Clear(size.x + size.w, size.y + size.h - HorzLine, 1, HorzLine, color);
  555.  
  556. // Color color23(0, 0, 0);
  557.  
  558. // Render::Clear(size.x + size.y ,size.w, size.h, Color(0,0,0,40));
  559. }
  560. }
  561.  
  562.  
  563. // Unicode Conversions
  564. static wchar_t* CharToWideChar(const char* text)
  565. {
  566. size_t size = strlen(text) + 1;
  567. wchar_t* wa = new wchar_t[size];
  568. mbstowcs_s(NULL, wa, size/4, text, size);
  569. return wa;
  570. }
  571.  
  572. // Player name
  573. void CEsp::DrawName(player_info_t pinfo, CEsp::ESPBox size, IClientEntity* pEntity)
  574. {
  575.  
  576. RECT nameSize = Render::GetTextSize(Render::Fonts::ESP, pinfo.name);
  577. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y - 16,Color(255, 255, 255, 255), Render::Fonts::ESP, pinfo.name);
  578. if (Menu::Window.VisualsTab.OptionsHealth.GetState())
  579. {
  580. float HealthValue = pEntity->GetHealth();
  581. float HealthPerc = HealthValue / 100.f;
  582. char faszommeretejobbra_cmbe[64];
  583. sprintf_s(faszommeretejobbra_cmbe, "HP: %f", HealthPerc);
  584. Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y - 32, Color(255, 255, 255, 255), Render::Fonts::ESP, faszommeretejobbra_cmbe);
  585. }
  586.  
  587. }
  588.  
  589. // Draw a health bar. For Tf2 when a bar is bigger than max health a second bar is displayed
  590. void CEsp::DrawHealth(IClientEntity* pEntity, CEsp::ESPBox size)
  591. {
  592. ESPBox HealthBar = size;
  593. HealthBar.y += (HealthBar.h + 6);
  594. HealthBar.h = 4;
  595.  
  596. float HealthValue = pEntity->GetHealth();
  597. float HealthPerc = HealthValue / 100.f;
  598. float Width = (size.w * HealthPerc);
  599. HealthBar.w = Width;
  600.  
  601. // -- Main Bar -- //
  602.  
  603. Vertex_t Verts[4];
  604. Verts[0].Init(Vector2D(HealthBar.x, HealthBar.y));
  605. Verts[1].Init(Vector2D(HealthBar.x + size.w, HealthBar.y));
  606. Verts[2].Init(Vector2D(HealthBar.x + size.w, HealthBar.y + 5));
  607. Verts[3].Init(Vector2D(HealthBar.x, HealthBar.y + 5));
  608.  
  609. // Verts[1].Init(Vector2D(HealthBar.x + size.w + 5, HealthBar.y));
  610. //Verts[2].Init(Vector2D(HealthBar.x + size.w, HealthBar.y + 5));
  611. //Verts[3].Init(Vector2D(HealthBar.x - 5, HealthBar.y + 5));
  612. Render::PolygonOutline(4, Verts, Color(10, 10, 10, 255), Color(255, 255, 255, 170));
  613.  
  614. Vertex_t Verts2[4];
  615. Verts2[0].Init(Vector2D(HealthBar.x, HealthBar.y + 1));
  616. Verts2[1].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 1));
  617. Verts2[2].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 5));
  618. Verts2[3].Init(Vector2D(HealthBar.x, HealthBar.y + 5));
  619.  
  620. /*
  621. Verts2[1].Init(Vector2D(HealthBar.x + HealthBar.w + 4, HealthBar.y + 1));
  622. Verts2[2].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 5));
  623. Verts2[3].Init(Vector2D(HealthBar.x - 4, HealthBar.y + 5));
  624. */
  625.  
  626. Color colorxd(0, 255, 0);
  627. Color colorxd2(255, 255, 0);
  628. Color colorxd3(255, 119, 0);
  629. Color colorxd4(255, 0, 0);
  630.  
  631.  
  632. Render::Polygon(4, Verts2, GetPlayerColor(pEntity));
  633.  
  634.  
  635.  
  636.  
  637. Verts2[0].Init(Vector2D(HealthBar.x + 1, HealthBar.y + 1));
  638.  
  639. Verts2[1].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 1));
  640. Verts2[2].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 2));
  641. Verts2[3].Init(Vector2D(HealthBar.x , HealthBar.y + 2));
  642. /*Verts2[1].Init(Vector2D(HealthBar.x + HealthBar.w + 2, HealthBar.y + 1));
  643. Verts2[2].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 2));
  644. Verts2[3].Init(Vector2D(HealthBar.x - 2, HealthBar.y + 2));*/
  645.  
  646. Render::Polygon(4, Verts2, Color(255, 255, 255, 40));
  647.  
  648. }
  649.  
  650. // Cleans the internal class name up to something human readable and nice
  651. std::string CleanItemName(std::string name)
  652. {
  653. std::string Name = name;
  654. // Tidy up the weapon Name
  655. if (Name[0] == 'C')
  656. Name.erase(Name.begin());
  657.  
  658. // Remove the word Weapon
  659. auto startOfWeap = Name.find("Weapon");
  660. if (startOfWeap != std::string::npos)
  661. Name.erase(Name.begin() + startOfWeap, Name.begin() + startOfWeap + 6);
  662.  
  663. return Name;
  664. }
  665.  
  666. // Anything else: weapons, class state? idk
  667. void CEsp::DrawInfo(IClientEntity* pEntity, CEsp::ESPBox size)
  668. {
  669. std::vector<std::string> Info;
  670.  
  671. // Player Weapon ESP
  672. IClientEntity* pWeapon = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)pEntity->GetActiveWeaponHandle());
  673. if (Menu::Window.VisualsTab.OptionsWeapon.GetState() && pWeapon)
  674. {
  675. ClientClass* cClass = (ClientClass*)pWeapon->GetClientClass();
  676. if (cClass)
  677. {
  678. // Draw it
  679. Info.push_back(CleanItemName(cClass->m_pNetworkName));
  680. }
  681. }
  682.  
  683. // Bomb Carrier
  684. if (Menu::Window.VisualsTab.OptionsInfo.GetState() && pEntity == BombCarrier)
  685. {
  686. Info.push_back("C4 Carrier");
  687. }
  688.  
  689.  
  690. static RECT Size = Render::GetTextSize(Render::Fonts::Default, "Hi");
  691. int i = 0;
  692. for (auto Text : Info)
  693. {
  694.  
  695.  
  696. Render::Text(size.x + size.w + 3, size.y + (i*(Size.bottom + 2)), Color(255, 255, 255, 255), Render::Fonts::ESP, Text.c_str());
  697.  
  698.  
  699. i++;
  700. }
  701. }
  702.  
  703. void CEsp::DrawHealth2(IClientEntity* pEntity, CEsp::ESPBox size)
  704. {
  705. ESPBox HealthBar = size;
  706. HealthBar.y += (HealthBar.h + 20);
  707. HealthBar.h = 4;
  708.  
  709. float HealthValue = pEntity->GetHealth();
  710. float HealthPerc = HealthValue / 100.f;
  711. float Width = (size.w * HealthPerc);
  712. HealthBar.w = Width;
  713.  
  714. int health = pEntity->GetHealth();
  715.  
  716. if (health > 100)
  717. health = 100;
  718.  
  719. int r = 255 - health * 2.55;
  720. int g = health * 2.55;
  721.  
  722. int healthBar = size.h / 100 * health;
  723. int healthBarDelta = size.h - healthBar;
  724.  
  725. //int iClampedHealth = pEntity->GetHealth();
  726. // if (iClampedHealth >= 100)
  727. // iClampedHealth = 100;
  728.  
  729. Render::Outline(size.x - 4, size.y + 1, 1, size.h * 0.01 * health, Color(r, g, 0, 255));
  730. Render::Outline(size.x - 5, size.y - 1, 3, size.h + 2, Color(0, 0, 0, 150));
  731. }
  732.  
  733. // Little cross on their heads
  734. void CEsp::DrawCross(IClientEntity* pEntity)
  735. {
  736. Vector cross = pEntity->GetHeadPos(), screen;
  737. static int Scale = 2;
  738. if (Render::WorldToScreen(cross, screen))
  739. {
  740. Render::Clear(screen.x - Scale, screen.y - (Scale * 2), (Scale * 2), (Scale * 4), Color(20, 20, 20, 160));
  741. Render::Clear(screen.x - (Scale * 2), screen.y - Scale, (Scale * 4), (Scale * 2), Color(20, 20, 20, 160));
  742. Render::Clear(screen.x - Scale - 1, screen.y - (Scale * 2) - 1, (Scale * 2) - 2, (Scale * 4) - 2, Color(250, 250, 250, 160));
  743. Render::Clear(screen.x - (Scale * 2) - 1, screen.y - Scale - 1, (Scale * 4) - 2, (Scale * 2) - 2, Color(250, 250, 250, 160));
  744. }
  745. }
  746.  
  747. // Draws a dropped CS:GO Item
  748. void CEsp::DrawDrop(IClientEntity* pEntity, ClientClass* cClass)
  749. {
  750. Vector Box;
  751. CBaseCombatWeapon* Weapon = (CBaseCombatWeapon*)pEntity;
  752. IClientEntity* plr = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)Weapon->GetOwnerHandle());
  753. if (!plr && Render::WorldToScreen(Weapon->GetOrigin(), Box))
  754. {
  755. if (Menu::Window.VisualsTab.OptionsBox.GetState())
  756. {
  757. Render::Outline(Box.x - 2, Box.y - 2, 4, 4, Color(255, 255, 255, 255));
  758. Render::Outline(Box.x - 3, Box.y - 3, 6, 6, Color(10, 10, 10, 150));
  759. }
  760.  
  761. if (Menu::Window.VisualsTab.OptionsInfo.GetState())
  762. {
  763. std::string ItemName = CleanItemName(cClass->m_pNetworkName);
  764. RECT TextSize = Render::GetTextSize(Render::Fonts::ESP, ItemName.c_str());
  765. Render::Text(Box.x - (TextSize.right / 2), Box.y - 16, Color(255, 255, 255, 255), Render::Fonts::ESP, ItemName.c_str());
  766. }
  767. }
  768. }
  769.  
  770. // Draws a chicken
  771. void CEsp::DrawChicken(IClientEntity* pEntity, ClientClass* cClass)
  772. {
  773. ESPBox Box;
  774.  
  775. if (GetBox(pEntity, Box))
  776. {
  777. player_info_t pinfo; strcpy_s(pinfo.name, "Chicken");
  778. if (Menu::Window.VisualsTab.OptionsBox.GetState())
  779. DrawBox(Box, Color(255,255,255,255));
  780.  
  781. if (Menu::Window.VisualsTab.OptionsName.GetState())
  782. DrawName(pinfo, Box, pEntity);
  783. }
  784. }
  785.  
  786. // Draw the planted bomb and timer
  787. void CEsp::DrawBombPlanted(IClientEntity* pEntity, ClientClass* cClass)
  788. {
  789. // Null it out incase bomb has been dropped or planted
  790. BombCarrier = nullptr;
  791.  
  792. Vector vOrig; Vector vScreen;
  793. vOrig = pEntity->GetOrigin();
  794. CCSBomb* Bomb = (CCSBomb*)pEntity;
  795.  
  796. if (Render::WorldToScreen(vOrig, vScreen))
  797. {
  798.  
  799. ESPBox Box;
  800. GetBox(pEntity, Box);
  801. DrawBox(Box, Color(250, 42, 42, 255));
  802. float flBlow = Bomb->GetC4BlowTime();
  803. float TimeRemaining = flBlow - (Interfaces::Globals->interval_per_tick * hackManager.pLocal()->GetTickBase());
  804. float TimeRemaining2;
  805. bool exploded = true;
  806. if (TimeRemaining < 0)
  807. {
  808. !exploded;
  809.  
  810. TimeRemaining2 = 0;
  811. }
  812. else
  813. {
  814. exploded = true;
  815. TimeRemaining2 = TimeRemaining;
  816. }
  817. char buffer[64];
  818. if (exploded)
  819. {
  820. sprintf_s(buffer, "Bomb: %.1f", TimeRemaining2);
  821. }
  822. else
  823. {
  824. sprintf_s(buffer, "Bomb Undefusable", TimeRemaining2);
  825. }
  826. Render::Text(vScreen.x, vScreen.y, Color(0, 255, 50, 255), Render::Fonts::ESP, buffer);
  827. }
  828. }
  829.  
  830. // Draw the bomb if it's dropped, or store the player who's carrying
  831. void CEsp::DrawBomb(IClientEntity* pEntity, ClientClass* cClass)
  832. {
  833. // Null it out incase bomb has been dropped or planted
  834. BombCarrier = nullptr;
  835. CBaseCombatWeapon *BombWeapon = (CBaseCombatWeapon *)pEntity;
  836. Vector vOrig; Vector vScreen;
  837. vOrig = pEntity->GetOrigin();
  838. bool adopted = true;
  839. HANDLE parent = BombWeapon->GetOwnerHandle();
  840. if (parent || (vOrig.x == 0 && vOrig.y == 0 && vOrig.z == 0))
  841. {
  842. IClientEntity* pParentEnt = (Interfaces::EntList->GetClientEntityFromHandle(parent));
  843. if (pParentEnt && pParentEnt->IsAlive())
  844. {
  845. BombCarrier = pParentEnt;
  846. adopted = false;
  847. }
  848. }
  849.  
  850. if (adopted)
  851. {
  852. if (Render::WorldToScreen(vOrig, vScreen))
  853. {
  854. ESPBox Box;
  855. GetBox(pEntity, Box);
  856. DrawBox(Box, Color(112, 230, 20, 255));
  857. Render::Text(vScreen.x, vScreen.y, Color(112, 230, 20, 255), Render::Fonts::ESP, "Bomb");
  858. }
  859. }
  860. }
  861.  
  862. void DrawBoneArray(int* boneNumbers, int amount, IClientEntity* pEntity, Color color)
  863. {
  864. Vector LastBoneScreen;
  865. for (int i = 0; i < amount; i++)
  866. {
  867. Vector Bone = pEntity->GetBonePos(boneNumbers[i]);
  868. Vector BoneScreen;
  869.  
  870. if (Render::WorldToScreen(Bone, BoneScreen))
  871. {
  872. if (i>0)
  873. {
  874. Render::Line(LastBoneScreen.x, LastBoneScreen.y, BoneScreen.x, BoneScreen.y, color);
  875. }
  876. }
  877. LastBoneScreen = BoneScreen;
  878. }
  879. }
  880.  
  881. void DrawBoneTest(IClientEntity *pEntity)
  882. {
  883. for (int i = 0; i < 127; i++)
  884. {
  885. Vector BoneLoc = pEntity->GetBonePos(i);
  886. Vector BoneScreen;
  887. if (Render::WorldToScreen(BoneLoc, BoneScreen))
  888. {
  889. char buf[10];
  890. _itoa_s(i, buf, 10);
  891. Render::Text(BoneScreen.x, BoneScreen.y, Color(255, 255, 255, 180), Render::Fonts::ESP, buf);
  892. }
  893. }
  894. }
  895.  
  896. void CEsp::DrawSkeleton(IClientEntity* pEntity)
  897. {
  898. studiohdr_t* pStudioHdr = Interfaces::ModelInfo->GetStudiomodel(pEntity->GetModel());
  899.  
  900. if (!pStudioHdr)
  901. return;
  902.  
  903. Vector vParent, vChild, sParent, sChild;
  904.  
  905. for (int j = 0; j < pStudioHdr->numbones; j++)
  906. {
  907. mstudiobone_t* pBone = pStudioHdr->GetBone(j);
  908.  
  909. if (pBone && (pBone->flags & BONE_USED_BY_HITBOX) && (pBone->parent != -1))
  910. {
  911. vChild = pEntity->GetBonePos(j);
  912. vParent = pEntity->GetBonePos(pBone->parent);
  913.  
  914. if (Render::WorldToScreen(vParent, sParent) && Render::WorldToScreen(vChild, sChild))
  915. {
  916. Render::Line(sParent[0], sParent[1], sChild[0], sChild[1], Color(255,255,255,255));
  917. }
  918. }
  919. }
  920. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement