sourcemod/plugins/basecommands/cancelvote.sp
David Anderson a130fede3a added note about TopMenuAction_DrawOption
Cancel vote option now only appears if a vote is in progress

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401530
2007-10-02 14:42:38 +00:00

51 lines
825 B
SourcePawn

PerformCancelVote(client)
{
if (!IsVoteInProgress())
{
ReplyToCommand(client, "[SM] %t", "Vote Not In Progress");
return;
}
ShowActivity(client, "%t", "Cancelled Vote");
CancelVote();
}
public AdminMenu_CancelVote(Handle:topmenu,
TopMenuAction:action,
TopMenuObject:object_id,
param,
String:buffer[],
maxlength)
{
if (action == TopMenuAction_DrawOption)
{
Format(buffer, maxlength, "%T", "Cancel vote", param);
if (IsVoteInProgress())
{
return ITEMDRAW_DEFAULT;
}
else
{
return ITEMDRAW_IGNORE;
}
}
else if (action == TopMenuAction_SelectOption)
{
PerformCancelVote(param);
RedisplayAdminMenu(topmenu, param);
}
return 0;
}
public Action:Command_CancelVote(client, args)
{
PerformCancelVote(client);
return Plugin_Handled;
}