3 * =============================================================================
4 * SourceMod Basefunvotes Plugin
5 * Provides votealltalk functionality
7 * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
8 * =============================================================================
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.
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
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/>.
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>.
34 DisplayVoteAllTalkMenu(client)
36 if (IsVoteInProgress())
38 ReplyToCommand(client, "[SM] %t", "Vote in Progress");
42 if (!TestVoteDelay(client))
47 LogAction(client, -1, "\"%L\" initiated an alltalk vote.", client);
48 ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Alltalk");
50 g_voteType = voteType:alltalk;
51 g_voteInfo[VOTE_NAME][0] = '\0';
53 g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
55 if (GetConVarBool(g_Cvar_Alltalk))
57 SetMenuTitle(g_hVoteMenu, "Votealltalk Off");
61 SetMenuTitle(g_hVoteMenu, "Votealltalk On");
64 AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
65 AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
66 SetMenuExitButton(g_hVoteMenu, false);
67 VoteMenuToAll(g_hVoteMenu, 20);
71 public AdminMenu_VoteAllTalk(Handle:topmenu,
73 TopMenuObject:object_id,
78 if (action == TopMenuAction_DisplayOption)
80 Format(buffer, maxlength, "%T", "Alltalk vote", param);
82 else if (action == TopMenuAction_SelectOption)
84 DisplayVoteAllTalkMenu(param);
86 else if (action == TopMenuAction_DrawOption)
88 /* disable this option if a vote is already running */
89 buffer[0] = !IsNewVoteAllowed() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
93 public Action:Command_VoteAlltalk(client, args)
97 ReplyToCommand(client, "[SM] Usage: sm_votealltalk");
98 return Plugin_Handled;
101 DisplayVoteAllTalkMenu(client);
103 return Plugin_Handled;