Advertisement
Hse

Untitled

Hse
Oct 30th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. #pragma semicolon 1
  2. #include <sourcemod>
  3. #include <colors>
  4.  
  5. new Handle:IgnoredMaps_Trie;
  6. new not_needed;
  7.  
  8. new bool:bInRound;
  9.  
  10. public Plugin:myinfo =
  11. {
  12. name = "[L4D2] t1 menu",
  13. author = "H.se",
  14. description = "t1 menu",
  15. }
  16. public OnPluginStart()
  17. {
  18. RegConsoleCmd("t1", t1Menu);
  19. HookEvent("player_left_start_area", EventHook:LeftStartAreaEvent);
  20. HookEvent("round_end", RoundEnd_Event, EventHookMode_PostNoCopy);
  21. HookEvent("round_start", RoundStart_Event, EventHookMode_PostNoCopy);
  22. IgnoredMaps_Trie = CreateTrie();
  23. SetTrieValue(IgnoredMaps_Trie, "c1m1_hotel", 1, true);
  24. }
  25.  
  26. public Action:t1Menu(client,args)
  27. {
  28. decl String:mapbuf[128];
  29. GetCurrentMap(mapbuf, sizeof(mapbuf));
  30. if (GetClientTeam(client) == 2 && bInRound == false && !GetTrieValue(IgnoredMaps_Trie, mapbuf, not_needed))
  31. {
  32. t1(client);
  33. return Plugin_Handled;
  34. }
  35. CPrintToChat(client, "{red}This command will be avaiable in the next round!");
  36. return Plugin_Handled;
  37. }
  38.  
  39.  
  40. public LeftStartAreaEvent(Handle:event, const String:name[], bool:dontBroadcast)
  41. {
  42. CreateTimer(10.0, Round);
  43. }
  44.  
  45. public RoundStart_Event(Handle:event, const String:name[], bool:dontBroadcast)
  46. {
  47. bInRound = false;
  48. }
  49.  
  50. public RoundEnd_Event(Handle:event, const String:name[], bool:dontBroadcast)
  51. {
  52. bInRound = false;
  53. }
  54.  
  55. public Action:Round(Handle:timer)
  56. {
  57. bInRound = true;
  58. }
  59.  
  60. public Action:t1(clientId) {
  61. new Handle:menu = CreateMenu(t1MenuHandler);
  62. SetMenuTitle(menu, "T1 weapons");
  63. AddMenuItem(menu, "option0", "Shotgun");
  64. AddMenuItem(menu, "option1", "Shotgun Chrome");
  65. AddMenuItem(menu, "option2", "SMG");
  66. AddMenuItem(menu, "option3", "SMG Silenced");
  67. SetMenuExitButton(menu, true);
  68. DisplayMenu(menu, clientId, MENU_TIME_FOREVER);
  69. }
  70. public t1MenuHandler(Handle:menu, MenuAction:action, client, itemNum)
  71. {
  72. new flags = GetCommandFlags("give");
  73. SetCommandFlags("give", flags & ~FCVAR_CHEAT);
  74.  
  75. if ( action == MenuAction_Select ) {
  76. switch (itemNum)
  77. {
  78.  
  79. case 0:
  80. {
  81. FakeClientCommand(client, "give pumpshotgun");
  82. }
  83. case 1:
  84. {
  85. FakeClientCommand(client, "give shotgun_chrome");
  86. }
  87. case 2:
  88. {
  89. FakeClientCommand(client, "give smg");
  90. }
  91. case 3:
  92. {
  93. FakeClientCommand(client, "give smg_silenced");
  94. }
  95. }
  96. }
  97. SetCommandFlags("give", flags|FCVAR_CHEAT);
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement