Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <cstrike>
  3.  
  4. //#pragma newdecls required
  5.  
  6. public Plugin myinfo =
  7. {
  8. name = "",
  9. author = "",
  10. description = "",
  11. version = "",
  12. url = ""
  13. };
  14.  
  15. public void OnPluginStart()
  16. {
  17. HookEvent("player_spawn", OnPlayerSpawn, EventHookMode_Post)
  18. RegConsoleCmd("sm_menu", CommandMenu, "Open the menu");
  19. }
  20.  
  21. public Action CommandMenu(int client, int args)
  22. {
  23. OpenTheMenu(client);
  24. return Plugin_Handled;
  25. }
  26.  
  27. void OpenTheMenu(int client)
  28. {
  29. if(IsValidClient(client))
  30. {
  31. Menu menu = CreateMenu(Menu_Handler);
  32. char varchar[64];
  33. Format(varchar, 64, "Menu - !menu");
  34. menu.SetTitle(varchar);
  35. Format(varchar, 64, "Choose your model - !models");
  36. menu.AddItem("0", varchar);
  37.  
  38. if(GetClientTeam(client) == CS_TEAM_T)
  39. {
  40. Format(varchar, 64, "Whistle (HIDERS) - !w");
  41. menu.AddItem("1", varchar);
  42. Format(varchar, 64, "Whistle by Skins (HIDERS) - !cw");
  43. menu.AddItem("2", varchar);
  44.  
  45. }
  46. else if(GetClientTeam(client) == CS_TEAM_CT)
  47. {
  48. Format(varchar, 64, "Force Whistle (SEEKERS) - !fw");
  49. menu.AddItem("3", varchar);
  50. Format(varchar, 64, "Force Whistle by Skins (SEEKERS) - !fcw");
  51. menu.AddItem("4", varchar);
  52. Format(varchar, 64, "Plant a lasermine (SEEKERS) - !lm");
  53. menu.AddItem("5", varchar);
  54. }
  55.  
  56. Format(varchar, 64, "Build a Ramp - !ramp");
  57. menu.AddItem("6", varchar);
  58. Format(varchar, 64, "Build a Floor - !floor");
  59. menu.AddItem("7", varchar);
  60. Format(varchar, 64, "Build a Wall - !wall");
  61. menu.AddItem("8", varchar);
  62. Format(varchar, 64, "Choose your knife - !knife");
  63. menu.AddItem("9", varchar);
  64. Format(varchar, 64, "Choose your weapon skin - !ws");
  65. menu.AddItem("10", varchar);
  66. Format(varchar, 64, "Choose your gloves - !gloves");
  67. menu.AddItem("11", varchar);
  68. Format(varchar, 64, "Toggle play third person - !tp");
  69. menu.AddItem("12", varchar);
  70. Format(varchar, 64, "Choose your hats - !hats");
  71. menu.AddItem("13", varchar)
  72. Format(varchar, 64, "Choose your tracers - !tracers");
  73. menu.AddItem("14", varchar)
  74. Format(varchar, 64, "See your rank - !rank");
  75. menu.AddItem("15", varchar);
  76. Format(varchar, 64, "Launch a RTV - !rtv");
  77. menu.AddItem("16", varchar);
  78. Format(varchar, 64, "Read the rules - !rules");
  79. menu.AddItem("17", varchar);
  80. menu.Display(client, MENU_TIME_FOREVER);
  81. }
  82. }
  83.  
  84. public Action OnPlayerSpawn(Event event, const char[] name, bool dontBroadcast)
  85. {
  86. int client = GetClientOfUserId(event.GetInt("userid"));
  87. if(IsValidClient(client))
  88. {
  89. OpenTheMenu(client);
  90. }
  91. }
  92.  
  93.  
  94. public int Menu_Handler(Menu menu, MenuAction action, int client, int param)
  95. {
  96. if(IsValidClient(client))
  97. {
  98. switch (action)
  99. {
  100. case MenuAction_Select:
  101. {
  102. new String:sIgnore[1], String:sItem[15], iIgnore;
  103. menu.GetItem(param, sItem, sizeof(sItem), iIgnore, sIgnore, sizeof(sIgnore));
  104.  
  105. new item = StringToInt(sItem);
  106.  
  107. switch (item)
  108. {
  109. case 0: ClientCommand(client, "sm_models");
  110. case 1: ClientCommand(client, "sm_w");
  111. case 2: ClientCommand(client, "sm_cw");
  112. case 3: ClientCommand(client, "sm_fw");
  113. case 4: ClientCommand(client, "sm_fcw");
  114. case 5: ClientCommand(client, "sm_lm");
  115. case 6: FakeClientCommand(client, "say !ramp");
  116. case 7: FakeClientCommand(client, "say !floor");
  117. case 8: FakeClientCommand(client, "say !wall");
  118. case 9: ClientCommand(client, "sm_knife");
  119. case 10: ClientCommand(client, "sm_ws");
  120. case 11: ClientCommand(client, "sm_gloves");
  121. case 12: ClientCommand(client, "sm_tp");
  122. case 13: FakeClientCommand(client, "say !hats");
  123. case 14: FakeClientCommand(client, "say !tracers");
  124. case 15: ClientCommand(client, "sm_rank");
  125. case 16: ClientCommand(client, "sm_rtv");
  126. case 17: ClientCommand(client, "sm_rules");
  127. }
  128. }
  129. case MenuAction_End: delete menu;
  130. }
  131. }
  132. }
  133.  
  134. bool IsValidClient(int client)
  135. {
  136. return client > 0 && client <= MaxClients && IsClientInGame(client) && !IsFakeClient(client);
  137. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement