plugins/mapmanager/functions_menu.sp
author David Anderson <dvander@alliedmods.net>
Sat May 17 05:12:52 2008 +0000 (2008-05-17)
changeset 2056 f1fcde46ac7c
parent 1952 b7aa2b626807
permissions -rw-r--r--
added amb1119 - sm_revote command
     1 /**
     2  * vim: set ts=4 :
     3  * =============================================================================
     4  * SourceMod Map Management Plugin
     5  * Contains misc functions.
     6  *
     7  * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
     8  * =============================================================================
     9  *
    10  * This program is free software; you can redistribute it and/or modify it under
    11  * the terms of the GNU General Public License, version 3.0, as published by the
    12  * Free Software Foundation.
    13  * 
    14  * This program is distributed in the hope that it will be useful, but WITHOUT
    15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    16  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    17  * details.
    18  *
    19  * You should have received a copy of the GNU General Public License along with
    20  * this program.  If not, see <http://www.gnu.org/licenses/>.
    21  *
    22  * As a special exception, AlliedModders LLC gives you permission to link the
    23  * code of this program (as well as its derivative works) to "Half-Life 2," the
    24  * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    25  * by the Valve Corporation.  You must obey the GNU General Public License in
    26  * all respects for all other code used.  Additionally, AlliedModders LLC grants
    27  * this exception to all derivative works.  AlliedModders LLC defines further
    28  * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    29  * or <http://www.sourcemod.net/license.php>.
    30  *
    31  * Version: $Id$
    32  */
    33 
    34 DisplayWhenMenu(client, bool:vote = false)
    35 {
    36 	new Handle:
    37 	
    38 	if (!vote)
    39 	{
    40 		menu = CreateMenu(MenuHandler_ChangeMap);
    41 	}
    42 	else
    43 	{
    44 		menu = CreateMenu(MenuHandler_VoteWhen);
    45 	}
    46 	
    47 	decl String:title[100];
    48 	Format(title, sizeof(title), "%T:", "Map Change When", client);
    49 	SetMenuTitle(menu, title);
    50 	SetMenuExitBackButton(menu, true);
    51 	
    52 	AddMenuItem(menu, "i", "Immediately");
    53 	AddMenuItem(menu, "r", "Round End");
    54 	AddMenuItem(menu, "e", "Map End");
    55 	
    56 	DisplayMenu(menu, client, MENU_TIME_FOREVER);	
    57 }
    58 
    59 DisplayConfirmVoteMenu(client)
    60 {
    61 	new Handle:menu = CreateMenu(MenuHandler_Confirm);
    62 	
    63 	decl String:title[100];
    64 	Format(title, sizeof(title), "%T:", "Confirm Vote", client);
    65 	SetMenuTitle(menu, title);
    66 	SetMenuExitBackButton(menu, true);
    67 	
    68 	AddMenuItem(menu, "Confirm", "Start the Vote");
    69 	
    70 	DisplayMenu(menu, client, MENU_TIME_FOREVER);	
    71 }
    72 
    73 DisplayAcceptVoteMenu(String:map[])
    74 {
    75 	new Handle:menu = CreateMenu(MenuHandler_Accept);
    76 	
    77 	decl String:title[100];
    78 	Format(title, sizeof(title), "%T:", "Accept Vote", client);
    79 	SetMenuTitle(menu, title);
    80 	SetMenuExitBackButton(menu, true);
    81 	
    82 	AddMenuItem(menu, map, "Accept Vote");
    83 	
    84 	DisplayMenu(menu, g_VoteMapInUse, MENU_TIME_FOREVER);	
    85 }
    86 
    87 DisplayVoteMapMenu(client, mapCount, String:maps[5][])
    88 {
    89 	LogAction(client, -1, "\"%L\" initiated a map vote.", client);
    90 	ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Map");
    91 	
    92 	new Handle:menu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
    93 	
    94 	if (mapCount == 1)
    95 	{
    96 		//strcopy(g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]), maps[0]);
    97 			
    98 		SetMenuTitle(menu, "Change Map To");
    99 		AddMenuItem(menu, maps[0], "Yes");
   100 		AddMenuItem(menu, VOTE_NO, "No");
   101 	}
   102 	else
   103 	{
   104 		//g_voteInfo[VOTE_NAME][0] = '\0';
   105 		
   106 		SetMenuTitle(menu, "Map Vote");
   107 		for (new i = 0; i < mapCount; i++)
   108 		{
   109 			AddMenuItem(menu, maps[i], maps[i]);
   110 		}	
   111 	}
   112 	
   113 	SetMenuExitButton(menu, false);
   114 	VoteMenuToAll(menu, 20);		
   115 }