2 DisplayVoteBanMenu(client, target)
4 g_voteClient[VOTE_CLIENTID] = target;
5 g_voteClient[VOTE_USERID] = GetClientUserId(target);
7 GetClientName(target, g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]));
8 GetClientAuthString(target, g_voteInfo[VOTE_AUTHID], sizeof(g_voteInfo[]));
9 GetClientIP(target, g_voteInfo[VOTE_IP], sizeof(g_voteInfo[]));
11 LogAction(client, target, "\"%L\" initiated a ban vote against \"%L\"", client, target);
12 ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Ban", g_voteInfo[VOTE_NAME]);
14 g_voteType = voteType:ban;
16 g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
17 SetMenuTitle(g_hVoteMenu, "Voteban Player");
18 AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
19 AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
20 SetMenuExitButton(g_hVoteMenu, false);
21 VoteMenuToAll(g_hVoteMenu, 20);
24 DisplayBanTargetMenu(client)
26 new Handle:menu = CreateMenu(MenuHandler_Ban);
28 decl String:title[100];
29 Format(title, sizeof(title), "%T:", "Ban vote", client);
30 SetMenuTitle(menu, title);
31 SetMenuExitBackButton(menu, true);
33 AddTargetsToMenu(menu, client, false, false);
35 DisplayMenu(menu, client, MENU_TIME_FOREVER);
38 public AdminMenu_VoteBan(Handle:topmenu,
40 TopMenuObject:object_id,
45 if (action == TopMenuAction_DisplayOption)
47 Format(buffer, maxlength, "%T", "Ban vote", param);
49 else if (action == TopMenuAction_SelectOption)
51 DisplayBanTargetMenu(param);
53 else if (action == TopMenuAction_DrawOption)
55 /* disable this option if a vote is already running */
56 buffer[0] = !IsNewVoteAllowed() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
60 public MenuHandler_Ban(Handle:menu, MenuAction:action, param1, param2)
62 if (action == MenuAction_End)
66 else if (action == MenuAction_Cancel)
68 if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
70 DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
73 else if (action == MenuAction_Select)
75 decl String:info[32], String:name[32];
78 GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
79 userid = StringToInt(info);
81 if ((target = GetClientOfUserId(userid)) == 0)
83 PrintToChat(param1, "[SM] %t", "Player no longer available");
85 else if (!CanUserTarget(param1, target))
87 PrintToChat(param1, "[SM] %t", "Unable to target");
92 DisplayVoteBanMenu(param1, target);
97 public Action:Command_Voteban(client, args)
101 ReplyToCommand(client, "[SM] Usage: sm_voteban <player> [reason]");
102 return Plugin_Handled;
105 if (IsVoteInProgress())
107 ReplyToCommand(client, "[SM] %t", "Vote in Progress");
108 return Plugin_Handled;
111 if (!TestVoteDelay(client))
113 return Plugin_Handled;
116 decl String:text[256], String:arg[64];
117 GetCmdArgString(text, sizeof(text));
119 new len = BreakString(text, arg, sizeof(arg));
123 strcopy(g_voteArg, sizeof(g_voteArg), text[len]);
130 decl String:target_name[MAX_TARGET_LENGTH];
131 decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
133 if ((target_count = ProcessTargetString(
138 COMMAND_FILTER_NO_MULTI,
143 ReplyToTargetError(client, target_count);
144 return Plugin_Handled;
147 DisplayVoteBanMenu(client, target_list[0]);
149 return Plugin_Handled;