Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. bool drawMenu = false;
  2.  
  3. void GUIManager::AddSection(char* name)
  4. {
  5. ++count;
  6.  
  7. sections[count].name = name;
  8. sections[count].count = -1;
  9. }
  10.  
  11. void GUIManager::AddItem(char* name, int max, int* val)
  12. {
  13. int i = ++count;
  14.  
  15. items[i].name = name;
  16. items[i].max = max;
  17. items[i].val = val;
  18. }
  19.  
  20. void GUIManager::Init()
  21. {
  22. select = 0;
  23. sub = -1;
  24. count = -1;
  25.  
  26. AddSection("aim");
  27.  
  28. AddItem("aim_fov",45,&cvars->aim_fov);
  29. AddItem("aim_silent",2,&cvars->aim_silent);
  30. AddItem("aim_autofire",1,&cvars->aim_autofire);
  31. AddItem("aim_body",1,&cvars->aim_body);
  32. AddItem("aim_team",1,&cvars->aim_team);
  33.  
  34. AddSection("esp");
  35.  
  36. AddItem("esp_enable",1,&cvars->esp_enable);
  37. AddItem("esp_name",1,&cvars->esp_name);
  38. AddItem("esp_weapon",1,&cvars->esp_weapon);
  39. AddItem("esp_health",1,&cvars->esp_health);
  40. AddItem("esp_box",1,&cvars->esp_box);
  41. AddItem("esp_team",1,&cvars->esp_team);
  42. AddItem("esp_outline",1,&cvars->esp_outline);
  43.  
  44. AddSection("misc");
  45.  
  46. AddItem("misc_nospread",1,&cvars->misc_nospread);
  47. AddItem("misc_norecoil",2,&cvars->misc_norecoil);
  48. AddItem("misc_noeffects",1,&cvars->misc_noeffects);
  49. AddItem("misc_autopistol",1,&cvars->misc_autopistol);
  50. AddItem("misc_autohop",2,&cvars->misc_autohop);
  51. AddItem("misc_antiaim",1,&cvars->misc_antiaim);
  52. }
  53.  
  54. bool GUIManager::InputThink(int key)
  55. {
  56. if (key == 60 || key == 72)
  57. {
  58. if (sub != -1)
  59. {
  60. select = sub;
  61. sub = -1;
  62. }
  63. else
  64. menu = !menu;
  65.  
  66. for (int n=0; n <= count; ++n)
  67. {
  68.  
  69. }
  70.  
  71. return true;
  72. }
  73.  
  74. if (drawn == -1)
  75. return false;
  76.  
  77. if (key == 88 || key == 112)
  78. {
  79. --select;
  80.  
  81. if (select < 0)
  82. select = drawn;
  83.  
  84. return true;
  85. }
  86. else if (key == 90 || key == 113)
  87. {
  88. ++select;
  89.  
  90. if (select > drawn)
  91. select = 0;
  92.  
  93. return true;
  94. }
  95.  
  96. if (key == 89 || key == 107)
  97. {
  98. if (sub != -1)
  99. {
  100. MenuItem item = sections[sub].items[select];
  101.  
  102. ++item.val[0];
  103.  
  104. if (item.val[0] > item.max)
  105. item.val[0] = 0;
  106. }
  107. else
  108. {
  109. sub = select;
  110. select = 0;
  111. }
  112.  
  113. return true;
  114. }
  115. else if (key == 91 || key == 108)
  116. {
  117. if (sub != -1)
  118. {
  119. MenuItem item = sections[sub].items[select];
  120.  
  121. --item.val[0];
  122.  
  123. if (item.val[0] < 0)
  124. item.val[0] = item.max;
  125. }
  126. else
  127. {
  128. sub = select;
  129. select = 0;
  130. }
  131.  
  132. return true;
  133. }
  134.  
  135. return false;
  136. }
  137.  
  138. void GUIManager::Think()
  139. {
  140. if (!count)
  141. Init();
  142.  
  143. drawn = -1;
  144.  
  145. if (drawn != -1 && select > drawn)
  146. select = 0; // out of bounds by alternate menu
  147.  
  148. if (menu)
  149. DrawMenu();
  150. }
  151.  
  152. void GUIManager::DrawMenu()
  153. {
  154. if (GetAsyncKeyState(0x2E) & 1)
  155. drawMenu = !drawMenu;
  156.  
  157. if (!drawMenu)
  158. return;
  159.  
  160. drawn = count;
  161.  
  162. char str[128];
  163.  
  164. sprintf_s(str, "%s", hackstr);
  165.  
  166. vgui->SetTextColor(255, 255, 255);
  167.  
  168. float x = game->scrw*0.005;
  169. float y = game->scrh*0.025;
  170.  
  171. vgui->SetTextPos(x, y - 20);
  172. vgui->DrawText(str);
  173.  
  174. for (int i = 0; i <= count; ++i)
  175. {
  176. if (i == select)
  177. vgui->SetDrawColor(205, 205, 205);
  178. else
  179. vgui->SetDrawColor(155, 155, 155);
  180.  
  181. vgui->DrawRect(x, y, 140, 18);
  182.  
  183. if (items[i].val[0])
  184. vgui->SetDrawColor(105, 205, 105);
  185. else
  186. vgui->SetDrawColor(205, 105, 105);
  187.  
  188. vgui->DrawRect(x + 142, y, 36, 18);
  189.  
  190. vgui->SetDrawColor(0, 0, 0);
  191. vgui->DrawOutlined(x, y, 140, 18);
  192. vgui->DrawOutlined(x + 142, y, 36, 18);
  193.  
  194. vgui->SetTextColor(255, 255, 255);
  195. vgui->SetTextPos(x + 10, y);
  196. vgui->DrawText(items[i].name);
  197.  
  198. if (items[i].val[0])
  199. vgui->SetTextColor(55, 255, 55);
  200. else
  201. vgui->SetTextColor(255, 55, 55);
  202.  
  203. vgui->SetTextPos(x + 147, y);
  204.  
  205. if (items[i].val[0])
  206. {
  207. char str[16];
  208. if (items[i].max > 1)
  209. {
  210. sprintf_s(str, "%i", items[i].val[0]);
  211. vgui->DrawText(str);
  212. }
  213. else
  214. vgui->DrawText("on");
  215. }
  216. else
  217. vgui->DrawText("off");
  218.  
  219. y += 20;
  220. }
  221. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement