Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 KB | None | 0 0
  1. #include <sourcemod>
  2. #pragma newdecls required
  3.  
  4. public Plugin myinfo =
  5. {
  6. name = "",
  7. author = "",
  8. description = "",
  9. version = "",
  10. url = ""
  11. };
  12.  
  13. public void OnPluginStart()
  14. {
  15. HookEvent("player_spawn", OnPlayerSpawn, EventHookMode_Post)
  16. RegConsoleCmd("sm_menu", CommandMenu, "Open the menu");
  17. }
  18.  
  19. public Action CommandMenu(int client, int args)
  20. {
  21. OpenTheMenu(client);
  22. return Plugin_Handled;
  23. }
  24.  
  25. void OpenTheMenu(int client)
  26. {
  27. if(IsValidClient(client))
  28. {
  29. Menu menu = CreateMenu(Menu_Handler);
  30. char varchar[64];
  31. Format(varchar, 64, "Menu - !menu");
  32. menu.SetTitle(varchar);
  33. Format(varchar, 64, "Choose your model - !models");
  34. menu.AddItem("", varchar);
  35. Format(varchar, 64, "Choose your knife - !knife");
  36. menu.AddItem("", varchar);
  37. Format(varchar, 64, "Choose your weapon skin - !ws");
  38. menu.AddItem("", varchar);
  39. Format(varchar, 64, "Choose your gloves - !gloves");
  40. menu.AddItem("", varchar);
  41. Format(varchar, 64, "Whistle (HIDERS) - !w");
  42. menu.AddItem("", varchar);
  43. Format(varchar, 64, "Force Whistle (SEEKERS) - !fw");
  44. menu.AddItem("", varchar);
  45. Format(varchar, 64, "Plant a lasermine (SEEKERS) - !lm");
  46. menu.AddItem("", varchar);
  47. Format(varchar, 64, "Toggle nightvision - !nvg");
  48. menu.AddItem("", varchar);
  49. Format(varchar, 64, "Toggle play third person - !tp");
  50. menu.AddItem("", varchar);
  51. Format(varchar, 64, "Ambient sounds settings - !rss");
  52. menu.AddItem("", varchar);
  53. Format(varchar, 64, "See your rank - !rank");
  54. menu.AddItem("", varchar);
  55. Format(varchar, 64, "Launch a RTV - !rtv");
  56. menu.AddItem("", varchar);
  57. Format(varchar, 64, "Read the rules - !rules");
  58. menu.AddItem("", varchar);
  59. menu.Display(client, MENU_TIME_FOREVER);
  60. }
  61. }
  62.  
  63. public Action OnPlayerSpawn(Event event, const char[] name, bool dontBroadcast)
  64. {
  65. int client = GetClientOfUserId(event.GetInt("userid"));
  66. if(IsValidClient(client))
  67. {
  68. OpenTheMenu(client);
  69. }
  70. }
  71.  
  72.  
  73. public int Menu_Handler(Menu menu, MenuAction action, int client, int param)
  74. {
  75. if(IsValidClient(client))
  76. {
  77. switch (action)
  78. {
  79. case MenuAction_Select:
  80. {
  81. switch (param)
  82. {
  83. case 0: ClientCommand(client, "sm_models");
  84. case 1: ClientCommand(client, "sm_knife");
  85. case 2: ClientCommand(client, "sm_ws");
  86. case 3: ClientCommand(client, "sm_gloves");
  87. case 4: ClientCommand(client, "sm_whistle");
  88. case 5: ClientCommand(client, "sm_forcewhistle");
  89. case 6: ClientCommand(client, "sm_lm");
  90. case 7: ClientCommand(client, "sm_nvg");
  91. case 8: ClientCommand(client, "sm_tp");
  92. case 9: ClientCommand(client, "rss");
  93. case 10: ClientCommand(client, "sm_rank");
  94. case 11: ClientCommand(client, "sm_rtv");
  95. case 12: ClientCommand(client, "sm_rules");
  96.  
  97. }
  98. }
  99. case MenuAction_End: delete menu;
  100. }
  101. }
  102. }
  103.  
  104. bool IsValidClient(int client)
  105. {
  106. return client > 0 && client <= MaxClients && IsClientInGame(client) && !IsFakeClient(client);
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement