Snorflake

shitty menu

Jul 21st, 2015
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. #pragma once
  2. #include "sdk.h"
  3. int MenuPosX = 20;
  4. int MenuPosY = 150;
  5. int TotalMenuItems;
  6. int CurrentMenuItem = 0;
  7. #define MAX_MENU_ITEMS 20
  8.  
  9. struct MenuItem
  10. {
  11. bool on;
  12. string name;
  13. int value;
  14. bool istitle;
  15. };
  16. class Menu
  17. {
  18. public:
  19. void DrawMenu()
  20. {
  21. //Visuals.DrawRect(MenuPosX, MenuPosY, 180, TotalMenuItems * 18 + 5, Color(100, 100, 100, 255));
  22. if (!enabled) return;
  23. for (int x = 0; x < TotalMenuItems; x++)
  24. {
  25. char optname[35];
  26. sprintf(optname, mi[x].istitle ? "[%s]" : "%s %s", mi[x].name.c_str(), mi[x].on ? "[ON]" : "[OFF]");
  27. Visuals.DrawStringD(MenuPosX + 5, MenuPosY + (18 * x), mi[x].istitle ? Color(255, 255, 255, 255) : (mi[x].on ? Color(0, 255, 0, 255) : Color(255, 0, 0, 255)), mi[x].name.c_str());
  28. if (mi[x].istitle)
  29. Visuals.DrawStringD(MenuPosX + 6, MenuPosY + (18 * x) + 1, Color(255, 255, 255, 255), mi[x].name.c_str());
  30. }
  31. Visuals.DrawStringD(MenuPosX - 15, MenuPosY + (18 * CurrentMenuItem), Color(255, 255, 255, 255), "--)");
  32. }
  33.  
  34. void AddItemToMenu(string name, bool title, bool onbydefault)
  35. {
  36. mi[TotalMenuItems].name = name;
  37. mi[TotalMenuItems].istitle = title;
  38. mi[TotalMenuItems].on = onbydefault;
  39. TotalMenuItems++;
  40. }
  41. void KeyboardInput()
  42. {
  43. if (GetAsyncKeyState(VK_INSERT))
  44. {
  45. Sleep(150);
  46. enabled = !enabled;
  47. }
  48. if (!enabled) return;
  49. if (CurrentMenuItem >= TotalMenuItems)
  50. {
  51. CurrentMenuItem = 0;
  52. }
  53. else if (CurrentMenuItem < 0)
  54. {
  55. CurrentMenuItem = (TotalMenuItems - 1);
  56. }
  57.  
  58. if (GetAsyncKeyState(VK_DOWN))
  59. {
  60. Sleep(150);
  61. CurrentMenuItem++;
  62. }
  63. if (GetAsyncKeyState(VK_UP))
  64. {
  65. Sleep(150);
  66. CurrentMenuItem--;
  67. }
  68. if (GetAsyncKeyState(VK_RIGHT) || GetAsyncKeyState(VK_LEFT))
  69. {
  70. Sleep(150);
  71. mi[CurrentMenuItem].on = !mi[CurrentMenuItem].on;
  72. }
  73. }
  74. bool IsOn(int index)
  75. {
  76. return mi[index].on;
  77. }
  78. private:
  79. MenuItem mi[MAX_MENU_ITEMS];
  80. bool enabled;
  81. };
  82.  
  83. extern Menu menu;
  84.  
  85. --
  86. how to init (only run it once)
  87. menu.AddItemToMenu("PLAYER", true, false);
  88. menu.AddItemToMenu("Bunny hop", false, true);
  89. menu.AddItemToMenu("Aimbot", false, false);
Advertisement
Add Comment
Please, Sign In to add comment