plugins/basefunvotes/voteff.sp
author Michael McKoy <ferret99gt@gmail.com>
Fri Nov 09 23:46:05 2007 +0000 (2007-11-09)
changeset 1664 e054be79e28a
parent 1625 8e4a6a8c3256
child 1789 55172f6df9a4
permissions -rw-r--r--
New adt_array functions: CloneArray, FindStringInArray, FindCellInArray
Adjusted mapchooser/randomcycle/rockthevote and LoadMaps stock to use new array functions
     1 DisplayVoteFFMenu(client)
     2 {
     3 	if (IsVoteInProgress())
     4 	{
     5 		ReplyToCommand(client, "[SM] %t", "Vote in Progress");
     6 		return;
     7 	}	
     8 	
     9 	if (!TestVoteDelay(client))
    10 	{
    11 		return;
    12 	}
    13 	
    14 	LogAction(client, -1, "\"%L\" initiated a friendly fire vote.", client);
    15 	ShowActivity2(client, "[SM] ", "%t", "Initiated Vote FF");
    16 	
    17 	g_voteType = voteType:ff;
    18 	g_voteInfo[VOTE_NAME][0] = '\0';
    19 	
    20 	g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
    21 	
    22 	if (GetConVarBool(g_Cvar_Alltalk))
    23 	{
    24 		SetMenuTitle(g_hVoteMenu, "Voteff Off");
    25 	}
    26 	else
    27 	{
    28 		SetMenuTitle(g_hVoteMenu, "Voteff On");
    29 	}
    30 	
    31 	AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
    32 	AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
    33 	SetMenuExitButton(g_hVoteMenu, false);
    34 	VoteMenuToAll(g_hVoteMenu, 20);
    35 }
    36 
    37 public AdminMenu_VoteFF(Handle:topmenu, 
    38 							  TopMenuAction:action,
    39 							  TopMenuObject:object_id,
    40 							  param,
    41 							  String:buffer[],
    42 							  maxlength)
    43 {
    44 	if (action == TopMenuAction_DisplayOption)
    45 	{
    46 		Format(buffer, maxlength, "%T", "Vote FF", param);
    47 	}
    48 	else if (action == TopMenuAction_SelectOption)
    49 	{
    50 		DisplayVoteFFMenu(param);
    51 	}
    52 	else if (action == TopMenuAction_DrawOption)
    53 	{	
    54 		/* disable this option if a vote is already running */
    55 		buffer[0] = !IsNewVoteAllowed() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
    56 	}
    57 }
    58 
    59 public Action:Command_VoteFF(client, args)
    60 {
    61 	if (args > 0)
    62 	{
    63 		ReplyToCommand(client, "[SM] Usage: sm_voteff");
    64 		return Plugin_Handled;	
    65 	}
    66 	
    67 	DisplayVoteFFMenu(client);
    68 	
    69 	return Plugin_Handled;
    70 }