Advertisement
Guest User

Untitled

a guest
Oct 21st, 2017
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.99 KB | None | 0 0
  1.  
  2. #include "ESP.h"
  3. #include "Interfaces.h"
  4. #include "Render.h"
  5. #include <ctime>
  6. #include <iostream>
  7. #include <algorithm>
  8. #include "GrenadePrediction.h"
  9. #include "LagComp.h"
  10.  
  11.  
  12.  
  13.  
  14. visuals::visuals()
  15. {
  16. BombCarrier = nullptr;
  17. }
  18.  
  19. int width = 0;
  20. int height = 0;
  21. bool done = false;
  22. void visuals::OnPaintTraverse(C_BaseEntity* local)
  23. {
  24.  
  25.  
  26. for (int i = 0; i < g_EntityList->GetHighestEntityIndex(); i++)
  27. {
  28.  
  29. C_BaseEntity *entity = g_EntityList->GetClientEntity(i);
  30. player_info_t pinfo;
  31. if (entity == local && local->IsAlive() && g_Engine->GetPlayerInfo(g_Engine->GetLocalPlayer(), &pinfo))
  32. {
  33. if (g_Input->m_fCameraInThirdPerson && g_Options.Visuals.Enabled)
  34. {
  35. Vector max = entity->GetCollideable()->OBBMaxs();
  36. Vector pos, pos3D;
  37. Vector top, top3D;
  38. pos3D = entity->GetOrigin();
  39. top3D = pos3D + Vector(0, 0, max.z);
  40.  
  41. if (!g_Render->WorldToScreen(pos3D, pos) || !g_Render->WorldToScreen(top3D, top))
  42. return;
  43.  
  44. float height = (pos.y - top.y);
  45. float width = height / 4.f;
  46. if (g_Options.Visuals.Box)
  47. {
  48. Color color;
  49. color = GetPlayerColor(entity, local);
  50. PlayerBox(top.x, top.y, width, height, color);
  51. }
  52. if (g_Options.Visuals.HP)
  53. DrawHealth(pos, top, local->GetHealth());
  54.  
  55. if (g_Options.Visuals.Name)
  56. g_Render->DrawString2(g_Render->font.ESP, (int)top.x, (int)top.y - 6, Color::White(), FONT_CENTER, pinfo.name);
  57.  
  58. }
  59. }
  60. if (entity && entity != local && !entity->IsDormant())
  61. {
  62. if (g_Engine->GetPlayerInfo(i, &pinfo) && entity->IsAlive())
  63. {
  64. if (g_Options.Legitbot.backtrack)
  65. {
  66. if (local->IsAlive())
  67. {
  68. for (int t = 0; t < 12; ++t)
  69. {
  70. Vector screenbacktrack[64][12];
  71.  
  72. if (headPositions[i][t].simtime && headPositions[i][t].simtime + 1 > local->GetSimulationTime())
  73. {
  74. if (g_Render->WorldToScreen(headPositions[i][t].hitboxPos, screenbacktrack[i][t]))
  75. {
  76.  
  77. g_Surface->DrawSetColor(Color::Red());
  78. g_Surface->DrawOutlinedRect(screenbacktrack[i][t].x, screenbacktrack[i][t].y, screenbacktrack[i][t].x + 2, screenbacktrack[i][t].y + 2);
  79.  
  80. }
  81. }
  82. }
  83. }
  84. else
  85. {
  86. memset(&headPositions[0][0], 0, sizeof(headPositions));
  87. }
  88. }
  89. if (g_Options.Ragebot.FakeLagFix)
  90. {
  91. if (local->IsAlive())
  92. {
  93. Vector screenbacktrack[64];
  94.  
  95. if (backtracking->records[i].tick_count + 12 > g_Globals->tickcount)
  96. {
  97. if (g_Render->WorldToScreen(backtracking->records[i].headPosition, screenbacktrack[i]))
  98. {
  99.  
  100. g_Surface->DrawSetColor(Color::Red());
  101. g_Surface->DrawOutlinedRect(screenbacktrack[i].x, screenbacktrack[i].y, screenbacktrack[i].x + 2, screenbacktrack[i].y + 2);
  102.  
  103. }
  104. }
  105. }
  106. else
  107. {
  108. memset(&backtracking->records[0], 0, sizeof(backtracking->records));
  109. }
  110. }
  111. if (g_Options.Visuals.Enabled && g_Options.Visuals.Filter.Players)
  112. {
  113. if (g_Options.Visuals.DLight)
  114. DLight(local, entity);
  115.  
  116. DrawPlayer(entity, pinfo, local);
  117.  
  118. }
  119.  
  120. }
  121. if (g_Options.Visuals.Enabled)
  122. {
  123. ClientClass* cClass = (ClientClass*)entity->GetClientClass();
  124. if (g_Options.Visuals.WeaponsWorld && cClass->m_ClassID != (int)ClassID::CBaseWeaponWorldModel && ((strstr(cClass->m_pNetworkName, "Weapon") || cClass->m_ClassID == (int)ClassID::CDEagle || cClass->m_ClassID == (int)ClassID::CAK47)))
  125. {
  126. DrawDrop(entity);
  127. }
  128. if (g_Options.Visuals.C4World)
  129. {
  130. if (cClass->m_ClassID == (int)ClassID::CPlantedC4)
  131. DrawBombPlanted(entity, local);
  132. }
  133.  
  134. if (cClass->m_ClassID == (int)ClassID::CC4)
  135. DrawBomb(entity, cClass);
  136. if (g_Options.Visuals.GrenadeESP && strstr(cClass->m_pNetworkName, "Projectile"))
  137. {
  138. DrawThrowable(entity);
  139. }
  140. }
  141. }
  142. }
  143. if (g_Options.Misc.SpecList) SpecList(local);
  144.  
  145. NightMode();
  146. grenade_prediction::instance().Paint();
  147.  
  148. if (g_Options.Visuals.SpreadCrosshair)
  149. {
  150. g_Engine->GetScreenSize(width, height);
  151. if (local && local->IsAlive())
  152. {
  153. static Vector ViewAngles;
  154. g_Engine->GetViewAngles(ViewAngles);
  155. ViewAngles += local->localPlayerExclusive()->GetAimPunchAngle() * 2.f;
  156.  
  157. static Vector fowardVec;
  158. AngleVectors(ViewAngles, &fowardVec);
  159. fowardVec *= 10000;
  160.  
  161. // Get ray start / end
  162. Vector start = local->GetOrigin() + local->GetViewOffset();
  163. Vector end = start + fowardVec, endScreen;
  164.  
  165. CBaseCombatWeapon* pWeapon = (CBaseCombatWeapon*)g_EntityList->GetClientEntityFromHandle(local->GetActiveWeaponHandle());
  166. float cone = pWeapon->GetSpread() + pWeapon->GetInaccuracy();
  167. if (cone > 0.0f)
  168. {
  169. if (cone < 0.01f) cone = 0.01f;
  170. float size = (cone * height) * 0.7f;
  171. Color color(255, 0, 0, 100);
  172.  
  173. if (g_Render->WorldToScreen(end, endScreen))
  174. {
  175. g_Render->OutlineCircle(endScreen.x, endScreen.y, (int)size, 48, color);
  176. }
  177. }
  178. }
  179. }
  180.  
  181. }
  182.  
  183. std::string CleanItemName(std::string name)
  184. {
  185. std::string Name = name;
  186. // Tidy up the weapon Name
  187. if (Name[0] == 'C')
  188. Name.erase(Name.begin());
  189.  
  190. // Remove the word Weapon
  191. auto startOfWeap = Name.find("Weapon");
  192. if (startOfWeap != std::string::npos)
  193. Name.erase(Name.begin() + startOfWeap, Name.begin() + startOfWeap + 6);
  194.  
  195. return Name;
  196. }
  197.  
  198. wchar_t* CharToWideChar(const char* text)
  199. {
  200. size_t size = strlen(text) + 1;
  201. wchar_t* wa = new wchar_t[size];
  202. mbstowcs_s(NULL, wa, size / 4, text, size);
  203. return wa;
  204. }
  205.  
  206.  
  207. C_CSPlayerResource* playerresources;
  208. void visuals::DrawPlayer(C_BaseEntity* entity, player_info_t pinfo, C_BaseEntity* local)
  209. {
  210.  
  211. Vector max = entity->GetCollideable()->OBBMaxs();
  212. Vector pos, pos3D;
  213. Vector top, top3D;
  214. pos3D = entity->GetOrigin();
  215. top3D = pos3D + Vector(0, 0, max.z);
  216.  
  217. if (!g_Render->WorldToScreen(pos3D, pos) || !g_Render->WorldToScreen(top3D, top))
  218. return;
  219.  
  220. float height = (pos.y - top.y);
  221. float width = height / 4.f;
  222.  
  223. Color color;
  224.  
  225. if (g_Options.Visuals.Filter.EnemyOnly && (entity->GetTeamNum() == local->GetTeamNum()))
  226. return;
  227. color = GetPlayerColor(entity, local);
  228.  
  229. if (g_Options.Visuals.Box)
  230. PlayerBox(top.x, top.y, width, height, color);
  231.  
  232. if (g_Options.Visuals.HP)
  233. DrawHealth(pos, top, entity->GetHealth());
  234.  
  235. if (g_Options.Visuals.Name)
  236. g_Render->DrawString2(g_Render->font.ESP, (int)top.x, (int)top.y - 6, Color::White(), FONT_CENTER, pinfo.name);
  237.  
  238. int bottom = 0;
  239.  
  240. /*auto m_AnimOverlay = entity->GetAnimationOverlay();
  241.  
  242. for (int i = 0; i < 14; i++)
  243. {
  244. char sequence_string[64];
  245. sprintf_s(sequence_string, sizeof(sequence_string) - 1, "%d | %d", i, m_AnimOverlay.m_pElements[i].Sequence);
  246. g_Render->DrawString2(g_Render->font.ESP, top.x + 20 + height, top.y + 10 * i, Color::White(), FONT_LEFT, sequence_string);
  247. }*/
  248.  
  249. std::vector<std::string> weapon;
  250. std::vector<std::string> bomb;
  251. std::vector<std::string> rank;
  252. std::vector<std::string> wins;
  253.  
  254. CBaseCombatWeapon* pWeapon = (CBaseCombatWeapon*)g_EntityList->GetClientEntityFromHandle(entity->GetActiveWeaponHandle());
  255. if (g_Options.Visuals.Weapon && pWeapon)
  256. {
  257. int weapon_id = pWeapon->m_AttributeManager()->m_Item()->GetItemDefinitionIndex();
  258.  
  259. auto weapon_name = ItemDefinitionIndexToString(weapon_id);
  260. weapon.push_back(weapon_name);
  261. }
  262.  
  263.  
  264.  
  265. if (g_Options.Visuals.C4 && entity == BombCarrier)
  266. {
  267. bomb.push_back("Bomb");
  268. }
  269.  
  270. int i = 0;
  271. if (g_Options.Visuals.Weapon)
  272. {
  273.  
  274. for (auto Text : weapon)
  275. {
  276. g_Render->DrawString2(g_Render->font.Guns, (int)top.x, int(top.y + height + 8 + (10 * bottom++)), Color::White(), FONT_CENTER, "%s", Text.c_str());
  277. i++;
  278. }
  279. }
  280. if (g_Options.Visuals.C4)
  281. {
  282. for (auto Text : bomb)
  283. {
  284. g_Render->DrawString2(g_Render->font.Guns, (int)top.x, int(top.y + height + 8 + (10 * bottom++)), Color::Red(), FONT_CENTER, Text.c_str());
  285. i++;
  286. }
  287. }
  288.  
  289. /*if(menu.Visuals.money)
  290. {
  291. g_Render->Textf(int(top.x + width + 3), int(top.y + 12), Color(255, 255, 255, 255), g_Render->font.ESP, "%i", entity->GetMoney());
  292. }*/
  293.  
  294.  
  295.  
  296. }
  297.  
  298.  
  299. void visuals::PlayerBox(float x, float y, float w, float h, Color clr)
  300. {
  301. g_Surface->DrawSetColor(clr);
  302. g_Surface->DrawOutlinedRect(int(x - w), int(y), int(x + w), int(y + h));
  303. g_Surface->DrawSetColor(Color::Black());
  304. g_Surface->DrawOutlinedRect(int(x - w - 1), int(y - 1), int(x + w + 1), int(y + h + 1));
  305. g_Surface->DrawOutlinedRect(int(x - w + 1), int(y + 1), int(x + w - 1), int(y + h - 1));
  306. }
  307.  
  308. Color visuals::GetPlayerColor(C_BaseEntity* entity, C_BaseEntity* local)
  309. {
  310. int TeamNum = entity->GetTeamNum();
  311. bool IsVis = MiscFunctions::IsVisible(local, entity, Head);
  312.  
  313. Color color;
  314.  
  315. if (TeamNum == TEAM_CS_T)
  316. {
  317. if (IsVis)
  318. color = Color(235, 200, 0, 255);
  319. else
  320. color = Color(235, 50, 0, 255);
  321. }
  322. else
  323. {
  324. if (IsVis)
  325. color = Color(235, 200, 0, 255);
  326. else
  327. color = Color(235, 50, 0, 255);
  328. }
  329.  
  330.  
  331. return color;
  332. }
  333.  
  334. void visuals::DrawHealth(C_BaseEntity* entity, visuals::ESPBox size)
  335. {
  336. int health = entity->GetHealth();
  337. int HP = health;
  338. if (HP > 100)
  339. HP = 100;
  340. int hp = health;
  341. float r = float(255 - health * 2.55);
  342. float g = float(health * 2.55);
  343. hp = (size.h - ((size.h * hp) / 100));
  344.  
  345. g_Render->Outline(int(size.x - 4), int(size.y + hp), (int)2, int(size.h - hp + 1), Color((int)r, (int)g, 0));
  346. g_Render->Outline(int(size.x - 5), int(size.y - 1), (int)3, int(size.h + 2), Color(0, 0, 0, 150));
  347. }
  348.  
  349. void visuals::DrawHealth(Vector bot, Vector top, float health)
  350. {
  351. float h = (bot.y - top.y);
  352. float offset = (h / 4.f) + 5;
  353. float w = h / 64.f;
  354.  
  355. UINT hp = UINT(h - (UINT)((h * health) / 100)); // Percentage
  356.  
  357. int Red = int(255 - (health*2.55));
  358. int Green = int(health*2.55);
  359.  
  360. g_Render->DrawOutlinedRect(int((top.x - offset) - 1), int(top.y - 1), 3, int(h + 2), Color::Black());
  361.  
  362. g_Render->Line(int((top.x - offset)), int(top.y + hp), int((top.x - offset)), int(top.y + h), Color(Red, Green, 0, 255));
  363. }
  364.  
  365. void visuals::DrawDrop(C_BaseEntity* entity)
  366. {
  367. if (entity)
  368. {
  369. CBaseCombatWeapon* pWeapon = (CBaseCombatWeapon*)entity;
  370.  
  371. auto owner = pWeapon->GetOwnerHandle();
  372.  
  373. if (owner > -1)
  374. return;
  375.  
  376. Vector pos3D = entity->GetAbsOrigin2();
  377.  
  378. if (pos3D.x == 0.0f && pos3D.y == 0.0f && pos3D.z == 0.0f)
  379. return;
  380.  
  381. Vector pos;
  382.  
  383. if (!g_Render->WorldToScreen(pos3D, pos))
  384. return;
  385.  
  386. int weaponID = pWeapon->m_AttributeManager()->m_Item()->GetItemDefinitionIndex();
  387. auto weaponName = ItemDefinitionIndexToString(weaponID);
  388.  
  389.  
  390. g_Render->Text(pos.x, pos.y, Color(255, 255, 255, 255), g_Render->font.DroppedGuns, weaponName);
  391. }
  392. }
  393. float damage;
  394. char bombdamagestringdead[24];
  395. char bombdamagestringalive[24];
  396. void visuals::DrawBombPlanted(C_BaseEntity* entity, C_BaseEntity* local)
  397. {
  398. BombCarrier = nullptr;
  399.  
  400. Vector vOrig; Vector vScreen;
  401. vOrig = entity->GetOrigin();
  402. CCSBomb* Bomb = (CCSBomb*)entity;
  403. float flBlow = Bomb->GetC4BlowTime();
  404. float lifetime = flBlow - (g_Globals->interval_per_tick * local->GetTickBase());
  405. if (g_Render->WorldToScreen(vOrig, vScreen))
  406. {
  407. if (local->IsAlive())
  408. {
  409. float flDistance = local->GetEyePosition().DistTo(entity->GetEyePosition());
  410. float a = 450.7f;
  411. float b = 75.68f;
  412. float c = 789.2f;
  413. float d = ((flDistance - b) / c);
  414. float flDamage = a*exp(-d * d);
  415.  
  416. damage = float((std::max)((int)ceilf(CSGO_Armor(flDamage, local->ArmorValue())), 0));
  417.  
  418. sprintf_s(bombdamagestringdead, sizeof(bombdamagestringdead) - 1, "ur dead nigga");
  419. sprintf_s(bombdamagestringalive, sizeof(bombdamagestringalive) - 1, "Health left: %.0f", local->GetHealth() - damage);
  420. if (lifetime > -2.f)
  421. {
  422. if (damage >= local->GetHealth())
  423. {
  424. g_Render->Text((int)vScreen.x, int(vScreen.y + 10), Color(250, 42, 42, 255), g_Render->font.Defuse, bombdamagestringdead);
  425. }
  426. else if (local->GetHealth() > damage)
  427. {
  428. g_Render->Text((int)vScreen.x, int(vScreen.y + 10), Color(0, 255, 0, 255), g_Render->font.Defuse, bombdamagestringalive);
  429. }
  430. }
  431. }
  432. char buffer[64];
  433. if (lifetime > 0.01f && !Bomb->IsBombDefused())
  434. {
  435. sprintf_s(buffer, "Bomb: %.1f", lifetime);
  436. g_Render->Text((int)vScreen.x, (int)vScreen.y, Color(250, 42, 42, 255), g_Render->font.ESP, buffer);
  437. }
  438.  
  439. }
  440.  
  441. g_Engine->GetScreenSize(width, height);
  442. int halfX = width / 2;
  443. int halfY = height / 2;
  444.  
  445.  
  446. if (Bomb->GetBombDefuser() > 0)
  447. {
  448. float countdown = Bomb->GetC4DefuseCountDown() - (local->GetTickBase() * g_Globals->interval_per_tick);
  449. if (countdown > 0.01f)
  450. {
  451. if (lifetime > countdown)
  452. {
  453. char defuseTimeString[24];
  454. sprintf_s(defuseTimeString, sizeof(defuseTimeString) - 1, "Defusing: %.1f", countdown);
  455. g_Render->Text(halfX - 50, halfY + 200, Color(0, 255, 0, 255), g_Render->font.Defuse, defuseTimeString);
  456. }
  457. else
  458. {
  459. g_Render->Text(halfX - 50, halfY + 200, Color(255, 0, 0, 255), g_Render->font.Defuse, "Nu time! Git gud!");
  460. }
  461. }
  462. }
  463. }
  464.  
  465. void visuals::DrawBomb(C_BaseEntity* entity, ClientClass* cClass)
  466. {
  467. // Null it out incase bomb has been dropped or planted
  468. BombCarrier = nullptr;
  469. CBaseCombatWeapon *BombWeapon = (CBaseCombatWeapon *)entity;
  470. Vector vOrig; Vector vScreen;
  471. vOrig = entity->GetOrigin();
  472. bool adopted = true;
  473. auto parent = BombWeapon->GetOwnerHandle();
  474. if (parent || (vOrig.x == 0 && vOrig.y == 0 && vOrig.z == 0))
  475. {
  476. C_BaseEntity* pParentEnt = (g_EntityList->GetClientEntityFromHandle(parent));
  477. if (pParentEnt && pParentEnt->IsAlive())
  478. {
  479. BombCarrier = pParentEnt;
  480. adopted = false;
  481. }
  482. }
  483. if (g_Options.Visuals.C4World)
  484. {
  485. if (adopted)
  486. {
  487. if (g_Render->WorldToScreen(vOrig, vScreen))
  488. {
  489. g_Render->Text((int)vScreen.x, (int)vScreen.y, Color(112, 20, 20, 255), g_Render->font.ESP, "Bomb");
  490. }
  491. }
  492. }
  493. }
  494.  
  495. void visuals::DrawBox(visuals::ESPBox size, Color color)
  496. {
  497. g_Render->Outline(size.x, size.y, size.w, size.h, color);
  498. g_Render->Outline(size.x - 1, size.y - 1, size.w + 2, size.h + 2, Color(10, 10, 10, 150));
  499. g_Render->Outline(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(10, 10, 10, 150));
  500. }
  501. bool visuals::GetBox(C_BaseEntity* entity, visuals::ESPBox &result)
  502. {
  503. // Variables
  504. Vector vOrigin, min, max, sMin, sMax, sOrigin,
  505. flb, brt, blb, frt, frb, brb, blt, flt;
  506. float left, top, right, bottom;
  507.  
  508. // Get the locations
  509. vOrigin = entity->GetOrigin();
  510. min = entity->collisionProperty()->GetMins() + vOrigin;
  511. max = entity->collisionProperty()->GetMaxs() + vOrigin;
  512.  
  513. // Points of a 3d bounding box
  514. Vector points[] = { Vector(min.x, min.y, min.z),
  515. Vector(min.x, max.y, min.z),
  516. Vector(max.x, max.y, min.z),
  517. Vector(max.x, min.y, min.z),
  518. Vector(max.x, max.y, max.z),
  519. Vector(min.x, max.y, max.z),
  520. Vector(min.x, min.y, max.z),
  521. Vector(max.x, min.y, max.z) };
  522.  
  523. // Get screen positions
  524. if (!g_Render->WorldToScreen(points[3], flb) || !g_Render->WorldToScreen(points[5], brt)
  525. || !g_Render->WorldToScreen(points[0], blb) || !g_Render->WorldToScreen(points[4], frt)
  526. || !g_Render->WorldToScreen(points[2], frb) || !g_Render->WorldToScreen(points[1], brb)
  527. || !g_Render->WorldToScreen(points[6], blt) || !g_Render->WorldToScreen(points[7], flt))
  528. return false;
  529.  
  530. // Put them in an array (maybe start them off in one later for speed?)
  531. Vector arr[] = { flb, brt, blb, frt, frb, brb, blt, flt };
  532.  
  533. // Init this shit
  534. left = flb.x;
  535. top = flb.y;
  536. right = flb.x;
  537. bottom = flb.y;
  538.  
  539. // Find the bounding corners for our box
  540. for (int i = 1; i < 8; i++)
  541. {
  542. if (left > arr[i].x)
  543. left = arr[i].x;
  544. if (bottom < arr[i].y)
  545. bottom = arr[i].y;
  546. if (right < arr[i].x)
  547. right = arr[i].x;
  548. if (top > arr[i].y)
  549. top = arr[i].y;
  550. }
  551.  
  552. // Width / height
  553. result.x = (int)left;
  554. result.y = (int)top;
  555. result.w = int(right - left);
  556. result.h = int(bottom - top);
  557. result.gay = (int)top;
  558.  
  559. return true;
  560. }
  561. void visuals::BoxAndText(C_BaseEntity* entity, std::string text)
  562. {
  563. ESPBox Box;
  564. std::vector<std::string> Info;
  565. if (GetBox(entity, Box))
  566. {
  567. Info.push_back(text);
  568. if (g_Options.Visuals.GrenadeESP)
  569. {
  570. DrawBox(Box, Color(255, 255, 255, 255));
  571. int i = 0;
  572. for (auto kek : Info)
  573. {
  574. g_Render->Text(Box.x + 1, Box.y + 1, Color(255, 255, 255, 255), g_Render->font.ESP, kek.c_str());
  575. i++;
  576. }
  577. }
  578. }
  579. }
  580. void visuals::DrawThrowable(C_BaseEntity* throwable)
  581. {
  582. model_t* nadeModel = (model_t*)throwable->GetModel();
  583.  
  584. if (!nadeModel)
  585. return;
  586.  
  587. studiohdr_t* hdr = g_ModelInfo->GetStudiomodel(nadeModel);
  588.  
  589. if (!hdr)
  590. return;
  591.  
  592. if (!strstr(hdr->name, "thrown") && !strstr(hdr->name, "dropped"))
  593. return;
  594.  
  595. std::string nadeName = "Unknown Grenade";
  596.  
  597. IMaterial* mats[32];
  598. g_ModelInfo->GetModelMaterials(nadeModel, hdr->numtextures, mats);
  599.  
  600. for (int i = 0; i < hdr->numtextures; i++)
  601. {
  602. IMaterial* mat = mats[i];
  603. if (!mat)
  604. continue;
  605.  
  606. if (strstr(mat->GetName(), "flashbang"))
  607. {
  608. nadeName = "Flashbang";
  609. break;
  610. }
  611. else if (strstr(mat->GetName(), "m67_grenade") || strstr(mat->GetName(), "hegrenade"))
  612. {
  613. nadeName = "HE";
  614. break;
  615. }
  616. else if (strstr(mat->GetName(), "smoke"))
  617. {
  618. nadeName = "Smoke";
  619. break;
  620. }
  621. else if (strstr(mat->GetName(), "decoy"))
  622. {
  623. nadeName = "Decoy";
  624. break;
  625. }
  626. else if (strstr(mat->GetName(), "incendiary") || strstr(mat->GetName(), "molotov"))
  627. {
  628. nadeName = "Molotov";
  629. break;
  630. }
  631. }
  632.  
  633. BoxAndText(throwable, nadeName);
  634. }
  635.  
  636. void visuals::DLight(C_BaseEntity *local, C_BaseEntity* entity)
  637. {
  638. player_info_t pinfo;
  639. if (local && entity && entity != local)
  640. {
  641. if (g_Engine->GetPlayerInfo(entity->GetIndex(), &pinfo) && entity->IsAlive() && !entity->IsDormant())
  642. {
  643. if (local->GetTeamNum() != entity->GetTeamNum())
  644. {
  645. dlight_t* pElight = g_Dlight->CL_AllocElight(entity->GetIndex());
  646. pElight->origin = entity->GetOrigin() + Vector(0.0f, 0.0f, 35.0f);
  647. pElight->radius = 300.0f;
  648. pElight->color.b = 36;
  649. pElight->color.g = 224;
  650. pElight->color.r = 41;
  651. pElight->die = g_Globals->curtime + 0.05f;
  652. pElight->decay = pElight->radius / 5.0f;
  653. pElight->key = entity->GetIndex();
  654.  
  655. dlight_t* pDlight = g_Dlight->CL_AllocDlight(entity->GetIndex());
  656. pDlight->origin = entity->GetOrigin();
  657. pDlight->radius = 300.0f;
  658. pDlight->color.b = 36;
  659. pDlight->color.g = 224;
  660. pDlight->color.r = 41;
  661. pDlight->die = g_Globals->curtime + 0.05f;
  662. pDlight->decay = pDlight->radius; // / 5.0f;
  663. pDlight->key = entity->GetIndex();
  664. }
  665. }
  666. }
  667. }
  668.  
  669. void visuals::NightMode()
  670. {
  671. if (g_Options.Misc.nightMode)
  672. {
  673. if (!done)
  674. {
  675.  
  676.  
  677. static auto sv_skyname = g_CVar->FindVar("sv_skyname");
  678. static auto r_DrawSpecificStaticProp = g_CVar->FindVar("r_DrawSpecificStaticProp");
  679. r_DrawSpecificStaticProp->SetValue(1);
  680. sv_skyname->SetValue("sky_csgo_night02");
  681.  
  682. for (MaterialHandle_t i = g_MaterialSystem->FirstMaterial(); i != g_MaterialSystem->InvalidMaterial(); i = g_MaterialSystem->NextMaterial(i))
  683. {
  684. IMaterial *pMaterial = g_MaterialSystem->GetMaterial(i);
  685.  
  686. if (!pMaterial)
  687. continue;
  688.  
  689. const char* group = pMaterial->GetTextureGroupName();
  690. const char* name = pMaterial->GetName();
  691.  
  692. if (strstr(group, "World textures"))
  693. {
  694. pMaterial->ColorModulate(0.10, 0.10, 0.10);
  695. }
  696. if (strstr(group, "StaticProp"))
  697. {
  698. pMaterial->ColorModulate(0.30, 0.30, 0.30);
  699. }
  700. if (strstr(name, "models/props/de_dust/palace_bigdome"))
  701. {
  702. pMaterial->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  703. }
  704. if (strstr(name, "models/props/de_dust/palace_pillars"))
  705. {
  706. pMaterial->ColorModulate(0.30, 0.30, 0.30);
  707. }
  708.  
  709. if (strstr(group, "Particle textures"))
  710. {
  711. pMaterial->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  712. }
  713. done = true;
  714. }
  715.  
  716. }
  717. }
  718. else
  719. {
  720. if (done)
  721. {
  722. for (MaterialHandle_t i = g_MaterialSystem->FirstMaterial(); i != g_MaterialSystem->InvalidMaterial(); i = g_MaterialSystem->NextMaterial(i))
  723. {
  724. IMaterial *pMaterial = g_MaterialSystem->GetMaterial(i);
  725.  
  726. if (!pMaterial)
  727. continue;
  728.  
  729. const char* group = pMaterial->GetTextureGroupName();
  730. const char* name = pMaterial->GetName();
  731.  
  732. if (strstr(group, "World textures"))
  733. {
  734.  
  735. pMaterial->ColorModulate(1, 1, 1);
  736. }
  737. if (strstr(group, "StaticProp"))
  738. {
  739.  
  740. pMaterial->ColorModulate(1, 1, 1);
  741. }
  742. if (strstr(name, "models/props/de_dust/palace_bigdome"))
  743. {
  744. pMaterial->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, false);
  745. }
  746. if (strstr(name, "models/props/de_dust/palace_pillars"))
  747. {
  748.  
  749. pMaterial->ColorModulate(1, 1, 1);
  750. }
  751. if (strstr(group, "Particle textures"))
  752. {
  753. pMaterial->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, false);
  754. }
  755. }
  756. done = false;
  757. }
  758. }
  759. }
  760.  
  761. void visuals::SpecList(C_BaseEntity *local)
  762. {
  763.  
  764. RECT scrn = g_Render->GetViewport();
  765. int kapi = 0;
  766.  
  767. if (local)
  768. {
  769. for (int i = 0; i < g_EntityList->GetHighestEntityIndex(); i++)
  770. {
  771. // Get the entity
  772. C_BaseEntity *pEntity = g_EntityList->GetClientEntity(i);
  773. player_info_t pinfo;
  774. if (pEntity && pEntity != local)
  775. {
  776. if (g_Engine->GetPlayerInfo(i, &pinfo) && !pEntity->IsAlive() && !pEntity->IsDormant())
  777. {
  778. HANDLE obs = pEntity->GetObserverTargetHandle();
  779. if (obs)
  780. {
  781. C_BaseEntity *pTarget = g_EntityList->GetClientEntityFromHandle(obs);
  782. player_info_t pinfo2;
  783. if (pTarget && pTarget->GetIndex() == local->GetIndex())
  784. {
  785. if (g_Engine->GetPlayerInfo(pTarget->GetIndex(), &pinfo2))
  786. {
  787.  
  788. g_Render->DrawString2(g_Render->font.ESP, scrn.right - 98, (scrn.top) + (16 * kapi) + 20, Color(255, 0, 0, 255), FONT_LEFT, "%s", pinfo.name);
  789. kapi++;
  790. }
  791. }
  792. }
  793. }
  794. }
  795. }
  796. }
  797. g_Render->DrawString2(g_Render->font.ESP, scrn.right - 98, (scrn.top) + 10, Color(255, 255, 255, 255), FONT_LEFT, "Spectating you:");
  798. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement