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