plugins/basecommands/cancelvote.sp
author Erik Minekus <erik@interwavestudios.com>
Wed Jun 23 23:41:47 2010 -0400 (2010-06-23)
changeset 3052 a102c645bf4b
parent 2289 44045ead61cd
permissions -rw-r--r--
Fixed lack of error checking on sm_motd. (bug 4460, r=dvander)
ds@1990
     1
/**
ds@1990
     2
 * vim: set ts=4 :
ds@1990
     3
 * =============================================================================
ds@1990
     4
 * SourceMod Basecommands Plugin
ds@1990
     5
 * Provides cancelvote functionality.
ds@1990
     6
 *
ds@1990
     7
 * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
ds@1990
     8
 * =============================================================================
ds@1990
     9
 *
ds@1990
    10
 * This program is free software; you can redistribute it and/or modify it under
ds@1990
    11
 * the terms of the GNU General Public License, version 3.0, as published by the
ds@1990
    12
 * Free Software Foundation.
ds@1990
    13
 * 
ds@1990
    14
 * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1990
    15
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1990
    16
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
ds@1990
    17
 * details.
ds@1990
    18
 *
ds@1990
    19
 * You should have received a copy of the GNU General Public License along with
ds@1990
    20
 * this program.  If not, see <http://www.gnu.org/licenses/>.
ds@1990
    21
 *
ds@1990
    22
 * As a special exception, AlliedModders LLC gives you permission to link the
ds@1990
    23
 * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1990
    24
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1990
    25
 * by the Valve Corporation.  You must obey the GNU General Public License in
ds@1990
    26
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
ds@1990
    27
 * this exception to all derivative works.  AlliedModders LLC defines further
ds@1990
    28
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1990
    29
 * or <http://www.sourcemod.net/license.php>.
ds@1990
    30
 *
ds@1990
    31
 * Version: $Id$
ds@1990
    32
 */
ds@1990
    33
 
ds@1990
    34
PerformCancelVote(client)
ds@1990
    35
{
ds@1990
    36
	if (!IsVoteInProgress())
ds@1990
    37
	{
ds@1990
    38
		ReplyToCommand(client, "[SM] %t", "Vote Not In Progress");
ds@1990
    39
		return;
ds@1990
    40
	}
ds@1990
    41
ds@1990
    42
	ShowActivity2(client, "[SM] ", "%t", "Cancelled Vote");
ds@1990
    43
	
ds@1990
    44
	CancelVote();
ds@1990
    45
}
ds@1990
    46
	
ds@1990
    47
public AdminMenu_CancelVote(Handle:topmenu, 
ds@1990
    48
							  TopMenuAction:action,
ds@1990
    49
							  TopMenuObject:object_id,
ds@1990
    50
							  param,
ds@1990
    51
							  String:buffer[],
ds@1990
    52
							  maxlength)
ds@1990
    53
{
ds@1990
    54
	if (action == TopMenuAction_DisplayOption)
ds@1990
    55
	{
ds@1990
    56
		Format(buffer, maxlength, "%T", "Cancel vote", param);
ds@1990
    57
	}
ds@1990
    58
	else if (action == TopMenuAction_SelectOption)
ds@1990
    59
	{
ds@1990
    60
		PerformCancelVote(param);
ds@1990
    61
		RedisplayAdminMenu(topmenu, param);	
ds@1990
    62
	}
ds@1990
    63
	else if (action == TopMenuAction_DrawOption)
ds@1990
    64
	{
ds@1990
    65
		buffer[0] = IsVoteInProgress() ? ITEMDRAW_DEFAULT : ITEMDRAW_IGNORE;
ds@1990
    66
	}
ds@1990
    67
}
ds@1990
    68
ds@1990
    69
public Action:Command_CancelVote(client, args)
ds@1990
    70
{
ds@1990
    71
	PerformCancelVote(client);
ds@1990
    72
ds@1990
    73
	return Plugin_Handled;
ds@1990
    74
}
ds@1990
    75