Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.41 KB | None | 0 0
  1. #include "Menu.hpp"
  2. #define NOMINMAX
  3. #include <Windows.h>
  4. #include <chrono>
  5.  
  6. #include "valve_sdk/csgostructs.hpp"
  7. #include "helpers/input.hpp"
  8. #include "options.hpp"
  9. #include "config.hpp"
  10. #include "features/visuals.hpp"
  11. #include "ui.hpp"
  12. #include "security.hpp"
  13.  
  14. #define IMGUI_DEFINE_MATH_OPERATORS
  15. #include "imgui/imgui_internal.h"
  16. #include "imgui/impl/imgui_impl_dx9.h"
  17. #include "imgui/impl/imgui_impl_win32.h"
  18.  
  19. #include <experimental/filesystem>
  20. namespace fs = std::experimental::filesystem;
  21.  
  22. using KeyBindPair_t = std::pair< int, const char* >;
  23. std::vector< KeyBindPair_t > ButtonNames{
  24. { 0, ("None") },
  25. { 1, ("Left Mouse") },
  26. { 2, ("Right Mouse") },
  27. { 3, ("Scroll Lock") },
  28. { 4, ("Middle Mouse") },
  29. { 5, ("X1 Mouse") },
  30. { 6, ("X2 Mouse") },
  31. { 8, ("Backspace") },
  32. { 9, ("Tab") },
  33. { 12, ("Num 5") },
  34. { 13, ("Enter") },
  35. { 16, ("Shift") },
  36. { 17, ("Ctrl") },
  37. { 18, ("Alt") },
  38. { 20, ("Caps Lock") },
  39. { 27, ("Esc") },
  40. { 32, ("Space") },
  41. { 33, ("Num 9") },
  42. { 34, ("Num 3") },
  43. { 35, ("Num 1") },
  44. { 36, ("Num 7") },
  45. { 37, ("Num 4") },
  46. { 38, ("Num 8") },
  47. { 39, ("Num 6") },
  48. { 40, ("Num 2") },
  49. { 44, ("Sys Req") },
  50. { 45, ("Num 0") },
  51. { 46, ("Num Del") },
  52. { 48, ("0") },
  53. { 49, ("1") },
  54. { 50, ("2") },
  55. { 51, ("3") },
  56. { 52, ("4") },
  57. { 53, ("5") },
  58. { 54, ("6") },
  59. { 55, ("7") },
  60. { 56, ("8") },
  61. { 57, ("9") },
  62. { 65, ("A") },
  63. { 66, ("B") },
  64. { 67, ("C") },
  65. { 68, ("D") },
  66. { 69, ("E") },
  67. { 70, ("F") },
  68. { 71, ("G") },
  69. { 72, ("H") },
  70. { 73, ("I") },
  71. { 74, ("J") },
  72. { 75, ("K") },
  73. { 76, ("L") },
  74. { 77, ("M") },
  75. { 78, ("N") },
  76. { 79, ("O") },
  77. { 80, ("P") },
  78. { 81, ("Q") },
  79. { 82, ("R") },
  80. { 83, ("S") },
  81. { 84, ("T") },
  82. { 85, ("U") },
  83. { 86, ("V") },
  84. { 87, ("W") },
  85. { 88, ("X") },
  86. { 89, ("Y") },
  87. { 90, ("Z") },
  88. { 96, ("Num 0") },
  89. { 97, ("Num 1") },
  90. { 98, ("Num 2") },
  91. { 99, ("Num 3") },
  92. { 100, ("Num 4") },
  93. { 101, ("Num 5") },
  94. { 102, ("Num 6") },
  95. { 103, ("Num 7") },
  96. { 104, ("Num 8") },
  97. { 105, ("Num 9") },
  98. { 106, ("Num *") },
  99. { 107, ("Num +") },
  100. { 109, ("Num -") },
  101. { 110, ("Num Del") },
  102. { 111, ("/") },
  103. { 112, ("F1") },
  104. { 113, ("F2") },
  105. { 114, ("F3") },
  106. { 115, ("F4") },
  107. { 116, ("F5") },
  108. { 117, ("F6") },
  109. { 118, ("F7") },
  110. { 119, ("F8") },
  111. { 120, ("F9") },
  112. { 121, ("F10") },
  113. { 122, ("F11") },
  114. { 123, ("F12") },
  115. { 144, ("Pause") },
  116. { 145, ("Scroll Lock") },
  117. { 161, ("Right Shift") },
  118. { 186, (";") },
  119. { 187, ("=") },
  120. { 188, (",") },
  121. { 189, ("-") },
  122. { 190, (".") },
  123. { 191, ("/") },
  124. { 192, ("`") },
  125. { 219, ("[") },
  126. { 220, ("\\") },
  127. { 221, ("]") },
  128. { 222, ("'") },
  129. { 226, ("\\") },
  130. };
  131.  
  132. bool KeyBind(const char* name, int& keyBind) {
  133. auto result = std::find_if(ButtonNames.begin(), ButtonNames.end(), [&](const KeyBindPair_t& a) { return a.first == keyBind; });
  134. if (result == ButtonNames.end()) {
  135. result = ButtonNames.begin();
  136. keyBind = 0;
  137. }
  138.  
  139. int key = result - ButtonNames.begin();
  140. auto comboRes = ImGui::Combo(
  141. name, &key, [](void* data, int32_t idx, const char** out_text) {
  142. *out_text = ButtonNames[idx].second;
  143. return true;
  144. },
  145. nullptr, ButtonNames.size());
  146.  
  147. keyBind = ButtonNames[key].first;
  148. return comboRes;
  149. }
  150.  
  151. #pragma region RenderTabs
  152. template<size_t N>
  153. void render_tabs(char* (&names)[N], int& activetab, float w, float h)
  154. {
  155. bool values[N] = { false };
  156. values[activetab] = true;
  157. for (auto i = 0; i < N; ++i) {
  158. if (ImGui::ToggleButton(names[i], &values[i], ImVec2{ w, h })) activetab = i;
  159. if (i < N - 1) ImGui::SameLine();
  160. }
  161. }
  162. #pragma endregion
  163. #pragma region Legit
  164. static int weapon_index = 7;
  165. static int weapon_vector_index = 0;
  166. struct WeaponName_t {
  167. constexpr WeaponName_t(int32_t definition_index, const char* name) :
  168. definition_index(definition_index),
  169. name(name) {
  170. }
  171.  
  172. int32_t definition_index = 0;
  173. const char* name = nullptr;
  174. };
  175.  
  176. std::vector< WeaponName_t> WeaponNames =
  177. {
  178. { 7, "AK-47" },
  179. { 8, "AUG" },
  180. { 9, "AWP" },
  181. { 63, "CZ75 Auto" },
  182. { 1, "Desert Eagle" },
  183. { 2, "Dual Berettas" },
  184. { 10, "FAMAS" },
  185. { 3, "Five-SeveN" },
  186. { 11, "G3SG1" },
  187. { 13, "Galil AR" },
  188. { 4, "Glock-18" },
  189. { 14, "M249" },
  190. { 60, "M4A1-S" },
  191. { 16, "M4A4" },
  192. { 17, "MAC-10" },
  193. { 27, "MAG-7" },
  194. { 33, "MP7" },
  195. { WEAPON_MP5, "MP5" },
  196. { 34, "MP9" },
  197. { 28, "Negev" },
  198. { 35, "Nova" },
  199. { 32, "P2000" },
  200. { 36, "P250" },
  201. { 19, "P90" },
  202. { 26, "PP-Bizon" },
  203. { 64, "R8 Revolver" },
  204. { 29, "Sawed-Off" },
  205. { 38, "SCAR-20" },
  206. { 40, "SSG 08" },
  207. { 39, "SG 553" },
  208. { 30, "Tec-9" },
  209. { 24, "UMP-45" },
  210. { 61, "USP-S" },
  211. { 25, "XM1014" },
  212. };
  213.  
  214. void RenderCurrentWeaponButton(float width) {
  215. ImGui::SameLine();
  216. if (!g_EngineClient->IsConnected() || !g_LocalPlayer || !g_LocalPlayer->IsAlive()) {
  217. ImGui::Button("Current", ImVec2(width, 0.0f));
  218. return;
  219. }
  220.  
  221. auto weapon = g_LocalPlayer->m_hActiveWeapon();
  222. if (!weapon || !weapon->IsWeapon()) {
  223. ImGui::Button("Current", ImVec2(width, 0.0f));
  224. return;
  225. }
  226.  
  227. if (ImGui::Button("Current", ImVec2(width, 0.0f))) {
  228. int wpn_idx = weapon->m_Item().m_iItemDefinitionIndex();
  229. auto wpn_it = std::find_if(WeaponNames.begin(), WeaponNames.end(), [wpn_idx](const WeaponName_t& a) {
  230. return a.definition_index == wpn_idx;
  231. });
  232. if (wpn_it != WeaponNames.end()) {
  233. weapon_index = wpn_idx;
  234. weapon_vector_index = std::abs(std::distance(WeaponNames.begin(), wpn_it));
  235. }
  236. }
  237. }
  238.  
  239. void RenderLegitTab() {
  240. ImGui::Columns(3, NULL, false);
  241.  
  242. float item_width = ImGui::GetColumnWidth() * 0.5f - ImGui::GetStyle().ItemSpacing.x;
  243. ImGui::PushItemWidth(item_width);
  244. if (ImGui::Combo(
  245. "##weapon_aimbot", &weapon_vector_index,
  246. [](void* data, int32_t idx, const char** out_text) {
  247. auto vec = reinterpret_cast<std::vector< WeaponName_t >*>(data);
  248. *out_text = vec->at(idx).name;
  249. return true;
  250. }, (void*)(&WeaponNames), WeaponNames.size())) {
  251. weapon_index = WeaponNames[weapon_vector_index].definition_index;
  252. }
  253.  
  254. ImGui::PopItemWidth();
  255.  
  256. RenderCurrentWeaponButton(item_width - ImGui::GetStyle().ItemSpacing.x);
  257.  
  258. auto settings = &g_Options.legitbot_items[weapon_index];
  259. ImGui::BeginChild("##aimbot.general", ImVec2(0, 0), true);
  260. {
  261. ImGui::Text("General");
  262. ImGui::Separator();
  263. ImGui::PushItemWidth(-1);
  264. ImGui::Checkbox("Enabled", &settings->enabled);
  265. ImGui::Checkbox("Friendly fire", &settings->deathmatch);
  266.  
  267. if (weapon_index == WEAPON_P250 ||
  268. weapon_index == WEAPON_USP_SILENCER ||
  269. weapon_index == WEAPON_GLOCK ||
  270. weapon_index == WEAPON_FIVESEVEN ||
  271. weapon_index == WEAPON_TEC9 ||
  272. weapon_index == WEAPON_DEAGLE ||
  273. weapon_index == WEAPON_ELITE ||
  274. weapon_index == WEAPON_HKP2000) {
  275. ImGui::Checkbox("Autopistol", &settings->autopistol);
  276. }
  277.  
  278. ImGui::Checkbox("Smoke check", &settings->smoke_check);
  279. ImGui::Checkbox("Flash check ", &settings->flash_check);
  280. ImGui::Checkbox("Jump check", &settings->jump_check);
  281. ImGui::Checkbox("Autowall", &settings->autowall);
  282. ImGui::Checkbox("Silent", &settings->silent);
  283. ImGui::Checkbox("Auto Stop", &settings->autostop);
  284.  
  285. if (weapon_index == WEAPON_AWP || weapon_index == WEAPON_SSG08 ||
  286. weapon_index == WEAPON_AUG || weapon_index == WEAPON_SG556) {
  287. ImGui::Checkbox("Only In Zoom", &settings->only_in_zoom);
  288. }
  289.  
  290. ImGui::Checkbox("On Key", &settings->on_key);
  291.  
  292. if (settings->on_key) {
  293. ImGui::Text("Bind");
  294. ImGui::SameLine();
  295. KeyBind("##Key bind", settings->key);
  296. }
  297.  
  298. ImGui::Checkbox("Auto Fire", &settings->autofire);
  299. if (settings->autofire) {
  300. ImGui::Text("Bind");
  301. ImGui::SameLine();
  302. KeyBind("##Auto Fire bind", settings->autofire_key);
  303. }
  304.  
  305. ImGui::PopItemWidth();
  306. }
  307. ImGui::EndChild();
  308. ImGui::NextColumn();
  309. ImGui::BeginChild("##aimbot.misc", ImVec2(0, 0), true);
  310. {
  311. ImGui::Text("Misc");
  312. ImGui::Separator();
  313. ImGui::PushItemWidth(-1);
  314.  
  315. static char* priorities[] = {
  316. "Fov",
  317. "Health",
  318. "Damage",
  319. "Distance"
  320. };
  321.  
  322. static char* aim_types[] = {
  323. "Hitbox",
  324. "Nearest"
  325. };
  326.  
  327. static char* smooth_types[] = {
  328. "Static",
  329. "Dynamic"
  330. };
  331.  
  332. static char* fov_types[] = {
  333. "Static",
  334. "Dynamic"
  335. };
  336.  
  337. static char* hitbox_list[] = {
  338. "Head",
  339. "Neck",
  340. "Pelvis",
  341. "Stomach",
  342. "Lower chest",
  343. "Chest",
  344. "Upper chest",
  345. };
  346.  
  347. ImGui::Text("Aim Type:");
  348. ImGui::Combo("##aimbot.aim_type", &settings->aim_type, aim_types, IM_ARRAYSIZE(aim_types));
  349.  
  350. if (settings->aim_type == 0) {
  351. ImGui::Text("Hitbox:");
  352. ImGui::Combo("##aimbot.hitbox", &settings->hitbox, hitbox_list, IM_ARRAYSIZE(hitbox_list));
  353. }
  354.  
  355. ImGui::Text("Priority:");
  356. ImGui::Combo("##aimbot.priority", &settings->priority, priorities, IM_ARRAYSIZE(priorities));
  357. ImGui::Text("Fov Type:");
  358. ImGui::Combo("##aimbot.fov_type", &settings->fov_type, fov_types, IM_ARRAYSIZE(fov_types));
  359. ImGui::Text("Smooth Type:");
  360. ImGui::Combo("##aimbot.smooth_type", &settings->smooth_type, smooth_types, IM_ARRAYSIZE(smooth_types));
  361. ImGui::SliderFloat("##aimbot.fov", &settings->fov, 0, 30, "Fov: %.2f");
  362.  
  363. if (settings->silent) {
  364. ImGui::SliderFloat("##aimbot.silent_fov", &settings->silent_fov, 0, 20, "Silent Fov: %.2f");
  365. }
  366.  
  367. ImGui::SliderFloat("##aimbot.smooth", &settings->smooth, 1, 20, "Smooth: %.2f");
  368.  
  369. if (!settings->silent) {
  370. ImGui::SliderInt("##aimbot.shot_delay", &settings->shot_delay, 0, 100, "Shot Delay: %.0f");
  371. }
  372.  
  373. ImGui::SliderInt("##aimbot.kill_delay", &settings->kill_delay, 0, 1000, "Kill Delay: %.0f");
  374.  
  375. if (settings->autowall) {
  376. ImGui::SliderInt("##aimbot.min_damage", &settings->min_damage, 1, 100, "Min Damage: %.0f");
  377. }
  378.  
  379. ImGui::SliderFloat("##aimbot_backtrack_time", &settings->backtrack_time, 0.f, 0.2f, "Backtrack: %.3f (seconds)");
  380.  
  381. ImGui::PopItemWidth();
  382. }
  383. ImGui::EndChild();
  384. ImGui::NextColumn();
  385. ImGui::BeginChild("##aimbot.rcs", ImVec2(0, 0), true);
  386. {
  387. ImGui::Text("RCS");
  388. ImGui::Separator();
  389. ImGui::PushItemWidth(-1);
  390. ImGui::Checkbox("Enabled##aimbot.rcs", &settings->rcs);
  391. ImGui::Text("RCS Type:");
  392. static char* rcs_types[] = {
  393. "Standalone",
  394. "Aim"
  395. };
  396. ImGui::Combo("##aimbot.rcs_type", &settings->rcs_type, rcs_types, IM_ARRAYSIZE(rcs_types));
  397. ImGui::Checkbox("RCS Custom Fov", &settings->rcs_fov_enabled);
  398. if (settings->rcs_fov_enabled) {
  399. ImGui::SliderFloat("##aimbot.rcs_fov", &settings->rcs_fov, 0, 20, "RCS Fov: %.2f");
  400. }
  401. ImGui::Checkbox("RCS Custom Smooth", &settings->rcs_smooth_enabled);
  402. if (settings->rcs_smooth_enabled) {
  403. ImGui::SliderFloat("##aimbot.rcs_smooth", &settings->rcs_smooth, 1, 15, "RCS Smooth: %.2f");
  404. }
  405. ImGui::SliderInt("##aimbot.rcs_x", &settings->rcs_x, 0, 100, "RCS X: %.0f");
  406. ImGui::SliderInt("##aimbot.rcs_y", &settings->rcs_y, 0, 100, "RCS Y: %.0f");
  407. ImGui::SliderInt("##aimbot.rcs_start", &settings->rcs_start, 1, 30, "RCS Start: %.0f");
  408. ImGui::PopItemWidth();
  409. }
  410. ImGui::EndChild();
  411. ImGui::Columns(1, NULL, false);
  412. }
  413. #pragma endregion
  414. #pragma region Visuals
  415. void RenderVisualsTab() {
  416. static int ESP_Tab = 0;
  417.  
  418. auto& style = ImGui::GetStyle();
  419. float group_w = ImGui::GetCurrentWindow()->Size.x - style.WindowPadding.x * 2;
  420. ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
  421. {
  422. render_tabs(Esp_tabs, ESP_Tab, group_w / _countof(Esp_tabs), 25.0f);
  423. }
  424. ImGui::PopStyleVar();
  425. ImGui::BeginGroupBox("##body_content");
  426. {
  427. if (ESP_Tab == 0) {
  428. ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ style.WindowPadding.x, style.ItemSpacing.y });
  429. {
  430. ImGui::Columns(3, nullptr, false);
  431. ImGui::Checkbox("Enabled", &g_Options.esp_enabled);
  432. ImGui::Checkbox("Enemy only", &g_Options.esp_enemies_only);
  433. ImGui::Checkbox("Skeleton", &g_Options.esp_player_skeleton);
  434. ImGui::Checkbox("Box", &g_Options.esp_player_boxes);
  435. if (g_Options.esp_player_boxes) ImGui::Combo("Box type", &g_Options.esp_player_boxes_type, Box_type, IM_ARRAYSIZE(Box_type), 2);
  436. ImGui::Checkbox("Name", &g_Options.esp_player_names);
  437. ImGui::Checkbox("Health", &g_Options.esp_player_health);
  438. ImGui::Checkbox("Armour", &g_Options.esp_player_armour);
  439. ImGui::Checkbox("Weapon", &g_Options.esp_player_weapons);
  440. ImGui::NextColumn();
  441.  
  442. ImGui::Checkbox("Dropped Weapons", &g_Options.esp_dropped_weapons);
  443. ImGui::Checkbox("Defuse Kit", &g_Options.esp_defuse_kit);
  444. ImGui::Checkbox("Planted C4", &g_Options.esp_planted_c4);
  445. ImGui::Checkbox( "Item Esp", &g_Options.esp_items );
  446. ImGui::NextColumn();
  447.  
  448. ImGui::PushItemWidth(100);
  449. ImGui::ColorEdit4("Allies Visible", g_Options.color_esp_ally_visible, ImGuiColorEditFlags_NoInputs);
  450. ImGui::ColorEdit4("Enemies Visible", g_Options.color_esp_enemy_visible, ImGuiColorEditFlags_NoInputs);
  451. ImGui::ColorEdit4("Allies Occluded", g_Options.color_esp_ally_occluded, ImGuiColorEditFlags_NoInputs);
  452. ImGui::ColorEdit4("Enemies Occluded", g_Options.color_esp_enemy_occluded, ImGuiColorEditFlags_NoInputs);
  453. ImGui::ColorEdit4("Dropped Weapons", g_Options.color_esp_weapons, ImGuiColorEditFlags_NoInputs);
  454. ImGui::ColorEdit4("Defuse Kit", g_Options.color_esp_defuse, ImGuiColorEditFlags_NoInputs);
  455. ImGui::ColorEdit4("Planted C4", g_Options.color_esp_c4, ImGuiColorEditFlags_NoInputs);
  456. ImGui::ColorEdit4("Item Esp", g_Options.color_esp_item, ImGuiColorEditFlags_NoInputs);
  457. ImGui::PopItemWidth();
  458. ImGui::Columns(1, nullptr, false);
  459. }
  460. ImGui::PopStyleVar();
  461. }
  462. else if (ESP_Tab == 1) {
  463. ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ style.WindowPadding.x, style.ItemSpacing.y });
  464. {
  465. ImGui::Columns(2, nullptr, false);
  466. ImGui::Checkbox("Enabled", &g_Options.glow_enabled);
  467. ImGui::Checkbox("Team check", &g_Options.glow_enemies_only);
  468. ImGui::Checkbox("Players", &g_Options.glow_players);
  469. ImGui::Checkbox("Chickens", &g_Options.glow_chickens);
  470. ImGui::Checkbox("C4 Carrier", &g_Options.glow_c4_carrier);
  471. ImGui::Checkbox("Planted C4", &g_Options.glow_planted_c4);
  472. ImGui::Checkbox("Defuse Kits", &g_Options.glow_defuse_kits);
  473. ImGui::Checkbox("Weapons", &g_Options.glow_weapons);
  474. ImGui::NextColumn();
  475.  
  476. ImGui::PushItemWidth(100);
  477. ImGui::ColorEdit4("Ally", g_Options.color_glow_ally, ImGuiColorEditFlags_NoInputs);
  478. ImGui::ColorEdit4("Enemy", g_Options.color_glow_enemy, ImGuiColorEditFlags_NoInputs);
  479. ImGui::ColorEdit4("Chickens", g_Options.color_glow_chickens, ImGuiColorEditFlags_NoInputs);
  480. ImGui::ColorEdit4("C4 Carrier", g_Options.color_glow_c4_carrier, ImGuiColorEditFlags_NoInputs);
  481. ImGui::ColorEdit4("Planted C4", g_Options.color_glow_planted_c4, ImGuiColorEditFlags_NoInputs);
  482. ImGui::ColorEdit4("Defuse Kits", g_Options.color_glow_defuse, ImGuiColorEditFlags_NoInputs);
  483. ImGui::ColorEdit4("Weapons", g_Options.color_glow_weapons, ImGuiColorEditFlags_NoInputs);
  484. ImGui::PopItemWidth();
  485. ImGui::Columns(1, nullptr, false);
  486. }
  487. ImGui::PopStyleVar();
  488. }
  489. else if (ESP_Tab == 2) {
  490. ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ style.WindowPadding.x, style.ItemSpacing.y });
  491. {
  492. ImGui::Columns(2, nullptr, false);
  493. ImGui::Checkbox("Enabled", &g_Options.chams_player_enabled);
  494. ImGui::Checkbox("Team check", &g_Options.chams_player_enemies_only);
  495. ImGui::Checkbox("Wireframe", &g_Options.chams_player_wireframe);
  496. ImGui::Checkbox("Flat", &g_Options.chams_player_flat);
  497. ImGui::Checkbox("Ignore-Z", &g_Options.chams_player_ignorez);
  498. ImGui::Checkbox("Glass", &g_Options.chams_player_glass);
  499. ImGui::Checkbox("Disable model occulusion", &g_Options.chams_disable_occulusion);
  500. ImGui::Combo("Backtrack chams", &g_Options.chams_backtrack, std::vector<std::string>{ "Off", "Last tick", "All ticks" });
  501. ImGui::Checkbox("Backtrack flat chams", &g_Options.chams_backtrack_flat);
  502. ImGui::NextColumn();
  503.  
  504. ImGui::PushItemWidth(100);
  505. ImGui::ColorEdit4("Ally (Visible)", g_Options.color_chams_player_ally_visible, ImGuiColorEditFlags_NoInputs);
  506. ImGui::ColorEdit4("Ally (Occluded)", g_Options.color_chams_player_ally_occluded, ImGuiColorEditFlags_NoInputs);
  507. ImGui::ColorEdit4("Enemy (Visible)", g_Options.color_chams_player_enemy_visible, ImGuiColorEditFlags_NoInputs);
  508. ImGui::ColorEdit4("Enemy (Occluded)", g_Options.color_chams_player_enemy_occluded, ImGuiColorEditFlags_NoInputs);
  509. ImGui::ColorEdit4("Bactrack color", g_Options.color_chams_backtrack, ImGuiColorEditFlags_NoInputs);
  510. ImGui::PopItemWidth();
  511. ImGui::Columns(1, nullptr, false);
  512. }
  513. ImGui::PopStyleVar();
  514. }
  515. else if (ESP_Tab == 3) {
  516. ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ style.WindowPadding.x, style.ItemSpacing.y });
  517. {
  518. ImGui::Columns(2, nullptr, false);
  519.  
  520. ImGui::Checkbox("Hitmarker", &g_Options.esp_hitmarker);
  521. ImGui::Checkbox("Angle lines", &g_Options.esp_angle_lines);
  522. ImGui::Checkbox("Choke indicator", &g_Options.esp_choke_indicator);
  523. ImGui::Checkbox("Grenade prediction", &g_Options.esp_grenade_prediction);
  524. ImGui::Checkbox("Draw FOV", &g_Options.other_drawfov);
  525. ImGui::Checkbox("Draw backtrack dots", &g_Options.esp_backtrack);
  526. ImGui::Checkbox("No hands", &g_Options.other_no_hands);
  527. ImGui::Checkbox("No smoke", &g_Options.other_no_smoke);
  528. ImGui::Checkbox("No flash", &g_Options.other_no_flash);
  529. ImGui::Checkbox("Visualize sounds", &g_Options.esp_sounds);
  530. ImGui::SliderFloat("Duration", &g_Options.esp_sounds_time, 0.5f, 3.0f, "%.3f ms");
  531. ImGui::SliderFloat("Radius", &g_Options.esp_sounds_radius, 15.0f, 150.0f, "%.1f");
  532. ImGui::ColorEdit4("Sound color", g_Options.color_esp_sounds, ImGuiColorEditFlags_NoInputs); ImGui::SameLine();
  533. ImGui::ColorEdit4("Grenade prediction", g_Options.color_grenade_prediction, ImGuiColorEditFlags_NoInputs);
  534.  
  535. ImGui::NextColumn();
  536.  
  537. ImGui::Checkbox("Nightmode", &g_Options.other_nightmode);
  538. if (g_Options.other_nightmode)
  539. ImGui::SliderFloat("Size", &g_Options.other_nightmode_size, 0.05f, 1.0f, "%.3f");
  540.  
  541.  
  542. ImGui::SliderFloat("Red", &g_Options.other_mat_ambient_light_r, 0, 1);
  543. ImGui::SliderFloat("Green", &g_Options.other_mat_ambient_light_g, 0, 1);
  544. ImGui::SliderFloat("Blue", &g_Options.other_mat_ambient_light_b, 0, 1);
  545. ImGui::Checkbox("Rainbow", &g_Options.other_mat_ambient_light_rainbow);
  546.  
  547.  
  548.  
  549. ImGui::Columns(1, nullptr, false);
  550. }
  551. ImGui::PopStyleVar();
  552. }
  553. }
  554. ImGui::EndGroupBox();
  555. }
  556. #pragma endregion
  557. #pragma region Misc
  558. void RenderMiscTab() {
  559. auto& style = ImGui::GetStyle();
  560.  
  561. ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ style.WindowPadding.x, style.ItemSpacing.y });
  562. {
  563. ImGui::Columns(2, nullptr, false);
  564. ImGui::Checkbox("Bunny hop", &g_Options.misc_bhop);
  565. ImGui::Checkbox("Auto strafe", &g_Options.misc_autostrafe);
  566. if (g_Options.misc_autostrafe)
  567. ImGui::SliderFloat("Retrack speed", &g_Options.misc_retrack_speed, 2.0f, 8.0f, "%.1f");
  568.  
  569. ImGui::Checkbox("Edge jump", &g_Options.misc_edgejump);
  570. ImGui::Checkbox("Spectator list", &g_Options.misc_spectatorlist);
  571. ImGui::Checkbox("Radar", &g_Options.misc_radar);
  572. if (g_Options.misc_radar) {
  573. ImGui::SameLine();
  574. ImGui::Checkbox("Enemy only", &g_Options.misc_radar_enemyonly);
  575. }
  576.  
  577. ImGui::Checkbox("Rank reveal", &g_Options.misc_showranks);
  578. ImGui::Checkbox("Clantag", &g_Options.misc_clantag);
  579. ImGui::Checkbox("Watermark", &g_Options.misc_watermark);
  580. ImGui::Checkbox("Third Person", &g_Options.misc_thirdperson);
  581. if (g_Options.misc_thirdperson)
  582. {
  583. ImGui::SliderFloat("Third Person Dist", &g_Options.misc_thirdperson_dist, 25.f, 250.f);
  584. KeyBind("Third Person Bind", g_Options.misc_thirdperson_bind); ImGui::NewLine();
  585. }
  586.  
  587. ImGui::Combo("Desync [BETA]", &g_Options.misc_desync, std::vector<std::string>{ "Off", "Static", "Balance" });
  588. if (g_Options.misc_desync)
  589. KeyBind("Desync Flip bind", g_Options.misc_desync_bind);
  590.  
  591. ImGui::Dummy(ImVec2(0, ImGui::GetContentRegionAvail().y - ImGui::GetTextLineHeightWithSpacing()));
  592. ImGui::Text("v0.46");
  593.  
  594. ImGui::NextColumn();
  595. ImGui::PushItemWidth(158);
  596. {
  597. ImGui::SliderInt("Override FOV", &g_Options.misc_override_fov, 90, 150);
  598. ImGui::SliderInt("Viewmodel FOV", &g_Options.misc_viewmodel_fov, 68, 120);
  599.  
  600. //KeyBind("Fake duck", g_Options.misc_fakeduck_bind);
  601. //ImGui::SliderInt("Fake duck ticks", &g_Options.misc_fakeduck_ticks, 2, 14);
  602. //ImGui::Checkbox("Block attack when fake ducked", &g_Options.misc_block_ducked_attack);
  603.  
  604. ImGui::Checkbox("Fakelag Enabled", &g_Options.fakelag_enabled);
  605. if (g_Options.fakelag_enabled)
  606. {
  607. ImGui::Checkbox("When standing", &g_Options.fakelag_standing);
  608. ImGui::Checkbox("When moving", &g_Options.fakelag_moving);
  609. //ImGui::Checkbox("When Unducking", &g_Options.fakelag_unducking);
  610. ImGui::Combo("Mode", &g_Options.fakelag_mode, std::vector<std::string>{"Factor", "Switch", "Adaptive", "Random", "Legit peek"});
  611. ImGui::SliderInt("Factor", &g_Options.fakelag_factor, 1, 15);
  612. }
  613.  
  614. KeyBind("Slowwalk bind", g_Options.misc_slowwalk_bind);
  615.  
  616. if (g_Options.misc_slowwalk_bind)
  617. ImGui::SliderFloat("Slowwalk speed", &g_Options.misc_slowwalk_speed, 0.f, 100.f, "%.0f%%");
  618. }
  619. ImGui::PopItemWidth();
  620.  
  621. ImGui::Dummy(ImVec2(0, ImGui::GetContentRegionAvail().y - ImGui::CalcTextSize("Unload").y - style.ItemSpacing.y * 2.f - 3));
  622. ImGui::Dummy(ImVec2(ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize("Unload").x - style.ItemSpacing.x * 2.f + 3, 0));
  623. ImGui::SameLine();
  624.  
  625. if (ImGui::Button("Unload"))
  626. g_Unload = true;
  627.  
  628. ImGui::Columns(1, nullptr, false);
  629. }
  630. ImGui::PopStyleVar();
  631. }
  632. #pragma endregion
  633. #pragma region Skins
  634. void RenderSkinsTab() {
  635. if (k_skins.size() == 0) {
  636. initialize_kits();
  637. }
  638. auto& entries = g_Options.skins.m_items;
  639. static auto definition_vector_index = 0;
  640. ImGui::Columns(2, nullptr, false);
  641. {
  642. ImGui::PushItemWidth(-1);
  643. const auto wnd = ImGui::GetCurrentWindowRead();
  644. float height = (wnd->Pos.y + wnd->Size.y) - wnd->DC.CursorPos.y - 18.0f - ImGui::GetStyle().WindowPadding.y - ImGui::GetStyle().FramePadding.y * 2.0f;
  645.  
  646. ImGui::ListBoxHeader("##config", ImVec2(0.f, height));
  647. {
  648. for (size_t w = 0; w < k_weapon_names.size(); w++) {
  649. if (ImGui::Selectable(k_weapon_names[w].name, definition_vector_index == w)) {
  650. definition_vector_index = w;
  651. }
  652. }
  653. }
  654. ImGui::ListBoxFooter();
  655. if (ImGui::Button("Update"))
  656. g_ClientState->ForceFullUpdate();
  657. ImGui::PopItemWidth();
  658. }
  659. ImGui::NextColumn();
  660. {
  661. auto& selected_entry = entries[k_weapon_names[definition_vector_index].definition_index];
  662. selected_entry.definition_index = k_weapon_names[definition_vector_index].definition_index;
  663. selected_entry.definition_vector_index = definition_vector_index;
  664. ImGui::Checkbox("Enabled", &selected_entry.enabled);
  665. ImGui::InputInt("Seed", &selected_entry.seed);
  666. ImGui::InputInt("StatTrak", &selected_entry.stat_trak);
  667. ImGui::SliderFloat("Wear", &selected_entry.wear, FLT_MIN, 1.f, "%.10f", 5);
  668. if (selected_entry.definition_index != GLOVE_T_SIDE) {
  669. ImGui::Combo("Paint Kit", &selected_entry.paint_kit_vector_index, [](void* data, int idx, const char** out_text) {
  670. *out_text = k_skins[idx].name.c_str();
  671. return true;
  672. }, nullptr, k_skins.size(), 20);
  673. selected_entry.paint_kit_index = k_skins[selected_entry.paint_kit_vector_index].id;
  674. }
  675. else {
  676. ImGui::Combo("Paint Kit", &selected_entry.paint_kit_vector_index, [](void* data, int idx, const char** out_text) {
  677. *out_text = k_gloves[idx].name.c_str();
  678. return true;
  679. }, nullptr, k_gloves.size(), 20);
  680. selected_entry.paint_kit_index = k_gloves[selected_entry.paint_kit_vector_index].id;
  681. }
  682. if (selected_entry.definition_index == WEAPON_KNIFE) {
  683. ImGui::Combo("Knife", &selected_entry.definition_override_vector_index, [](void* data, int idx, const char** out_text) {
  684. *out_text = k_knife_names.at(idx).name;
  685. return true;
  686. }, nullptr, k_knife_names.size(), 10);
  687. selected_entry.definition_override_index = k_knife_names.at(selected_entry.definition_override_vector_index).definition_index;
  688. }
  689. else if (selected_entry.definition_index == GLOVE_T_SIDE) {
  690. ImGui::Combo("Glove", &selected_entry.definition_override_vector_index, [](void* data, int idx, const char** out_text) {
  691. *out_text = k_glove_names.at(idx).name;
  692. return true;
  693. }, nullptr, k_glove_names.size(), 10);
  694. selected_entry.definition_override_index = k_glove_names.at(selected_entry.definition_override_vector_index).definition_index;
  695. }
  696. else {
  697. static auto unused_value = 0;
  698. selected_entry.definition_override_vector_index = 0;
  699. }
  700. //ImGui::InputText( "Name Tag", selected_entry.custom_name, 32 );
  701. }
  702. ImGui::Columns(1, nullptr, false);
  703. }
  704. #pragma endregion
  705. #pragma region Options
  706. void RenderOptionsTab() {
  707. static std::vector<std::string> configs;
  708.  
  709. static auto load_configs = []() {
  710. std::vector<std::string> items = {};
  711.  
  712. std::string path("C:\\pearcheats");
  713. if (!fs::is_directory(path))
  714. fs::create_directories(path);
  715.  
  716. for (auto& p : fs::directory_iterator(path))
  717. items.push_back(p.path().string().substr(path.length() + 1));
  718.  
  719. return items;
  720. };
  721.  
  722. static auto is_configs_loaded = false;
  723. if (!is_configs_loaded) {
  724. is_configs_loaded = true;
  725. configs = load_configs();
  726. }
  727.  
  728. static std::string current_config;
  729.  
  730. static char config_name[32];
  731.  
  732. ImGui::InputText("##config_name", config_name, sizeof(config_name));
  733. ImGui::SameLine();
  734. if (ImGui::Button("Create")) {
  735. current_config = std::string(config_name);
  736.  
  737. Config->Save(current_config + ".ini");
  738. is_configs_loaded = false;
  739. memset(config_name, 0, 32);
  740. }
  741.  
  742.  
  743.  
  744. ImGui::ListBoxHeader("##configs");
  745. {
  746. for (auto& config : configs) {
  747. if (ImGui::Selectable(config.c_str(), config == current_config)) {
  748. current_config = config;
  749. }
  750. }
  751. }
  752. ImGui::ListBoxFooter();
  753.  
  754.  
  755. if (!current_config.empty()) {
  756.  
  757. if (ImGui::Button("Load"))
  758. Config->Load(current_config);
  759. ImGui::SameLine();
  760.  
  761. if (ImGui::Button("Save"))
  762. Config->Save(current_config);
  763. ImGui::SameLine();
  764.  
  765. if (ImGui::Button("Delete") && fs::remove("C:\\pearcheats\\" + current_config)) {
  766. current_config.clear();
  767. is_configs_loaded = false;
  768. }
  769.  
  770. ImGui::SameLine();
  771. }
  772.  
  773. if (ImGui::Button("Refresh"))
  774. is_configs_loaded = false;
  775. }
  776. #pragma endregion
  777. #pragma region Radar
  778. void Menu::DrawRadar() {
  779. auto visible = Color::Red;
  780. auto Tvisible = Color::White;
  781.  
  782. ImGuiStyle& style = ImGui::GetStyle();
  783. ImVec2 oldPadding = style.WindowPadding;
  784. float oldAlpha = style.Colors[ImGuiCol_WindowBg].w;
  785. style.WindowPadding = ImVec2(0, 0);
  786.  
  787. //style.WindowTitleAlign = ImVec2(0.5f, 0.5f);
  788. //style.Colors[ImGuiCol_WindowBg].w = 1.0f;
  789. ImGui::PushStyleVar(ImGuiStyleVar_WindowTitleAlign, ImVec2(0.5f, 0.5f));
  790. if (ImGui::Begin("Radar", nullptr, ImVec2(150, 170), 0.7F, ImGuiWindowFlags_NoCollapse))
  791. //if (ImGui::Begin("Radar", &_visible, ImVec2(200, 200)), ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize)
  792. {
  793. ImVec2 siz = ImGui::GetWindowSize();
  794. ImVec2 pos = ImGui::GetWindowPos();
  795.  
  796. ImDrawList* windowDrawList = ImGui::GetWindowDrawList();
  797. windowDrawList->AddLine(ImVec2(pos.x + (siz.x / 2), pos.y + 0), ImVec2(pos.x + (siz.x / 2), pos.y + siz.y), ImColor(64, 72, 95), 1.5f);
  798. windowDrawList->AddLine(ImVec2(pos.x + 0, pos.y + (siz.y / 2)), ImVec2(pos.x + siz.x, pos.y + (siz.y / 2)), ImColor(64, 72, 95), 1.5f);
  799. static auto GetU32 = [](Color _color) {
  800. return ((_color[3] & 0xff) << 24) + ((_color[2] & 0xff) << 16) + ((_color[1] & 0xff) << 8)
  801. + (_color[0] & 0xff);
  802. };
  803.  
  804. static auto RotatePoint = [](Vector EntityPos, Vector LocalPlayerPos, int posX, int posY, int sizeX, int sizeY, float angle, float zoom) {
  805. float r_1, r_2;
  806. float x_1, y_1;
  807.  
  808. r_1 = -(EntityPos.y - LocalPlayerPos.y);
  809. r_2 = EntityPos.x - LocalPlayerPos.x;
  810. float Yaw = angle - 90.0f;
  811.  
  812. float yawToRadian = DEG2RAD(Yaw);
  813. x_1 = r_2 * cosf(yawToRadian) - r_1 * sin(yawToRadian) / 20.0f;
  814. y_1 = r_2 * sinf(yawToRadian) + r_1 * cos(yawToRadian) / 20.0f;
  815.  
  816. x_1 *= zoom;
  817. y_1 *= zoom;
  818.  
  819. int sizX = sizeX / 2;
  820. int sizY = sizeY / 2;
  821.  
  822. x_1 += sizX;
  823. y_1 += sizY;
  824.  
  825. if (x_1 < 5)
  826. x_1 = 5;
  827.  
  828. if (x_1 > sizeX - 5)
  829. x_1 = sizeX - 5;
  830.  
  831. if (y_1 < 5)
  832. y_1 = 5;
  833.  
  834. if (y_1 > sizeY - 5)
  835. y_1 = sizeY - 5;
  836.  
  837. x_1 += posX;
  838. y_1 += posY;
  839.  
  840. return Vector2D(x_1, y_1);
  841. };
  842.  
  843. if (g_EngineClient->IsInGame() && g_EngineClient->IsConnected()) {
  844. if (g_LocalPlayer) {
  845. Vector LocalPos = g_LocalPlayer->GetEyePos();
  846. QAngle ang;
  847. g_EngineClient->GetViewAngles(&ang);
  848.  
  849. for (int i = 1; i <= g_GlobalVars->maxClients; ++i) {
  850. auto player = C_BasePlayer::GetPlayerByIndex(i);
  851. if (!player || player->IsDormant() || !player->IsAlive())
  852. continue;
  853.  
  854. bool bIsEnemy = g_LocalPlayer->m_iTeamNum() != player->m_iTeamNum();
  855.  
  856. if (g_Options.misc_radar_enemyonly && !bIsEnemy)
  857. continue;
  858.  
  859. bool viewCheck = false;
  860. Vector2D EntityPos = RotatePoint(Vector(player->m_vecOrigin().x, player->m_vecOrigin().y, 0), LocalPos, pos.x, pos.y, siz.x, siz.y, ang.yaw, 0.5f);
  861.  
  862. //ImU32 clr = (bIsEnemy ? (isVisibled ? Color::LightGreen() : Color::Blue()) : Color::White()).GetU32();
  863. ImU32 clr = GetU32(bIsEnemy ? (visible) : Tvisible);
  864.  
  865. int s = 4;
  866. windowDrawList->AddCircleFilled(ImVec2(EntityPos.x, EntityPos.y), s, clr);
  867. }
  868. }
  869. }
  870. }
  871. ImGui::End();
  872. ImGui::PopStyleVar();
  873. style.WindowPadding = oldPadding;
  874. style.Colors[ImGuiCol_WindowBg].w = oldAlpha;
  875. }
  876. #pragma endregion
  877.  
  878. void Menu::Initialize() {
  879. CreateStyle();
  880.  
  881. _visible = false;
  882. }
  883.  
  884. void Menu::Shutdown() {
  885. ImGui_ImplDX9_Shutdown();
  886. ImGui_ImplWin32_Shutdown();
  887. ImGui::DestroyContext();
  888. }
  889.  
  890. void Menu::OnDeviceLost() {
  891. ImGui_ImplDX9_InvalidateDeviceObjects();
  892. }
  893.  
  894. void Menu::OnDeviceReset() {
  895. ImGui_ImplDX9_CreateDeviceObjects();
  896. }
  897.  
  898. bool FileExists(const TCHAR *fileName)
  899. {
  900. DWORD fileAttr;
  901. fileAttr = GetFileAttributes(fileName);
  902. if (0xFFFFFFFF == fileAttr && GetLastError() == ERROR_FILE_NOT_FOUND)
  903. return false;
  904. return true;
  905. }
  906. void RenderEmptyTab()
  907. {
  908.  
  909. ImGui::Text("Is empty <3");
  910. //ImGui::Text("%.2f x, %.2f y", ImGui::GetWindowSize().x, ImGui::GetWindowSize().y);
  911.  
  912. }
  913.  
  914. void Menu::Render() {
  915. ImGui::GetIO().MouseDrawCursor = _visible;
  916.  
  917. if (g_Options.misc_spectatorlist)
  918. Visuals::Get().RenderSpectatorList();
  919.  
  920. if (g_Options.misc_radar)
  921. DrawRadar();
  922.  
  923. if (!_visible)
  924. return;
  925.  
  926. static int selected_tab = 0;
  927.  
  928. int w, h;
  929. g_EngineClient->GetScreenSize(w, h);
  930. float x = w * 0.5f - 300.0f;
  931. float y = h * 0.5f - 200.0f;
  932.  
  933. ImGui::SetNextWindowPos(ImVec2{ x, y }, ImGuiSetCond_Once);
  934. ImGui::SetNextWindowSize(ImVec2{ 600, 400 }, ImGuiSetCond_Once);
  935.  
  936. #ifdef _DEBUG
  937. ImGui::ShowDemoWindow();
  938. #endif
  939.  
  940. if (ImGui::Begin("PearCheats", &_visible, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar)) {
  941.  
  942. ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
  943. {
  944. ImGui::Image(brand_img, ImVec2(142.0f, 40.0f)); ImGui::SameLine();
  945. ImGui::Dummy(ImVec2(_style.WindowPadding.x, 0.0f)); ImGui::SameLine();
  946. auto TabsW = (ImGui::GetCurrentWindow()->Size.x - _style.WindowPadding.x * 2.0f - 150.0f) / _countof(tabs);
  947. render_tabs(tabs, selected_tab, TabsW, 40.0f);
  948. }
  949. ImGui::PopStyleVar();
  950.  
  951. ImGui::BeginGroupBox("##empty");
  952. {
  953. if (selected_tab == 0) RenderLegitTab();
  954. else if (selected_tab == 1) RenderVisualsTab();
  955. else if (selected_tab == 2) RenderMiscTab();
  956. else if (selected_tab == 3) RenderSkinsTab();
  957. else if (selected_tab == 4) RenderOptionsTab();
  958. }
  959. ImGui::EndGroupBox();
  960.  
  961. ImGui::End();
  962. }
  963. }
  964.  
  965. void Menu::Toggle() {
  966. _visible = !_visible;
  967. }
  968.  
  969. void Menu::CreateStyle() {
  970. ImGui::StyleColorsM0ne0N(); // why nut? xd
  971.  
  972. ImGui::SetColorEditOptions(ImGuiColorEditFlags_HEX); // this for print hex, without - rgba
  973. ImGui::GetStyle() = _style;
  974. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement