Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #include <sourcemod>
- #include <colors>
- new Handle:IgnoredMaps_Trie;
- new not_needed;
- new bool:bInRound;
- public Plugin:myinfo =
- {
- name = "[L4D2] t1 menu",
- author = "H.se",
- description = "t1 menu",
- }
- public OnPluginStart()
- {
- RegConsoleCmd("t1", t1Menu);
- HookEvent("player_left_start_area", EventHook:LeftStartAreaEvent);
- HookEvent("round_end", RoundEnd_Event, EventHookMode_PostNoCopy);
- HookEvent("round_start", RoundStart_Event, EventHookMode_PostNoCopy);
- IgnoredMaps_Trie = CreateTrie();
- SetTrieValue(IgnoredMaps_Trie, "c1m1_hotel", 1, true);
- }
- public Action:t1Menu(client,args)
- {
- decl String:mapbuf[128];
- GetCurrentMap(mapbuf, sizeof(mapbuf));
- if (GetClientTeam(client) == 2 && bInRound == false && !GetTrieValue(IgnoredMaps_Trie, mapbuf, not_needed))
- {
- t1(client);
- return Plugin_Handled;
- }
- CPrintToChat(client, "{red}This command will be avaiable in the next round!");
- return Plugin_Handled;
- }
- public LeftStartAreaEvent(Handle:event, const String:name[], bool:dontBroadcast)
- {
- CreateTimer(10.0, Round);
- }
- public RoundStart_Event(Handle:event, const String:name[], bool:dontBroadcast)
- {
- bInRound = false;
- }
- public RoundEnd_Event(Handle:event, const String:name[], bool:dontBroadcast)
- {
- bInRound = false;
- }
- public Action:Round(Handle:timer)
- {
- bInRound = true;
- }
- public Action:t1(clientId) {
- new Handle:menu = CreateMenu(t1MenuHandler);
- SetMenuTitle(menu, "T1 weapons");
- AddMenuItem(menu, "option0", "Shotgun");
- AddMenuItem(menu, "option1", "Shotgun Chrome");
- AddMenuItem(menu, "option2", "SMG");
- AddMenuItem(menu, "option3", "SMG Silenced");
- SetMenuExitButton(menu, true);
- DisplayMenu(menu, clientId, MENU_TIME_FOREVER);
- }
- public t1MenuHandler(Handle:menu, MenuAction:action, client, itemNum)
- {
- new flags = GetCommandFlags("give");
- SetCommandFlags("give", flags & ~FCVAR_CHEAT);
- if ( action == MenuAction_Select ) {
- switch (itemNum)
- {
- case 0:
- {
- FakeClientCommand(client, "give pumpshotgun");
- }
- case 1:
- {
- FakeClientCommand(client, "give shotgun_chrome");
- }
- case 2:
- {
- FakeClientCommand(client, "give smg");
- }
- case 3:
- {
- FakeClientCommand(client, "give smg_silenced");
- }
- }
- }
- SetCommandFlags("give", flags|FCVAR_CHEAT);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement