plugins/mapmanager/functions_menu.sp
branchsourcemod-1.1.0
changeset 1807 a0de5251fb1a
child 1947 e73a1e51833b
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/plugins/mapmanager/functions_menu.sp	Wed Dec 19 22:19:34 2007 +0000
     1.3 @@ -0,0 +1,115 @@
     1.4 +/**
     1.5 + * vim: set ts=4 :
     1.6 + * =============================================================================
     1.7 + * SourceMod Map Management Plugin
     1.8 + * Contains misc functions.
     1.9 + *
    1.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
    1.11 + * =============================================================================
    1.12 + *
    1.13 + * This program is free software; you can redistribute it and/or modify it under
    1.14 + * the terms of the GNU General Public License, version 3.0, as published by the
    1.15 + * Free Software Foundation.
    1.16 + * 
    1.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
    1.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    1.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    1.20 + * details.
    1.21 + *
    1.22 + * You should have received a copy of the GNU General Public License along with
    1.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
    1.24 + *
    1.25 + * As a special exception, AlliedModders LLC gives you permission to link the
    1.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
    1.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    1.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
    1.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
    1.30 + * this exception to all derivative works.  AlliedModders LLC defines further
    1.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    1.32 + * or <http://www.sourcemod.net/license.php>.
    1.33 + *
    1.34 + * Version: $Id$
    1.35 + */
    1.36 +
    1.37 +DisplayWhenMenu(client, bool:vote = false)
    1.38 +{
    1.39 +	new Handle:
    1.40 +	
    1.41 +	if (!vote)
    1.42 +	{
    1.43 +		menu = CreateMenu(MenuHandler_ChangeMap);
    1.44 +	}
    1.45 +	else
    1.46 +	{
    1.47 +		menu = CreateMenu(MenuHandler_VoteWhen);
    1.48 +	}
    1.49 +	
    1.50 +	decl String:title[100];
    1.51 +	Format(title, sizeof(title), "%T:", "Map Change When", client);
    1.52 +	SetMenuTitle(menu, title);
    1.53 +	SetMenuExitBackButton(menu, true);
    1.54 +	
    1.55 +	AddMenuItem(menu, "i", "Immediately");
    1.56 +	AddMenuItem(menu, "r", "Round End");
    1.57 +	AddMenuItem(menu, "e", "Map End");
    1.58 +	
    1.59 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);	
    1.60 +}
    1.61 +
    1.62 +DisplayConfirmVoteMenu(client)
    1.63 +{
    1.64 +	new Handle:menu = CreateMenu(MenuHandler_Confirm);
    1.65 +	
    1.66 +	decl String:title[100];
    1.67 +	Format(title, sizeof(title), "%T:", "Confirm Vote", client);
    1.68 +	SetMenuTitle(menu, title);
    1.69 +	SetMenuExitBackButton(menu, true);
    1.70 +	
    1.71 +	AddMenuItem(menu, "Confirm", "Start the Vote");
    1.72 +	
    1.73 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);	
    1.74 +}
    1.75 +
    1.76 +DisplayAcceptVoteMenu(String:map[])
    1.77 +{
    1.78 +	new Handle:menu = CreateMenu(MenuHandler_Accept);
    1.79 +	
    1.80 +	decl String:title[100];
    1.81 +	Format(title, sizeof(title), "%T:", "Accept Vote", client);
    1.82 +	SetMenuTitle(menu, title);
    1.83 +	SetMenuExitBackButton(menu, true);
    1.84 +	
    1.85 +	AddMenuItem(menu, map, "Accept Vote");
    1.86 +	
    1.87 +	DisplayMenu(menu, g_VoteMapInUse, MENU_TIME_FOREVER);	
    1.88 +}
    1.89 +
    1.90 +DisplayVoteMapMenu(client, mapCount, String:maps[5][])
    1.91 +{
    1.92 +	LogAction(client, -1, "\"%L\" initiated a map vote.", client);
    1.93 +	ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Map");
    1.94 +	
    1.95 +	new Handle:menu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
    1.96 +	
    1.97 +	if (mapCount == 1)
    1.98 +	{
    1.99 +		//strcopy(g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]), maps[0]);
   1.100 +			
   1.101 +		SetMenuTitle(menu, "Change Map To");
   1.102 +		AddMenuItem(menu, maps[0], "Yes");
   1.103 +		AddMenuItem(menu, VOTE_NO, "No");
   1.104 +	}
   1.105 +	else
   1.106 +	{
   1.107 +		//g_voteInfo[VOTE_NAME][0] = '\0';
   1.108 +		
   1.109 +		SetMenuTitle(menu, "Map Vote");
   1.110 +		for (new i = 0; i < mapCount; i++)
   1.111 +		{
   1.112 +			AddMenuItem(menu, maps[i], maps[i]);
   1.113 +		}	
   1.114 +	}
   1.115 +	
   1.116 +	SetMenuExitButton(menu, false);
   1.117 +	VoteMenuToAll(menu, 20);		
   1.118 +}