[Half-Life AMXX] / adminvote.sma Repository:
ViewVC logotype

Annotation of /adminvote.sma

Parent Directory Parent Directory | Revision Log Revision Log


Revision 17 - (view) (download)

1 : ian 1 /* AMX Mod X
2 :     * Admin Votes Plugin
3 :     *
4 :     * by the AMX Mod X Development Team
5 :     * originally developed by OLO
6 :     *
7 :     * This file is part of AMX Mod X.
8 :     *
9 :     *
10 :     * This program is free software; you can redistribute it and/or modify it
11 :     * under the terms of the GNU General Public License as published by the
12 :     * Free Software Foundation; either version 2 of the License, or (at
13 :     * your option) any later version.
14 :     *
15 :     * This program is distributed in the hope that it will be useful, but
16 :     * WITHOUT ANY WARRANTY; without even the implied warranty of
17 :     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 :     * General Public License for more details.
19 :     *
20 :     * You should have received a copy of the GNU General Public License
21 :     * along with this program; if not, write to the Free Software Foundation,
22 :     * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 :     *
24 :     * In addition, as a special exception, the author gives permission to
25 :     * link the code of this program with the Half-Life Game Engine ("HL
26 :     * Engine") and Modified Game Libraries ("MODs") developed by Valve,
27 :     * L.L.C ("Valve"). You must obey the GNU General Public License in all
28 :     * respects for all of the code used other than the HL Engine and MODs
29 :     * from Valve. If you modify this file, you may extend this exception
30 :     * to your version of the file, but you are not obligated to do so. If
31 :     * you do not wish to do so, delete this exception statement from your
32 :     * version.
33 :     */
34 :    
35 :     #include <amxmodx>
36 :     #include <amxmisc>
37 :    
38 : ian 17
39 : ian 1 new g_Answer[128]
40 : ian 17 new g_optionName[4][64]
41 : ian 1 new g_voteCount[4]
42 :     new g_validMaps
43 :     new g_yesNoVote
44 :     new g_coloredMenus
45 :     new g_voteCaller
46 :     new g_Execute[256]
47 :     new g_execLen
48 :    
49 :     new bool:g_execResult
50 :     new Float:g_voteRatio
51 :    
52 :     public plugin_init()
53 :     {
54 :     register_plugin("Admin Votes", AMXX_VERSION_STR, "AMXX Dev Team")
55 :     register_dictionary("adminvote.txt")
56 :     register_dictionary("common.txt")
57 :     register_dictionary("mapsmenu.txt")
58 :     register_menucmd(register_menuid("Change map to "), MENU_KEY_1|MENU_KEY_2, "voteCount")
59 :     register_menucmd(register_menuid("Choose map: "), MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4, "voteCount")
60 :     register_menucmd(register_menuid("Kick "), MENU_KEY_1|MENU_KEY_2, "voteCount")
61 :     register_menucmd(register_menuid("Ban "), MENU_KEY_1|MENU_KEY_2, "voteCount")
62 : ian 17 register_menucmd(register_menuid("Vote: "), MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4, "voteCount")
63 : ian 1 register_menucmd(register_menuid("The result: "), MENU_KEY_1|MENU_KEY_2, "actionResult")
64 :     register_concmd("amx_votemap", "cmdVoteMap", ADMIN_VOTE, "<map> [map] [map] [map]")
65 :     register_concmd("amx_votekick", "cmdVoteKickBan", ADMIN_VOTE, "<name or #userid>")
66 :     register_concmd("amx_voteban", "cmdVoteKickBan", ADMIN_VOTE, "<name or #userid>")
67 :     register_concmd("amx_vote", "cmdVote", ADMIN_VOTE, "<question> <answer#1> <answer#2>")
68 :     register_concmd("amx_cancelvote", "cmdCancelVote", ADMIN_VOTE, "- cancels last vote")
69 :    
70 :     g_coloredMenus = colored_menus()
71 :     }
72 :    
73 :     public cmdCancelVote(id, level, cid)
74 :     {
75 :     if (!cmd_access(id, level, cid, 0))
76 :     return PLUGIN_HANDLED
77 :    
78 :     if (task_exists(99889988, 1))
79 :     {
80 :     new authid[32], name[32]
81 :    
82 :     get_user_authid(id, authid, 31)
83 :     get_user_name(id, name, 31)
84 :     log_amx("Vote: ^"%s<%d><%s><>^" cancel vote session", name, get_user_userid(id), authid)
85 : ian 17
86 :    
87 :     new maxpl=get_maxplayers();
88 :     new msg[256];
89 :     for (new i = 1; i <= maxpl; i++)
90 : ian 1 {
91 : ian 17 if (is_user_connected(i) && !is_user_bot(i))
92 : ian 1 {
93 : ian 17 // HACK: ADMIN_CANC_VOTE_{1,2} keys were designed very poorly. Remove all : and %s in it.
94 :     LookupLangKey(msg, charsmax(msg), "ADMIN_CANC_VOTE_1", i);
95 :     replace_all(msg, charsmax(msg), "%s", "");
96 :     replace_all(msg, charsmax(msg), ":", "");
97 :     trim(msg);
98 :     show_activity_id(i, id, name, msg);
99 : ian 1 }
100 :     }
101 :    
102 :     console_print(id, "%L", id, "VOTING_CANC")
103 :     client_print(0,print_chat,"%L",LANG_PLAYER,"VOTING_CANC")
104 :     remove_task(99889988, 1)
105 :     set_cvar_float("amx_last_voting", get_gametime())
106 :     }
107 :     else
108 :     console_print(id, "%L", id, "NO_VOTE_CANC")
109 :    
110 :     return PLUGIN_HANDLED
111 :     }
112 :    
113 :     public delayedExec(cmd[])
114 :     server_cmd("%s", cmd)
115 :    
116 :     public autoRefuse()
117 :     {
118 :     log_amx("Vote: %L", "en", "RES_REF")
119 :     client_print(0, print_chat, "%L", LANG_PLAYER, "RES_REF")
120 :     }
121 :    
122 :     public actionResult(id, key)
123 :     {
124 :     remove_task(4545454)
125 :    
126 :     switch (key)
127 :     {
128 :     case 0:
129 :     {
130 :     set_task(2.0, "delayedExec", 0, g_Execute, g_execLen)
131 :     log_amx("Vote: %L", "en", "RES_ACCEPTED")
132 :     client_print(0, print_chat, "%L", LANG_PLAYER, "RES_ACCEPTED")
133 :     }
134 :     case 1: autoRefuse()
135 :     }
136 :    
137 :     return PLUGIN_HANDLED
138 :     }
139 :    
140 :     public checkVotes()
141 :     {
142 :     new best = 0
143 :    
144 :     if (!g_yesNoVote)
145 :     {
146 :     for (new a = 0; a < 4; ++a)
147 :     if (g_voteCount[a] > g_voteCount[best])
148 :    
149 :     best = a
150 :     }
151 :    
152 :     new votesNum = g_voteCount[0] + g_voteCount[1] + g_voteCount[2] + g_voteCount[3]
153 :     new iRatio = votesNum ? floatround(g_voteRatio * float(votesNum), floatround_ceil) : 1
154 :     new iResult = g_voteCount[best]
155 :     new players[32], pnum, i
156 :    
157 :     get_players(players, pnum, "c")
158 :    
159 :     if (iResult < iRatio)
160 :     {
161 :     new lVotingFailed[64]
162 :    
163 :     for (i = 0; i < pnum; i++)
164 :     {
165 :     format(lVotingFailed, 63, "%L", players[i], "VOTING_FAILED")
166 :     if (g_yesNoVote)
167 :     client_print(players[i], print_chat, "%L", players[i], "VOTING_RES_1", lVotingFailed, g_voteCount[0], g_voteCount[1], iRatio)
168 :     else
169 :     client_print(players[i], print_chat, "%L", players[i], "VOTING_RES_2", lVotingFailed, iResult, iRatio)
170 :     }
171 :    
172 :     format(lVotingFailed, 63, "%L", "en", "VOTING_FAILED")
173 :     log_amx("Vote: %s (got ^"%d^") (needed ^"%d^")", lVotingFailed, iResult, iRatio)
174 :    
175 :     return PLUGIN_CONTINUE
176 :     }
177 :    
178 :     g_execLen = format(g_Execute, 255, g_Answer, g_optionName[best]) + 1
179 :    
180 :     if (g_execResult)
181 :     {
182 :     g_execResult = false
183 :    
184 :     if (is_user_connected(g_voteCaller))
185 :     {
186 :     new menuBody[512], lTheResult[32], lYes[16], lNo[16]
187 :    
188 :     format(lTheResult, 31, "%L", g_voteCaller, "THE_RESULT")
189 :     format(lYes, 15, "%L", g_voteCaller, "YES")
190 :     format(lNo, 15, "%L", g_voteCaller, "NO")
191 :    
192 :     new len = format(menuBody, 511, g_coloredMenus ? "\y%s: \w%s^n^n" : "%s: %s^n^n", lTheResult, g_Execute)
193 :    
194 :     len += format(menuBody[len], 511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", g_voteCaller, "WANT_CONTINUE")
195 :     format(menuBody[len], 511 - len, "^n1. %s^n2. %s", lYes, lNo)
196 :     show_menu(g_voteCaller, 0x03, menuBody, 10, "The result: ")
197 :     set_task(10.0, "autoRefuse", 4545454)
198 :     }
199 :     else
200 :     set_task(2.0, "delayedExec", 0, g_Execute, g_execLen)
201 :     }
202 :    
203 :     new lVotingSuccess[32]
204 :    
205 :     for (i = 0; i < pnum; i++)
206 :     {
207 :     format(lVotingSuccess, 31, "%L", players[i], "VOTING_SUCCESS")
208 :     client_print(players[i], print_chat, "%L", players[i], "VOTING_RES_3", lVotingSuccess, iResult, iRatio, g_Execute)
209 :     }
210 :    
211 :     format(lVotingSuccess, 31, "%L", "en", "VOTING_SUCCESS")
212 :     log_amx("Vote: %s (got ^"%d^") (needed ^"%d^") (result ^"%s^")", lVotingSuccess, iResult, iRatio, g_Execute)
213 :    
214 :     return PLUGIN_CONTINUE
215 :     }
216 :    
217 :     public voteCount(id, key)
218 :     {
219 :     if (get_cvar_num("amx_vote_answers"))
220 :     {
221 :     new name[32]
222 :     get_user_name(id, name, 31)
223 :    
224 :     if (g_yesNoVote)
225 :     client_print(0, print_chat, "%L", LANG_PLAYER, key ? "VOTED_AGAINST" : "VOTED_FOR", name)
226 :     else
227 :     client_print(0, print_chat, "%L", LANG_PLAYER, "VOTED_FOR_OPT", name, key + 1)
228 :     }
229 :     ++g_voteCount[key]
230 :    
231 :     return PLUGIN_HANDLED
232 :     }
233 :    
234 :     public cmdVoteMap(id, level, cid)
235 :     {
236 :     if (!cmd_access(id, level, cid, 2))
237 :     return PLUGIN_HANDLED
238 :    
239 :     new Float:voting = get_cvar_float("amx_last_voting")
240 :     if (voting > get_gametime())
241 :     {
242 :     console_print(id, "%L", id, "ALREADY_VOTING")
243 :     return PLUGIN_HANDLED
244 :     }
245 :    
246 :     if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
247 :     {
248 :     console_print(id, "%L", id, "VOTING_NOT_ALLOW")
249 :     return PLUGIN_HANDLED
250 :     }
251 :    
252 :     new argc = read_argc()
253 :     if (argc > 5) argc = 5
254 :    
255 :     g_validMaps = 0
256 :     g_optionName[0][0] = 0
257 :     g_optionName[1][0] = 0
258 :     g_optionName[2][0] = 0
259 :     g_optionName[3][0] = 0
260 :    
261 :     for (new i = 1; i < argc; ++i)
262 :     {
263 :     read_argv(i, g_optionName[g_validMaps], 31)
264 :    
265 :     if (is_map_valid(g_optionName[g_validMaps]))
266 :     g_validMaps++
267 :     }
268 :    
269 :     if (g_validMaps == 0)
270 :     {
271 :     new lMaps[16]
272 :    
273 :     format(lMaps, 15, "%L", id, (argc == 2) ? "MAP_IS" : "MAPS_ARE")
274 :     console_print(id, "%L", id, "GIVEN_NOT_VALID", lMaps)
275 :     return PLUGIN_HANDLED
276 :     }
277 :    
278 :     new menu_msg[256], len = 0
279 :     new keys = 0
280 :    
281 :     if (g_validMaps > 1)
282 :     {
283 :     keys = MENU_KEY_0
284 :     len = format(menu_msg, 255, g_coloredMenus ? "\y%L: \w^n^n" : "%L: ^n^n", LANG_SERVER, "CHOOSE_MAP")
285 :     new temp[128]
286 :    
287 :     for (new a = 0; a < g_validMaps; ++a)
288 :     {
289 :     format(temp, 127, "%d. %s^n", a+1, g_optionName[a])
290 :     len += copy(menu_msg[len], 255-len, temp)
291 :     keys |= (1<<a)
292 :     }
293 :    
294 :     format(menu_msg[len], 255-len, "^n0. %L", LANG_SERVER, "NONE")
295 :     g_yesNoVote = 0
296 :     } else {
297 :     new lChangeMap[32], lYes[16], lNo[16]
298 :    
299 :     format(lChangeMap, 31, "%L", LANG_SERVER, "CHANGE_MAP_TO")
300 :     format(lYes, 15, "%L", LANG_SERVER, "YES")
301 :     format(lNo, 15, "%L", LANG_SERVER, "NO")
302 :     format(menu_msg, 255, g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s" : "%s %s?^n^n1. %s^n2. %s", lChangeMap, g_optionName[0], lYes, lNo)
303 :     keys = MENU_KEY_1|MENU_KEY_2
304 :     g_yesNoVote = 1
305 :     }
306 :    
307 :     new authid[32], name[32]
308 :    
309 :     get_user_authid(id, authid, 31)
310 :     get_user_name(id, name, 31)
311 :    
312 :     if (argc == 2)
313 :     log_amx("Vote: ^"%s<%d><%s><>^" vote map (map ^"%s^")", name, get_user_userid(id), authid, g_optionName[0])
314 :     else
315 :     log_amx("Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")", name, get_user_userid(id), authid, g_optionName[0], g_optionName[1], g_optionName[2], g_optionName[3])
316 :    
317 : ian 17 new maxpl=get_maxplayers();
318 :     new msg[256];
319 :     for (new i = 1; i <= maxpl; i++)
320 : ian 1 {
321 : ian 17 if (is_user_connected(i) && !is_user_bot(i))
322 : ian 1 {
323 : ian 17 // HACK: ADMIN_VOTE_MAP_{1,2} keys were designed very poorly. Remove all : and %s in it.
324 :     LookupLangKey(msg, charsmax(msg), "ADMIN_VOTE_MAP_1", i);
325 :     replace_all(msg, charsmax(msg), "%s", "");
326 :     replace_all(msg, charsmax(msg), ":", "");
327 :     trim(msg);
328 :     show_activity_id(i, id, name, msg);
329 : ian 1 }
330 :     }
331 :    
332 :     g_execResult = true
333 :     new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
334 :    
335 :     set_cvar_float("amx_last_voting", get_gametime() + vote_time)
336 :     g_voteRatio = get_cvar_float("amx_votemap_ratio")
337 :     g_Answer = "changelevel %s"
338 :     show_menu(0, keys, menu_msg, floatround(vote_time), (g_validMaps > 1) ? "Choose map: " : "Change map to ")
339 :     set_task(vote_time, "checkVotes", 99889988)
340 :     g_voteCaller = id
341 :     console_print(id, "%L", id, "VOTING_STARTED")
342 :     g_voteCount = {0, 0, 0, 0}
343 :    
344 :     return PLUGIN_HANDLED
345 :     }
346 :    
347 :     public cmdVote(id, level, cid)
348 :     {
349 :     if (!cmd_access(id, level, cid, 4))
350 :     return PLUGIN_HANDLED
351 :    
352 :     new Float:voting = get_cvar_float("amx_last_voting")
353 :     if (voting > get_gametime())
354 :     {
355 :     console_print(id, "%L", id, "ALREADY_VOTING")
356 :     return PLUGIN_HANDLED
357 :     }
358 :    
359 :     if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
360 :     {
361 :     console_print(id, "%L", id, "VOTING_NOT_ALLOW")
362 :     return PLUGIN_HANDLED
363 :     }
364 :    
365 :     new quest[48]
366 :     read_argv(1, quest, 47)
367 :    
368 :     if ((contain(quest, "sv_password") != -1) || (contain(quest, "rcon_password") != -1) || (contain(quest, "kick") != -1) ||
369 :     (contain(quest, "addip") != -1) || (contain(quest, "ban") != -1))
370 :     {
371 :     console_print(id, "%L", id, "VOTING_FORBIDDEN")
372 :     return PLUGIN_HANDLED
373 :     }
374 :    
375 : ian 17 new count=read_argc();
376 : ian 1
377 : ian 17 for (new i=0;i<4 && (i+2)<count;i++)
378 :     {
379 :     read_argv(i+2, g_optionName[i], sizeof(g_optionName[])-1);
380 :     }
381 :    
382 : ian 1 new authid[32], name[32]
383 :    
384 :     get_user_authid(id, authid, 31)
385 :     get_user_name(id, name, 31)
386 :     log_amx("Vote: ^"%s<%d><%s><>^" vote custom (question ^"%s^") (option#1 ^"%s^") (option#2 ^"%s^")", name, get_user_userid(id), authid, quest, g_optionName[0], g_optionName[1])
387 :    
388 : ian 17 new maxpl=get_maxplayers();
389 :     new msg[256];
390 :     for (new i = 1; i <= maxpl; i++)
391 : ian 1 {
392 : ian 17 if (is_user_connected(i) && !is_user_bot(i))
393 : ian 1 {
394 : ian 17 // HACK: ADMIN_VOTE_CUS_{1,2} keys were designed very poorly. Remove all : and %s in it.
395 :     LookupLangKey(msg, charsmax(msg), "ADMIN_VOTE_CUS_1", i);
396 :     replace_all(msg, charsmax(msg), "%s", "");
397 :     replace_all(msg, charsmax(msg), ":", "");
398 :     trim(msg);
399 :     show_activity_id(i, id, name, msg);
400 : ian 1 }
401 :     }
402 :    
403 : ian 17 new menu_msg[512], lVote[16]
404 : ian 1
405 :     format(lVote, 15, "%L", LANG_SERVER, "VOTE")
406 :    
407 : ian 17 count-=2;
408 :     if (count>4)
409 :     {
410 :     count=4;
411 :     }
412 :     // count now shows how many options were listed
413 :     new keys=0;
414 :     for (new i=0;i<count;i++)
415 :     {
416 :     keys |= (1<<i);
417 :     }
418 :    
419 :     new len=formatex(menu_msg, sizeof(menu_msg)-1, g_coloredMenus ? "\y%s: %s\w^n^n" : "%s: %s^n^n", lVote, quest);
420 :    
421 :     for (new i=0;i<count;i++)
422 :     {
423 :     len+=formatex(menu_msg[len], sizeof(menu_msg) - 1 - len ,"%d. %s^n",i+1,g_optionName[i]);
424 :     }
425 : ian 1 g_execResult = false
426 :    
427 :     new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
428 :    
429 :     set_cvar_float("amx_last_voting", get_gametime() + vote_time)
430 :     g_voteRatio = get_cvar_float("amx_vote_ratio")
431 : ian 17 replace_all(quest,sizeof(quest)-1,"%","");
432 : ian 1 format(g_Answer, 127, "%s - %%s", quest)
433 :     show_menu(0, keys, menu_msg, floatround(vote_time), "Vote: ")
434 :     set_task(vote_time, "checkVotes", 99889988)
435 :     g_voteCaller = id
436 :     console_print(id, "%L", id, "VOTING_STARTED")
437 :     g_voteCount = {0, 0, 0, 0}
438 :     g_yesNoVote = 0
439 :    
440 :     return PLUGIN_HANDLED
441 :     }
442 :    
443 :     public cmdVoteKickBan(id, level, cid)
444 :     {
445 :     if (!cmd_access(id, level, cid, 2))
446 :     return PLUGIN_HANDLED
447 :    
448 :     new Float:voting = get_cvar_float("amx_last_voting")
449 :     if (voting > get_gametime())
450 :     {
451 :     console_print(id, "%L", id, "ALREADY_VOTING")
452 :     return PLUGIN_HANDLED
453 :     }
454 :    
455 :     if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
456 :     {
457 :     console_print(id, "%L", id, "VOTING_NOT_ALLOW")
458 :     return PLUGIN_HANDLED
459 :     }
460 :    
461 :     new cmd[32]
462 :    
463 :     read_argv(0, cmd, 31)
464 :    
465 :     new voteban = equal(cmd, "amx_voteban")
466 :     new arg[32]
467 :     read_argv(1, arg, 31)
468 :    
469 : ian 17 new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
470 : ian 1
471 :     if (!player)
472 :     return PLUGIN_HANDLED
473 :    
474 :     if (voteban && is_user_bot(player))
475 :     {
476 :     new imname[32]
477 :    
478 :     get_user_name(player, imname, 31)
479 :     console_print(id, "%L", id, "ACTION_PERFORMED", imname)
480 :     return PLUGIN_HANDLED
481 :     }
482 :    
483 :     new keys = MENU_KEY_1|MENU_KEY_2
484 :     new menu_msg[256], lYes[16], lNo[16], lKickBan[16]
485 :    
486 :     format(lYes, 15, "%L", LANG_SERVER, "YES")
487 :     format(lNo, 15, "%L", LANG_SERVER, "NO")
488 :     format(lKickBan, 15, "%L", LANG_SERVER, voteban ? "BAN" : "KICK")
489 :     ucfirst(lKickBan)
490 :     get_user_name(player, arg, 31)
491 :     format(menu_msg, 255, g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s" : "%s %s?^n^n1. %s^n2. %s", lKickBan, arg, lYes, lNo)
492 :     g_yesNoVote = 1
493 :    
494 : ian 17 new bool:ipban=false;
495 :    
496 : ian 1 if (voteban)
497 : ian 17 {
498 :     get_user_authid(player, g_optionName[0], sizeof(g_optionName[])-1);
499 :    
500 :     // Do the same check that's in plmenu to determine if this should be an IP ban instead
501 :     if (equal("4294967295", g_optionName[0])
502 :     || equal("HLTV", g_optionName[0])
503 :     || equal("STEAM_ID_LAN", g_optionName[0])
504 :     || equali("VALVE_ID_LAN", g_optionName[0]))
505 :     {
506 :     get_user_ip(player, g_optionName[0], sizeof(g_optionName[])-1, 1);
507 :    
508 :     ipban=true;
509 :     }
510 :    
511 :     }
512 : ian 1 else
513 : ian 17 {
514 : ian 1 num_to_str(get_user_userid(player), g_optionName[0], 31)
515 : ian 17 }
516 : ian 1
517 :     new authid[32], name[32]
518 :    
519 :     get_user_authid(id, authid, 31)
520 :     get_user_name(id, name, 31)
521 :     log_amx("Vote: ^"%s<%d><%s><>^" vote %s (target ^"%s^")", name, get_user_userid(id), authid, voteban ? "ban" : "kick", arg)
522 :    
523 : ian 17 new maxpl=get_maxplayers();
524 :     new msg[256];
525 :     new right[256];
526 :     new dummy[1];
527 :     for (new i = 1; i <= maxpl; i++)
528 : ian 1 {
529 : ian 17 if (is_user_connected(i) && !is_user_bot(i))
530 : ian 1 {
531 : ian 17 formatex(lKickBan, charsmax(lKickBan), "%L", i, voteban ? "BAN" : "KICK");
532 : ian 1
533 : ian 17 // HACK: ADMIN_VOTE_FOR{1,2} keys are really weird. Tokenize and ignore the text before the :
534 :     LookupLangKey(msg, charsmax(msg), "ADMIN_CANC_VOTE_1", i);
535 :     strtok(msg, dummy, 0, right, charsmax(right), ':');
536 :     trim(right);
537 :     show_activity_id(i, id, name, right, lKickBan, arg);
538 : ian 1 }
539 :     }
540 :    
541 :     g_execResult = true
542 :    
543 :     new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
544 :    
545 :     set_cvar_float("amx_last_voting", get_gametime() + vote_time)
546 :     g_voteRatio = get_cvar_float(voteban ? "amx_voteban_ratio" : "amx_votekick_ratio")
547 : ian 17
548 :     if (voteban)
549 :     {
550 :     if (ipban==true)
551 :     {
552 :     g_Answer = "addip 30.0 %s";
553 :     }
554 :     else
555 :     {
556 :     g_Answer = "banid 30.0 %s kick";
557 :    
558 :     }
559 :     }
560 :     else
561 :     {
562 :     g_Answer = "kick #%s";
563 :     }
564 : ian 1 show_menu(0, keys, menu_msg, floatround(vote_time), voteban ? "Ban " : "Kick ")
565 :     set_task(vote_time, "checkVotes", 99889988)
566 :     g_voteCaller = id
567 :     console_print(id, "%L", id, "VOTING_STARTED")
568 :     g_voteCount = {0, 0, 0, 0}
569 :    
570 :     return PLUGIN_HANDLED
571 :     }

Contact
ViewVC Help
Powered by ViewVC 1.0.4