/[svn]/hlds/cstrike/addons/amxmodx/scripting/deagsmapmanager.sma
ViewVC logotype

Contents of /hlds/cstrike/addons/amxmodx/scripting/deagsmapmanager.sma

Parent Directory Parent Directory | Revision Log Revision Log


Revision 53 - (show annotations) (download)
Wed Mar 17 16:35:49 2010 UTC (14 years ago) by cstrike
File size: 109743 byte(s)
Removed "now" from dmap_rockthevote/amx_rockthevote/amx_rtv; Removed unused code; Added currentmap and recentmaps commands; Fixed floats showing instead of decimals; Improved help; Added overide for hlds votemap command; listmaps command now shows total maps; Changed some function names to match commands; Standardized name: "Deagles Map Manager"; Disabled the following commands in config files: dmap_rtvpercent, dmap_rtvplayers, dmap_rtvwait, dmap_messages, dmap_mapsnum, dmap_nominations, dmap_maxcustom, dmap_quietmode, dmap_rtvtoggle, dmap_freeze, dmap_cyclemode, dmap_votemode, dmap_banlastmaps, dmap_mapsurl;
1 /********************************************************************************
2 * AMX Mod X script.
3 *
4 * Deagles Map Manager (deagsmapmanager.sma)
5 * Copyright (C) 2006-2007 Deages/AMXX Community
6 * (c) Copyright for original Mapchooser by OLO
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 *
22 * In addition, as a special exception, the author gives permission to
23 * link the code of this program with the Half-Life Game Engine ("HL
24 * Engine") and Modified Game Libraries ("MODs") developed by Valve,
25 * L.L.C ("Valve"). You must obey the GNU General Public License in all
26 * respects for all of the code used other than the HL Engine and MODs
27 * from Valve. If you modify this file, you may extend this exception
28 * to your version of the file, but you are not obligated to do so. If
29 * you do not wish to do so, delete this exception statement from your
30 * version.
31 *
32 *********************************************************************************
33 *
34 * Deagles Map Manager v3.23
35 * Last Update: 2009-02-16
36 *
37 * by Deagles/AMXX Community & Posting/Supporting by bmann_420
38 * Link: http://forums.alliedmods.net/showthread.php?t=59535
39 *
40 *
41 * Changelog is in the .txt file
42 *
43 *
44 *********************************************************************************
45 */
46
47
48 #pragma semicolon 1
49 #include <amxmodx>
50 #include <amxmisc>
51
52 new const PLUGIN[] = "DeagsMapManager";
53 new const VERSION[] = "3.23SVN";
54 new const AUTHOR[] = "Deags/AMXX Community";
55 #define DMAP_EXPECTED_DV 520
56
57 // Comment out the following line to disable the dedicated log file
58 #define DEDICATED_LOG_ENABLED
59
60 #define MAX_MAPS_AMOUNT 600
61 #define ADMIN_DMAP ADMIN_LEVEL_A
62 #define ADMIN_SUPER_DMAP ADMIN_LEVEL_F
63
64 new const DMAP_MENU_TITLE[] = "DMAP_MENU_TITLE";
65
66 #define DMAP_VOTE_TIME 20 // Total time (in seconds) from vote start to checking votes
67
68 // Task IDs
69 #define DMAP_TASKID_TIMER 1010 //
70 #define DMAP_TASKID_VTR 1020 // Vote Time Remaining
71 #define DMAP_TASKID_CONFLICT 1020 // Conflicting plugin/dictionary version message
72 #define DMAP_TASKID_TIME_DISPLAY 1030 // Show time left and next map
73 #define DMAP_TASKID_MSG_THREE 1040 // Show status or result of vote
74 #define DMAP_TASKID_ROCK_IT_NOW 1050 //
75 #define DMAP_TASKID_GET_READY 1060 //
76 #define DMAP_TASKID_ROUND_MODE 1070 //
77 #define DMAP_TASKID_TIME_DIS 1080 //
78 #define DMAP_TASKID_DELAYED_CHANGE 1090 //
79 #define DMAP_TASKID_COUNTDOWN 1100 //
80 #define DMAP_TASKID_FREEZE 1110 //
81 #define DMAP_TASKID_MSG_NOMINATED 1120 //
82 #define DMAP_TASKID_MSG_MAPS 1130 //
83 #define DMAP_TASKID_TIME_TO_VOTE 1140 //
84 #define DMAP_TASKID_ASK_FOR_NEXT 1150 //
85 #define DMAP_TASKID_LOOP_MESSAGES 1160 //
86 #define DMAP_TASKID_END_OF_ROUND 1170 //
87 // Task IDs below here are spaced 100 apart to allow for a range of IDs
88 #define DMAP_TASKID_MORE_LIST_MAPS 2000 // Timer to allow for delay in listing large number of maps
89
90
91 new maps_to_select, isbuytime = 0, isbetween = 0;
92 new ban_last_maps = 0, quiet = 0; //quiet=0 (words and sounds) quiet=1 (words only, no sound) quiet=2 (no sound, no words)
93 new Float:rtvpercent, Float:thespeed, Float:oldtimelimit;
94 new minimum = 1, minimumwait = 10, enabled = 1, cycle = 0, dofreeze = 1, maxnom = 3, maxcustnom = 5, frequency = 3, oldwinlimit = 0, addthiswait = 0;
95 new mapsurl[64], amt_custom = 0;
96 new isend = 0, isspeedset = 0, istimeset = 0, iswinlimitset = 0, istimeset2 = 0, mapssave = 0, atstart;
97 new usestandard = 1, currentplayers = 0, activeplayers = 0, counttovote = 0, countnum = 0;
98 new inprogress = 0, rocks = 0, rocked[33], hasbeenrocked = 0, waited = 0;
99 new pathtomaps[64];
100 new custompath[50];
101 new nmaps[MAX_MAPS_AMOUNT][32];
102 new listofmaps[MAX_MAPS_AMOUNT][32];
103 new totalbanned = 0;
104 new banthesemaps[MAX_MAPS_AMOUNT][32];
105 new totalmaps = 0;
106 new lastmaps[100 + 1][32];
107 new bannedsofar = 0;
108 new standard[50][32];
109 new standardtotal = 0;
110 new nmaps_num = 0; //this is number of nominated maps
111 new nbeforefill;
112 new nmapsfill[MAX_MAPS_AMOUNT][32];
113 new num_nmapsfill; //this is number of maps in users admin.cfg file that are valid
114 new bool:bIsCstrike;
115 new nnextmaps[10];
116 new nvotes[12]; // Holds the number of votes for each map
117 new nmapstoch, before_num_nmapsfill = 0, bool:mselected = false;
118 #if defined DEDICATED_LOG_ENABLED
119 new logfilename[256];
120 #endif
121 new teamscore[2], last_map[32];
122 new Nominated[MAX_MAPS_AMOUNT]; //?
123 new whonmaps_num[MAX_MAPS_AMOUNT];
124 new curtime = 0, staytime = 0, curplayers = 0, currounds = 0;
125
126 new pDmapStrict; // Pointer to dmap_strict
127 new pEmptyMap; // Pointer to amx_emptymap
128 new pEmptymapAllowed; // Pointer to emptymap_allowed
129 new pEnforceTimelimit; // Pointer to enforce_timelimit
130 new pExtendmapMax; // Pointer to amx_extendmap_max
131 new pExtendmapStep; // Pointer to amx_extendmap_step
132 new pIdleTime; // Pointer to amx_idletime"
133 new pNominationsAllowed; // Pointer to nominations_allowed
134 new pShowActivity; // Pointer to amx_show_activity
135 new pWeaponDelay; // Pointer to weapon_delay
136
137 new g_TotalVotes; // Running total used to calculate percentages
138 new bool:g_AlreadyVoted[33]; // Keep track of who voted in current round
139 new g_VoteTimeRemaining; // Used to set duration of display of vote menu
140
141 forward public hudtext16(textblock[], colr, colg, colb, posx, posy, screen, time, id);
142 forward bool:isbanned(map[]);
143 forward bool:iscustommap(map[]);
144 forward bool:islastmaps(map[]);
145 forward bool:isnominated(map[]);
146 forward public handle_nominate(id, map[], bool:bForce);
147 forward available_maps();
148 forward public getready();
149 forward public timetovote();
150 forward public messagefifteen();
151 forward public messagenominated();
152 forward public messagemaps();
153 forward public stopperson();
154 forward public countdown();
155 forward public rock_it_now();
156 forward public timedisplay();
157 forward public messagethree();
158
159 public client_connect(id) {
160 if (!is_user_bot(id)) {
161 currentplayers++;
162 }
163 return PLUGIN_CONTINUE;
164 }
165
166 public loopmessages() {
167 if (quiet == 2) { //quiet=0 (words and sounds) quiet=1 (words only, no sound) quiet=2 (no sound, no words)
168 return PLUGIN_HANDLED;
169 }
170 new timeleft = get_timeleft();
171 new partialtime = timeleft % 370;
172 new maintime = timeleft % 600;
173 if ((maintime > 122 && maintime < 128) && timeleft > 114) {
174 set_task(1.0, "timedisplay", DMAP_TASKID_TIME_DISPLAY, "", 0, "a", 5);
175 }
176 if ((partialtime > 320 && partialtime < 326) && !cycle) {
177 set_task(3.0, "messagethree", DMAP_TASKID_MSG_THREE); //, "", 0, "a", 4)
178 return PLUGIN_HANDLED;
179 }
180 return PLUGIN_HANDLED;
181 }
182
183 public timedisplay() {
184 new timeleft = get_timeleft();
185 new seconds = timeleft % 60;
186 new minutes = floatround((timeleft - seconds) / 60.0);
187 if (timeleft < 1) {
188 remove_task(DMAP_TASKID_TIME_DISPLAY);
189 remove_task(DMAP_TASKID_TIME_DIS);
190 remove_task(DMAP_TASKID_END_OF_ROUND);
191 return PLUGIN_HANDLED;
192 }
193 if (timeleft > 140) {
194 remove_task(DMAP_TASKID_TIME_DIS);
195 }
196 if (timeleft > 30) {
197 set_hudmessage(255, 255, 220, 0.02, 0.2, 0, 1.0, 1.04, 0.0, 0.05, 3);
198 } else {
199 set_hudmessage(210, 0 ,0, 0.02, 0.15, 0, 1.0, 1.04, 0.0, 0.05, 3);
200 //Flashing red:set_hudmessage(210, 0, 0, 0.02, 0.2, 1, 1.0, 1.04, 0.0, 0.05, 3);
201 }
202 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_TIME_LEFT", minutes, seconds);
203 if (timeleft < 70 && (timeleft % 5) == 1) {
204 new smap[32];
205 get_cvar_string("amx_nextmap", smap, 31);
206 set_hudmessage(0, 132, 255, 0.02, 0.27, 0, 5.0, 5.04, 0.0, 0.5, 4);
207 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_NEXTMAP", smap);
208 }
209 return PLUGIN_HANDLED;
210
211 }
212
213 public messagethree() {
214 new timeleft = get_timeleft();
215 new time2 = timeleft - timeleft % 60;
216 new minutesleft = floatround(float(time2) / 60.0);
217 new mapname[32];
218 get_mapname(mapname, 31);
219 new smap[32];
220 get_cvar_string("amx_nextmap", smap, 31);
221 if (minutesleft >= 2 && !mselected) {
222 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_NEXTMAP_VOTE_REMAINING",
223 (minutesleft == 3 || minutesleft == 2) ? timeleft -100 : minutesleft - 2, (minutesleft == 3 || minutesleft == 2) ? "seconds" : "minutes");
224 } else {
225 if (mselected) {
226 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_NEXTMAP_VOTED", smap, timeleft);
227 } else {
228 if (minutesleft <= 2 && timeleft) {
229 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_CURRENT_MAP_VOTE", mapname);
230 }
231 }
232 }
233 }
234
235 public client_putinserver(id) {
236 if (!is_user_bot(id)) {
237 activeplayers++;
238 }
239 return PLUGIN_CONTINUE;
240 }
241
242 public client_disconnect(id) {
243 remove_task(DMAP_TASKID_MORE_LIST_MAPS + id);
244 if (is_user_bot(id)) {
245 return PLUGIN_CONTINUE;
246 }
247 currentplayers--;
248 activeplayers--;
249 g_AlreadyVoted[id] = false;
250 if (rocked[id]) {
251 rocked[id] = 0;
252 rocks--;
253 }
254 if (get_timeleft() > 160) {
255 if (!mselected && !hasbeenrocked && !inprogress) {
256 check_if_need();
257 }
258 }
259 new kName[32];
260 get_user_name(id, kName, 31);
261
262 new n = 0;
263 while (Nominated[id] > 0 && n < nmaps_num) {
264 if (whonmaps_num[n] == id) {
265 if (get_timeleft() > 50 && quiet != 2) { //quiet=0 (words and sounds) quiet=1 (words only, no sound) quiet=2 (no sound, no words)
266 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_PLAYER_LEFT", kName, nmaps[n]);
267 #if defined DEDICATED_LOG_ENABLED
268 log_to_file(logfilename, "%s has left; %s is no longer nominated", kName, nmaps[n]);
269 #endif
270 }
271
272 new j = n;
273 while (j < nmaps_num - 1) {
274 whonmaps_num[j] = whonmaps_num[j + 1];
275 nmaps[j] = nmaps[j + 1];
276 j++;
277 }
278 nmaps_num--;
279 Nominated[id] = Nominated[id] - 1;
280 } else {
281 n++;
282 }
283 }
284 return PLUGIN_CONTINUE;
285 }
286
287 public timer(id) {
288 if (get_playersnum() == 0) {
289 curtime++;
290 if (curtime >= staytime) {
291 change_maps();
292 }
293 } else {
294 new i, noncounted, players = get_playersnum();
295 for (i = 1; i <= get_maxplayers(); i++) {
296 if ((get_user_time(i, 1) >= (get_pcvar_num(pIdleTime) * 216000)) || is_user_bot(i) || is_user_hltv(i)) {
297 noncounted++;
298 }
299 }
300 if (players == noncounted) {
301 curtime++;
302 if (curtime >= staytime) {
303 change_maps();
304 }
305 } else {
306 curtime = 0;
307 }
308 }
309 return curtime;
310 }
311
312 public change_maps() {
313
314 new map[32];
315 get_pcvar_string(pEmptyMap, map, 31);
316
317 if (get_pcvar_num(pEmptymapAllowed) == 1 && strlen(map) > 0) {
318 server_cmd("changelevel %s", map);
319 }
320 }
321
322 public list_maps(id) {
323 new m, iteration = 0;
324 client_print(id, print_chat, "%L", id, "DMAP_LISTMAPS", totalmaps);
325 if (totalmaps - (50 * iteration) >= 50) {
326 console_print(id, "%L", id, "DMAP_LISTMAPS_MAPS", iteration * 50 + 1, iteration * 50 + 50, totalmaps);
327 } else {
328 console_print(id, "%L", id, "DMAP_LISTMAPS_MAPS", iteration * 50 + 1, iteration * 50 + (totalmaps - iteration * 50), totalmaps);
329 }
330
331 for (m = 50 * iteration; (m < totalmaps && m < 50 * (iteration + 1)); m += 3)
332 if (m + 1 < totalmaps) {
333 if (m + 2 < totalmaps) {
334 console_print(id, " %s %s %s", listofmaps[m], listofmaps[m + 1], listofmaps[m + 2]);
335 } else {
336 console_print(id, " %s %s", listofmaps[m], listofmaps[m + 1]);
337 }
338 } else {
339 console_print(id, " %s", listofmaps[m]);
340 }
341 if (50 * (iteration + 1) < totalmaps) {
342 new kIdfake[6];
343 num_to_str((id + 50 * (iteration + 1)), kIdfake, 5);
344 client_print(id, print_console, "%L", id, "DMAP_LISTMAPS_MORE");
345 set_task(4.0, "more_list_maps", DMAP_TASKID_MORE_LIST_MAPS + id, kIdfake, 6);
346 }
347 return PLUGIN_CONTINUE;
348 }
349
350 public more_list_maps(idfakestr[]) {
351 new idreal = str_to_num(idfakestr);
352 new m, iteration = 0;
353 while (idreal >= 50) {
354 idreal -= 50;
355 iteration++;
356 } //Now idreal is the real id of client
357
358 if (totalmaps - (50 * iteration) >= 50) {
359 console_print(idreal, "%L", idreal, "DMAP_LISTMAPS_MAPS", iteration * 50 + 1, iteration * 50 + 50, totalmaps);
360 } else {
361 console_print(idreal, "%L", idreal, "DMAP_LISTMAPS_MAPS", iteration * 50 + 1, iteration * 50 + (totalmaps - iteration * 50), totalmaps);
362 }
363
364 for (m = 50 * iteration; (m < totalmaps && m < 50 * (iteration + 1)); m += 3) {
365 if (m + 1 < totalmaps) {
366 if (m + 2 < totalmaps) {
367 console_print(idreal, " %s %s %s", listofmaps[m], listofmaps[m + 1], listofmaps[m + 2]);
368 } else {
369 console_print(idreal, " %s %s", listofmaps[m], listofmaps[m + 1]);
370 }
371 } else {
372 console_print(idreal, " %s", listofmaps[m]);
373 }
374 }
375
376 if (50 * (iteration + 1) < totalmaps) {
377 new kIdfake[32];
378 num_to_str((idreal + 50 * (iteration + 1)), kIdfake, 31);
379 client_print(idreal, print_console, "%L", idreal, "DMAP_LISTMAPS_MORE");
380 set_task(2.0, "more_list_maps", DMAP_TASKID_MORE_LIST_MAPS + idreal, kIdfake, 6);
381 } else { //Base case has been reached
382 client_print(idreal, print_console, "%L", idreal, "DMAP_LISTMAPS_FINISHED", totalmaps);
383 }
384 }
385
386 public say_nextmap(id) {
387 new timeleft = get_timeleft();
388 new time2 = timeleft - timeleft % 60;
389 new minutesleft = floatround(float(time2) / 60.0);
390 new mapname[32];
391 get_mapname(mapname,31);
392 new smap[32];
393 get_cvar_string("amx_nextmap", smap, 31);
394 if (minutesleft >= 2 && !mselected)
395 if (get_pcvar_num(pNominationsAllowed) == 1) {
396 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_SAY_NOMINATIONS",
397 (minutesleft == 3 || minutesleft == 2) ? timeleft - 100 : minutesleft - 2, (minutesleft == 3 || minutesleft == 2) ? "sec." : "min.");
398 } else {
399 if (mselected) {
400 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_NEXTMAP_VOTED", smap, timeleft);
401 } else {
402 if (inprogress) {
403 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_CURRENT_MAP_VOTE", mapname);
404 }
405 }
406 }
407 return PLUGIN_HANDLED;
408 }
409
410 public check_if_need() {
411 new Float:ratio = rtvpercent;
412 new needed = floatround(float(activeplayers) * ratio + 0.49);
413 new timeleft = get_timeleft();
414 new Float:minutesleft = float(timeleft) / 60.0;
415 new Float:currentlimit = get_cvar_float("mp_timelimit");
416 new Float:minutesplayed = currentlimit - minutesleft;
417 new wait;
418 wait = minimumwait;
419 if ((minutesplayed + 0.5) >= (float(wait))) {
420 if (rocks >= needed && rocks >= minimum) {
421 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_RTV_STARTING", rocks);
422 set_hudmessage(222, 70, 0, -1.0, 0.3, 1, 10.0, 10.0, 2.0, 4.0, 4);
423 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_RTV_START", rocks);
424 hasbeenrocked = 1;
425 inprogress = 1;
426 mselected = false;
427 set_task(10.0, "rock_it_now", DMAP_TASKID_ROCK_IT_NOW);
428 }
429 }
430 }
431
432 public rock_the_vote(id) {
433 new Float:ratio = rtvpercent;
434 new needed = floatround(float(activeplayers) * ratio + 0.49);
435 new kName[32];
436 get_user_name(id, kName, 31);
437 new timeleft = get_timeleft();
438 new Float:minutesleft = float(timeleft) / 60.0;
439 new Float:currentlimit = get_cvar_float("mp_timelimit");
440 new Float:minutesplayed = currentlimit - minutesleft;
441 new wait;
442 wait = minimumwait;
443 if (cycle) {
444 client_print(id, print_chat, "%L", id, "DMAP_VOTING_DISABLED");
445 return PLUGIN_CONTINUE;
446 }
447 if (!enabled) {
448 client_print(id, print_chat, "%L", id, "DMAP_RTV_DISABLED");
449 return PLUGIN_CONTINUE;
450 }
451 if (inprogress) {
452 client_print(id, print_chat, "%L", id, "DMAP_VOTE_BEGINNING");
453 return PLUGIN_CONTINUE;
454 }
455 if (mselected) {
456 new smap[32];
457 get_cvar_string("amx_nextmap", smap, 31);
458 client_print(id, print_chat, "%L", id, "DMAP_VOTING_COMPLETED", smap, get_timeleft());
459 return PLUGIN_CONTINUE;
460 }
461 if (hasbeenrocked) {
462 client_print(id, print_chat, "%L", id, "DMAP_MAP_ALREADY_ROCKED", kName);
463 return PLUGIN_CONTINUE;
464 }
465 if (timeleft < 120) {
466 if (timeleft > 1) {
467 client_print(id, print_chat, "%L", id, "DMAP_NOT_ENOUGH_TIME");
468 } else {
469 client_print(id, print_chat, "%L", id, "DMAP_NO_TIMELIMIT");
470 }
471 return PLUGIN_CONTINUE;
472 }
473 if ((minutesplayed + 0.5) < (float(wait))) {
474 if (float(wait) - 0.5 - minutesplayed > 0.0) {
475 client_print(id, print_chat, "%L", id, "DMAP_RTV_WAIT",
476 kName, (floatround(float(wait) + 0.5-minutesplayed) > 0) ? (floatround(float(wait) + 0.5 - minutesplayed)) : (1));
477 } else {
478 client_print(id, print_chat, "%L", id, "DMAP_RTV_1MIN");
479 }
480 if ((get_user_flags(id) & ADMIN_MAP)) {
481 console_print(id, "%L", id, "DMAP_RTV_ADMIN_FORCE", kName);
482 }
483 return PLUGIN_CONTINUE;
484 }
485 if (!rocked[id]) {
486 rocked[id] = 1;
487 rocks++;
488 } else {
489 client_print(id, print_chat, "%L", id, "DMAP_ALREADY_ROCKED", kName);
490 return PLUGIN_CONTINUE;
491 }
492 if (rocks >= needed && rocks >= minimum) {
493 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_RTV_STARTING", rocks);
494 set_hudmessage(222, 70,0, -1.0, 0.3, 1, 10.0, 10.0, 2.0, 4.0, 4);
495 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_RTV_START", rocks);
496 hasbeenrocked = 1;
497 inprogress = 1;
498 mselected = false;
499 set_task(15.0, "rock_it_now", DMAP_TASKID_ROCK_IT_NOW);
500 } else {
501 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_RTV_NEEDED", ((needed-rocks) > (minimum-needed)) ? (needed-rocks) : (minimum-rocks));
502 }
503 return PLUGIN_CONTINUE;
504 }
505
506 public rock_it_now() {
507 new temprocked = hasbeenrocked;
508 hasbeenrocked = 1;
509 new timeleft = get_timeleft();
510 new Float:minutesleft=float(timeleft) / 60.0;
511 new Float:currentlimit = get_cvar_float("mp_timelimit");
512 new Float:minutesplayed = currentlimit-minutesleft;
513 new Float:timelimit;
514 counttovote = 0;
515 remove_task(DMAP_TASKID_TIME_TO_VOTE);
516 remove_task(DMAP_TASKID_GET_READY);
517 timelimit = float(floatround(minutesplayed + 1.5));
518 if (timelimit > 0.4) {
519 oldtimelimit = get_cvar_float("mp_timelimit");
520 istimeset = 1;
521 set_cvar_float("mp_timelimit", timelimit);
522 if (quiet != 2) {
523 console_print(0, "%L", LANG_PLAYER, "DMAP_TIMELIMIT_CHANGED", floatround(get_cvar_float("mp_timelimit")));
524 }
525 #if defined DEDICATED_LOG_ENABLED
526 log_to_file(logfilename, "Time limit changed to %d to enable vote to occur now", floatround(get_cvar_float("mp_timelimit")));
527 #endif
528 } else {
529 console_print(0, "%L", LANG_PLAYER, "DMAP_TIMELIMIT_NOTCHANGED");
530 #if defined DEDICATED_LOG_ENABLED
531 log_to_file(logfilename, "Will not set a timelimit of %d, vote is not rocked, seconds left on map:%d", floatround(timelimit), timeleft);
532 #endif
533 new inum, players[32], i;
534 get_players(players, inum, "c");
535 for (i = 0; i < inum; ++i) {
536 rocked[i] = 0;
537 }
538 rocks = 0;
539 hasbeenrocked = temprocked;
540 return PLUGIN_HANDLED;
541 }
542 timeleft = get_timeleft();
543 inprogress = 1;
544 mselected = false;
545 if (quiet != 2) {
546 set_hudmessage(0, 222,50, -1.0, 0.23, 1, 6.0, 6.0, 1.0, 1.0, 4);
547 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_START_MAPVOTE");
548 } else {
549 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_START_MAPVOTE");
550 }
551 if (quiet == 0) {
552 client_cmd(0, "spk ^"get red(e80) ninety(s45) to check(e20) use _comma(e10) bay(s18) mass(e42) cap(s50)^"");
553 }
554 set_task(3.5, "getready", DMAP_TASKID_GET_READY);
555 set_task(10.0, "startthevote");
556 remove_task(DMAP_TASKID_TIME_DIS);
557 remove_task(DMAP_TASKID_END_OF_ROUND);
558 rocks = 0;
559 new inum, players[32], i;
560 get_players(players, inum, "c");
561 for (i = 0; i < inum; ++i) {
562 rocked[i] = 0;
563 }
564 set_task(2.18, "calculate_custom");
565 return PLUGIN_HANDLED;
566 }
567
568 public admin_rockit(id, level, cid) {
569 if (!cmd_access(id, level, cid, 1)) {
570 return PLUGIN_HANDLED;
571 }
572
573 new kName[32], timeleft = get_timeleft();
574 get_user_name(id, kName, 31);
575
576 if (timeleft < 180.0) {
577 console_print(id, "%L", id, "DMAP_NOT_ENOUGH_TIME");
578 return PLUGIN_HANDLED;
579 }
580 if (inprogress || hasbeenrocked || isend) {
581 console_print(id, "%L", id, "DMAP_ALREADY_VOTING");
582 return PLUGIN_HANDLED;
583 }
584 if (cycle) {
585 console_print(id, "%L", id, "DMAP_ENABLE_VOTEMODE");
586 return PLUGIN_HANDLED;
587 }
588 if (!mselected) {
589 switch(get_pcvar_num(pShowActivity)) {
590 case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_VOTE_ROCKED_BY_ADMIN", kName);
591 case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_RTV_USED_BY_ADMIN");
592 }
593 } else {
594 switch(get_pcvar_num(pShowActivity)) {
595 case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_REVOTE_BY_ADMIN", kName);
596 case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_REVOTE");
597 }
598 }
599 remove_task(DMAP_TASKID_FREEZE);
600 remove_task(DMAP_TASKID_COUNTDOWN);
601 remove_task(DMAP_TASKID_END_OF_ROUND);
602 counttovote = 0;
603 remove_task(DMAP_TASKID_TIME_TO_VOTE);
604 remove_task(DMAP_TASKID_GET_READY);
605 #if defined DEDICATED_LOG_ENABLED
606 log_to_file(logfilename, "ADMIN <%s> calls rockthevote with %d seconds left on map", kName, timeleft);
607 #endif
608 inprogress = 1;
609 mselected = false;
610 set_task(15.0, "rock_it_now", DMAP_TASKID_ROCK_IT_NOW);
611 set_task(0.18, "calculate_custom");
612 return PLUGIN_HANDLED;
613 }
614
615 public check_votes() {
616 new timeleft = get_timeleft();
617 new b = 0, a;
618 for (a = 0; a < nmapstoch; ++a) {
619 if (nvotes[b] < nvotes[a]) {
620 b = a;
621 }
622 }
623 if (nvotes[maps_to_select] > nvotes[b]) {
624 new mapname[32];
625 get_mapname(mapname, 31);
626 new steptime = get_pcvar_num(pExtendmapStep);
627 set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime);
628 istimeset = 1;
629
630 if (quiet != 2) {
631 set_hudmessage(222, 70,0, -1.0, 0.4, 0, 4.0, 10.0, 2.0, 2.0, 4);
632 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_MAP_EXTENDED", steptime);
633 if (quiet != 1) {
634 client_cmd(0, "speak ^"barney/waitin^"");
635 }
636 }
637 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_MAP_EXTENDED2", steptime);
638 #if defined DEDICATED_LOG_ENABLED
639 log_to_file(logfilename, "Vote: Voting for the nextmap finished. Map %s will be extended to next %d minutes", mapname, steptime);
640 #endif
641 inprogress = isend = 0;
642 nmaps_num = nbeforefill;
643 num_nmapsfill = before_num_nmapsfill;
644 return PLUGIN_HANDLED;
645 }
646 if (nvotes[b] && nvotes[maps_to_select+1] <= nvotes[b]) {
647 set_cvar_string("amx_nextmap", nmaps[nnextmaps[b]]);
648 new smap[32];
649 get_cvar_string("amx_nextmap", smap, 31);
650 new players[32], inum;
651 get_players(players, inum, "c");
652 if (quiet != 2) {
653 if (timeleft <= 0 || timeleft > 300) {
654 set_hudmessage(222, 70,0, -1.0, 0.36, 0, 4.0, 10.0, 2.0, 2.0, 4);
655 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_MAP_WINS", nmaps[nnextmaps[b]], nvotes[b]);
656 } else {
657 set_hudmessage(0, 152, 255, -1.0, 0.22, 0, 4.0, 7.0, 2.1, 1.5, 4);
658 if (get_pcvar_float(pEnforceTimelimit) == 1.0 && bIsCstrike) {
659 show_hudmessage(0, "%L %L", LANG_PLAYER, "DMAP_MAP_WINS2", nmaps[nnextmaps[b]], nvotes[b], LANG_PLAYER, "DMAP_IN_SECONDS", timeleft);
660 } else {
661 show_hudmessage(0, "%L %L", LANG_PLAYER, "DMAP_MAP_WINS2", nmaps[nnextmaps[b]], nvotes[b], LANG_PLAYER, "DMAP_SHORTLY");
662 }
663 if (iscustommap(nmaps[nnextmaps[b]]) && usestandard) {
664 client_print(0, print_notify, "%L", LANG_PLAYER, "DMAP_DOWNLOAD_CUSTOM_MAP");
665 }
666 }
667 if ((containi(mapsurl, "www") != -1 || containi(mapsurl, "http") != -1) && iscustommap(nmaps[nnextmaps[b]])) {
668 //set_hudmessage(0, 152, 255, -1.0, 0.70, 1, 4.0, 12.0, 2.1, 1.5, 7);
669 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_DOWNLOAD_MAPS_URL", mapsurl);
670 }
671 if (quiet != 1) {
672 client_cmd(0, "speak ^"barney/letsgo^""); //quiet=0 (words and sounds) quiet=1 (words only, no sound) quiet=2 (no sound, no words)
673 }
674 }
675 }
676
677 new smap[32];
678 get_cvar_string("amx_nextmap", smap, 31);
679 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_CHOOSING_FINISHED", smap);
680 #if defined DEDICATED_LOG_ENABLED
681 log_to_file(logfilename, "Vote: Voting for the nextmap finished. The nextmap will be %s", smap);
682 #endif
683 inprogress = waited = 0;
684 isend = 1;
685 //WE ARE near END OF MAP; time to invoke Round mode ALgorithm
686 //set_task(2.0, "endofround", DMAP_TASKID_END_OF_ROUND, "", 0, "b");
687 new waituntilready = timeleft - 60;
688 if (waituntilready > 30) {
689 waituntilready = 30;
690 }
691 if (waituntilready <= 0 || get_cvar_num("mp_winlimit")) {
692 addthiswait = 4;
693 set_task(4.0, "RoundMode", DMAP_TASKID_ROUND_MODE);
694 } else {
695 set_task(float(waituntilready), "RoundMode", DMAP_TASKID_ROUND_MODE);
696 addthiswait = waituntilready;
697 }
698 nmaps_num = nbeforefill;
699 num_nmapsfill = before_num_nmapsfill;
700 set_task(2.18, "calculate_custom");
701 return PLUGIN_HANDLED;
702 }
703
704 public show_timer() {
705 set_task(1.0, "timedis2", DMAP_TASKID_TIME_DIS, "", 0, "b");
706 }
707
708 public timedis2() {
709 new timeleft = get_timeleft();
710 if ((timeleft % 5) == 1) {
711 new smap[32];
712 get_cvar_string("amx_nextmap", smap, 31);
713 set_hudmessage(0, 132, 255, 0.02, 0.27, 0, 5.0, 5.04, 0.0, 0.5, 4);
714 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_NEXTMAP", smap);
715 if (waited < 90) {
716 set_hudmessage(255, 215, 190, 0.02, 0.2, 0, 5.0, 5.04, 0.0, 0.5, 3);
717 } else {
718 set_hudmessage(210, 0 ,0, 0.02, 0.15, 0, 5.0, 5.04, 0.0, 0.5, 3);
719 //Flashing red:set_hudmessage(210, 0 ,0, 0.02, 0.2, 1, 1.0, 1.04, 0.0, 0.05, 3);
720 }
721 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_LAST_ROUND");
722 }
723 return PLUGIN_HANDLED;
724 }
725
726 public timedis3() {
727 new timeleft = get_timeleft();
728 if ((timeleft % 5) == 1) {
729 new smap[32];
730 get_cvar_string("amx_nextmap", smap, 31);
731 set_hudmessage(0, 132, 255, 0.02, 0.27, 0, 5.0, 5.04, 0.0, 0.5, 4);
732 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_NEXTMAP", smap);
733 if (timeleft > 30) {
734 set_hudmessage(255, 215, 190, 0.02, 0.2, 0, 5.0, 5.04, 0.0, 0.5, 3);
735 } else {
736 set_hudmessage(210, 0 ,0, 0.02, 0.15, 0, 5.0, 5.04, 0.0, 0.5, 3);
737 //Flashing red:set_hudmessage(210, 0, 0, 0.02, 0.2, 1, 5.0, 5.04, 0.0, 0.5, 3);
738 }
739 //countdown when "Enforcing timelimit"
740 new seconds = timeleft % 60;
741 new minutes = floatround((timeleft - seconds) / 60.0);
742 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_TIME_LEFT", minutes, seconds);
743 }
744 return PLUGIN_HANDLED;
745 }
746
747 public RoundMode() {
748 if (get_cvar_float("mp_timelimit") > 0.1 && get_pcvar_num(pEnforceTimelimit)) {
749 remove_task(DMAP_TASKID_ROUND_MODE);
750 remove_task(DMAP_TASKID_TIME_DIS);
751 new timeleft = get_timeleft();
752 if (timeleft < 200) {
753 set_task(float(timeleft) - 5.8, "endofround");
754 set_task(1.0, "timedis3", DMAP_TASKID_TIME_DIS, "", 0, "b");
755 }
756 return PLUGIN_HANDLED;
757 } else {
758 if (waited == 0) {
759 set_task(1.0, "show_timer");
760 }
761 if (isbetween || isbuytime || (waited + addthiswait) > 190 || (!bIsCstrike && (waited + addthiswait) >= 30) || activeplayers < 2) { //Time to switch maps!!!!!!!!
762 remove_task(DMAP_TASKID_ROUND_MODE);
763 remove_task(DMAP_TASKID_TIME_DIS);
764 if (isbetween) {
765 set_task(3.9, "endofround");
766 } else {
767 endofround(); //switching very soon!
768 }
769 } else {
770 waited += 5;
771 //if (waited >= 15 && waited <= 150 && get_timeleft() < 7) {
772 if ((waited + addthiswait) <= 190 && get_timeleft() >= 0 && get_timeleft() <= 15) {
773 istimeset2 = 1;
774 set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + 2.0);
775 if (bIsCstrike) {
776 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_FINISHING_CUR_ROUND");
777 }
778 }
779 set_task(5.0, "RoundMode", DMAP_TASKID_ROUND_MODE);
780 }
781 }
782 return PLUGIN_HANDLED;
783 }
784
785 public vote_count(id, key) {
786 if (get_cvar_float("amx_vote_answers")) {
787 new name[32];
788 get_user_name(id, name, 31);
789 if (key == maps_to_select) {
790 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_CHOSE_MAPEXTENDING", name);
791 } else if (key < maps_to_select) {
792 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_CHOSE_MAP", name, nmaps[nnextmaps[key]]);
793 }
794 }
795 nvotes[key] += 1;
796 g_TotalVotes += 1;
797 g_AlreadyVoted[id] = true;
798 show_vote_menu(false);
799
800 return PLUGIN_HANDLED;
801 }
802
803 bool:isinmenu(id) {
804 new a;
805 for (a = 0; a < nmapstoch; ++a) {
806 if (id == nnextmaps[a]) {
807 return true;
808 }
809 }
810 return false;
811 }
812
813 public dmapcancelvote(id, level, cid) {
814 if (!cmd_access(id, level, cid, 0)) {
815 return PLUGIN_HANDLED ;
816 }
817 if (task_exists(DMAP_TASKID_ROCK_IT_NOW, 1)) {
818 new authid[32], name[32];
819
820 get_user_authid(id, authid, 31) ;
821 get_user_name(id, name, 31);
822 #if defined DEDICATED_LOG_ENABLED
823 log_to_file(logfilename, "ADMIN <%s> cancelled the map vote.", name);
824 #endif
825 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_ADMIN_CANCELLED", name);
826 remove_task(DMAP_TASKID_ROCK_IT_NOW, 1);
827 set_hudmessage(222, 70,0, -1.0, 0.3, 1, 10.0, 10.0, 2.0, 4.0, 8);
828 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_ADMIN_CANCELLED", name);
829 hasbeenrocked = 0;
830 inprogress = 0;
831 mselected = true;
832
833 return PLUGIN_CONTINUE;
834 } else {
835 client_print(id, print_chat, "%L", id, "DMAP_NO_CURRENT_VOTE");
836 }
837 return PLUGIN_HANDLED;
838 }
839
840 public dmapnominate(id, level, cid) {
841 if (!cmd_access(id, level, cid, 2)) {
842 return PLUGIN_HANDLED;
843 }
844
845 new sArg1[32];
846 read_argv(1, sArg1, 31);
847
848 handle_andchange(id, sArg1, true); // Force nomination
849
850 return PLUGIN_HANDLED;
851 }
852
853 public levelchange() {
854 if (istimeset2 == 1) { //Allow automatic map change to take place.
855 set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") - 2.0);
856 istimeset2 = 0;
857 } else {
858 if (get_cvar_float("mp_timelimit") >= 4.0) { //Allow automatic map change to take place.
859 if (!istimeset) {
860 oldtimelimit = get_cvar_float("mp_timelimit");
861 }
862 set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") - 3);
863 istimeset = 1;
864 } else {
865 if (get_cvar_num("mp_winlimit")) { //Allow automatic map change based on teamscores
866 new largerscore;
867 largerscore = (teamscore[0] > teamscore[1]) ? teamscore[0] : teamscore[1];
868 iswinlimitset = 1;
869 oldwinlimit = get_cvar_num("mp_winlimit");
870 set_cvar_num("mp_winlimit", largerscore);
871 }
872 }
873 }
874 //If we are unable to achieve automatic level change, FORCE it.
875 set_task(2.1, "DelayedChange", DMAP_TASKID_DELAYED_CHANGE);
876 }
877
878 public changeMap() { //Default event copied from nextmap.amx, and changed around.
879 set_cvar_float("mp_chattime", 3.0); // make sure mp_chattime is long
880 remove_task(DMAP_TASKID_DELAYED_CHANGE);
881 set_task(1.85, "DelayedChange");
882 }
883
884 public DelayedChange() {
885 new smap[32];
886 get_cvar_string("amx_nextmap", smap, 31);
887 server_cmd("changelevel %s", smap);
888 }
889
890 public endofround() { //Call when ready to switch maps in (?) seconds
891 remove_task(DMAP_TASKID_END_OF_ROUND);
892 remove_task(DMAP_TASKID_LOOP_MESSAGES);
893 remove_task(DMAP_TASKID_ROUND_MODE);
894 remove_task(DMAP_TASKID_TIME_DISPLAY);
895 remove_task(DMAP_TASKID_TIME_DIS);
896 new smap[32];
897 get_cvar_string("amx_nextmap", smap, 31);
898 set_task(6.0, "levelchange"); //used to be 7.0
899 if (quiet != 2) {
900 countnum = 0;
901 set_task(1.0, "countdown", DMAP_TASKID_COUNTDOWN, "", 0, "a", 6);
902 if (quiet != 1) {
903 client_cmd(0, "speak ^"loading environment on to your computer^"");
904 }
905 } else {
906 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_MAP_ABOUT_CHANGE");
907 }
908 ///////////////////////////////////////////////
909 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_NEXTMAP2", smap);
910 if ((containi(mapsurl, "www") != -1 || containi(mapsurl, "http") != -1) && iscustommap(smap)) {
911 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_DOWNLOAD_MAPS_URL2", smap, mapsurl);
912 }
913 ///////////////////////////////////////////////
914 if (dofreeze) {
915 isspeedset = 1;
916 thespeed = get_cvar_float("sv_maxspeed");
917 set_cvar_float("sv_maxspeed", 0.0);
918 new players[32], inum, i;
919 get_players(players, inum, "c");
920 for (i = 0; i < inum; ++i) {
921 client_cmd(players[i], "drop");
922 client_cmd(players[i], "+showscores");
923 }
924 }
925 if (dofreeze) {
926 set_task(1.1, "stopperson", DMAP_TASKID_FREEZE, "", 0, "a", 2);
927 }
928 return PLUGIN_HANDLED;
929 }
930
931 public countdown() {
932 new smap[32];
933 get_cvar_string("amx_nextmap", smap, 31);
934 countnum++;
935 set_hudmessage(150, 120, 0, -1.0, 0.3, 0, 0.5, 1.1, 0.1, 0.1, 4);
936 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_MAP_CHANGING_IN", smap, 7 - countnum);
937 return PLUGIN_HANDLED;
938 }
939
940 public stopperson() {
941 new players[32], inum, i;
942 get_players(players, inum, "c");
943 if (isspeedset >= 0 && isspeedset < 2) {
944 thespeed = get_cvar_float("sv_maxspeed");
945 isspeedset++;
946 set_cvar_float("sv_maxspeed", 0.0);
947 }
948 for (i = 0; i < inum; ++i) {
949 client_cmd(players[i], "drop");
950 }
951 return PLUGIN_HANDLED;
952 }
953
954 public display_message() {
955 new timeleft = get_timeleft();
956 new parttime = timeleft % (frequency * 60 * 2); //460//period(minutes/cycle) * 60 seconds/minute = period in seconds
957 //if frequency = 2 (every 2 minutes one message will appear) THIS FUNCTION COVERS 2 MESSAGES WHICH MAKES ONE CYCLE
958 //parttime=timeleft%240;
959 new addition = frequency * 60;
960 if (mselected || inprogress || cycle) {
961 return PLUGIN_CONTINUE;
962 }
963 //if (parttime > 310 && parttime < 326 && timeleft > 132)
964 if (parttime > (40 + addition) && parttime < (56 + addition) && timeleft > 132) {
965 set_task(3.0, "messagenominated", DMAP_TASKID_MSG_NOMINATED); //, "", 0, "a", 4)
966 } else {
967 //if (parttime > 155 && parttime < 171 && timeleft > 132)
968 if (parttime > 30 && parttime < 46 && timeleft > 132) {
969 set_task(10.0, "messagemaps", DMAP_TASKID_MSG_MAPS, "", 0, "a", 1);
970 } else if (timeleft >= 117 && timeleft < 132) {
971 messagefifteen();
972 }
973 }
974 return PLUGIN_CONTINUE;
975 }
976
977 // THIS IS UNTESTED, BUT SHOULD WORK
978 /* 1.6 hudtext function
979 Arguments:
980 textblock: a string containing the text to print, not more than 512 chars (a small calc shows that the max number of letters to be displayed is around 270 btw)
981 colr, colg, colb: color to print text in (RGB format)
982 posx, posy: position on screen * 1000 (if you want text to be displayed centered, enter -1000 for both, text on top will be posx=-1000 & posy=20
983 screen: the screen to write to, hl supports max 4 screens at a time, do not use screen+0 to screen+3 for other hudstrings while displaying this one
984 time: how long the text shoud be displayed (in seconds)
985 */
986
987 public hudtext16(textblock[] ,colr, colg, colb, posx, posy, screen, time, id) {
988 new y;
989 if (contain(textblock, "^n") == -1) { // if there is no linebreak in the text, we can just show it as it is
990 set_hudmessage(colr, colg, colb, float(posx) / 1000.0, float(posy) / 1000.0, 0, 6.0, float(time), 0.2, 0.2, screen);
991 show_hudmessage(id, textblock);
992 } else { // more than one line
993 new out[128], rowcounter = 0, tmp[512], textremain = true;
994 y = screen;
995 new i = contain(textblock, "^n");
996 copy(out, i, textblock); // we need to get the first line of text before the loop
997 do { // this is the main print loop
998 setc(tmp, 511, 0); // reset string
999 copy(tmp, 511, textblock[i + 1]); // copy everything AFTER the first linebreak (hence the +1, we don't want the linebreak in our new string)
1000 setc(textblock, 511, 0); // reset string
1001 copy(textblock, 511, tmp); // copy back remaining text
1002 i = contain(textblock, "^n"); // get next linebreak position
1003 if ((strlen(out) + i < 64) && (i != -1)) { // we can add more lines to the outstring if total letter count don't exceed 64 chars (decrease if you have a lot of short lines since the leading linbreaks for following lines also take up one char in the string)
1004 add(out, 127, "^n"); // add a linebreak before next row
1005 add(out, strlen(out) + i, textblock);
1006 rowcounter++; // we now have one more row in the outstring
1007 } else { // no more lines can be added
1008 set_hudmessage(colr, colg, colb, float(posx) / 1000.0, float(posy) / 1000.0, 0, 6.0, float(time), 0.2, 0.2, screen); // format our hudmsg
1009 if ((i == -1) && (strlen(out) + strlen(textblock) < 64)) {
1010 add(out, 127, "^n"); // if i == -1 we are on the last line, this line is executed if the last line can be added to the current string (total chars < 64)
1011 } else { // not the last line or last line must have it's own screen
1012 if (screen-y < 4) {
1013 show_hudmessage(id, out); // we will only print the hudstring if we are under the 4 screen limit
1014 }
1015 screen++; // go to next screen after printing this one
1016 rowcounter++; // one more row
1017 setc(out, 127, 0); // reset string
1018 for (new j = 0; j < rowcounter; j++) {
1019 add(out, 127, "^n"); // add leading linebreaks equal to the number of rows we already printed
1020 }
1021 if (i == -1) {
1022 set_hudmessage(colr, colg, colb, float(posx) / 1000.0, float(posy) / 1000.0, 0, 6.0, float(time), 0.2, 0.2, screen); // format our hudmsg if we are on the last line
1023 } else {
1024 add(out, strlen(out) + i, textblock); // else add the next line to the outstring, before this, out is empty (or have some leading linebreaks)
1025 }
1026 }
1027 if (i == -1) { // apparently we are on the last line here
1028 add(out, strlen(out) + strlen(textblock), textblock); // add the last line to out
1029 if (screen - y < 4) show_hudmessage(id, out); // we will only print the hudstring if we are under the 4 screen limit
1030 textremain = false; // we have no more text to print
1031 }
1032 }
1033 } while (textremain);
1034 }
1035 return screen - y; // we will return how many screens of text we printed
1036 }
1037
1038 public messagenominated() {
1039 if (quiet == 2) {
1040 return PLUGIN_CONTINUE;
1041 }
1042
1043 new string[256], string2[256], string3[512];
1044 if (nmaps_num < 1) {
1045 formatex(string3, 511, "%L", LANG_SERVER, "DMAP_NO_MAPS_NOMINATED");
1046 } else {
1047 new n = 0, foundone = 0;
1048 formatex(string, 255, "%L", LANG_SERVER, "DMAP_NOMINATIONS");
1049 while (n < 3 && n < nmaps_num) {
1050 formatex(string, 255, "%s %s", string, nmaps[n++]);
1051 }
1052 while (n < 6 && n < nmaps_num) {
1053 foundone = 1;
1054 format(string2, 255, "%s %s", string2, nmaps[n++]);
1055 }
1056 if (foundone) {
1057 formatex(string3, 511, "%s^n%s", string, string2);
1058 } else {
1059 formatex(string3, 511, "%s", string);
1060 }
1061 }
1062 hudtext16(string3, random_num(0, 222), random_num(0, 111), random_num(111, 222), -1000, 50, random_num(1, 4), 10, 0);
1063 return PLUGIN_CONTINUE;
1064 }
1065
1066 public listnominations(id) {
1067 if (get_pcvar_num(pNominationsAllowed) == 1) {
1068 new a = 0, string3[512], string1[96], name1[33];
1069 if (a < nmaps_num) {
1070 //show_hudmessage(id, "The following maps have been nominated for the next map vote:");
1071 formatex(string3, 255, "%L", id, "DMAP_NOMINATED_MAPS");
1072 }
1073 while (a < nmaps_num) {
1074 get_user_name(whonmaps_num[a], name1, 32);
1075 //set_hudmessage(255, 0, 0, 0.12, 0.3 + 0.08 * float(a), 0, 15.0, 15.04, 1.5, 3.75, 2 + a);
1076 //show_hudmessage(id, "%s by: %s", nmaps[a], name1);
1077 formatex(string1, 95, "%L", id, "DMAP_MAP_BY", nmaps[a], name1);
1078 add(string3, 511, string1, 95);
1079 a++;
1080 }
1081 hudtext16(string3, random_num(0, 222), random_num(0, 111), random_num(111, 222), 300, 10, random_num(1, 4), 15, id);
1082 }
1083 }
1084
1085 public messagemaps() {
1086 if (quiet == 2) {
1087 return PLUGIN_CONTINUE;
1088 }
1089
1090 new string[256], string2[256], string3[512];
1091 new n = 0;
1092 new total = 0;
1093
1094 if ((totalmaps - 6) > 0) {
1095 n = random_num(0, totalmaps - 6);
1096 }
1097 while (total < 3 && total < totalmaps && is_map_valid(listofmaps[n]) && n < totalmaps) {
1098 if (!islastmaps(listofmaps[n]) && !isbanned(listofmaps[n]) && !isnominated(listofmaps[n])) {
1099 format(string, 255, "%s %s", string, listofmaps[n]);
1100 total++;
1101 }
1102 n++;
1103 }
1104 while (total < 6 && n < totalmaps && is_map_valid(listofmaps[n]) && !isnominated(listofmaps[n])) {
1105 if (!islastmaps(listofmaps[n]) && !isbanned(listofmaps[n])) {
1106 format(string2, 255, "%s %s", string2, listofmaps[n]);
1107 total++;
1108 }
1109 n++;
1110 }
1111 if (total > 0) {
1112 //show_hudmessage(0, "The following maps are available to nominate:^n%s", string);
1113 new temp[256];
1114 formatex(temp, 255, "%L", LANG_SERVER, "DMAP_AVAILABLE_MAPS");
1115 add(string3, 511, temp, 100);
1116 add(string3, 511, string, 100);
1117 add(string3, 511, "^n");
1118 }
1119 if (total > 3) {
1120 add(string3, 511, string2, 100);
1121 }
1122
1123 hudtext16(string3, random_num(0, 222), random_num(0, 111), random_num(111, 222), -1000, 50, random_num(1, 4), 10, 0);
1124 return PLUGIN_CONTINUE;
1125 }
1126
1127 public messagefifteen() {
1128 if (quiet == 2) {
1129 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_VOTING_IN_15SEC");
1130 return PLUGIN_HANDLED;
1131 }
1132 set_hudmessage(0, 222, 50, -1.0, 0.23, 1, 6.5, 6.5, 1.0, 3.0, 4);
1133 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_VOTING_IN_15SEC");
1134 if (quiet == 0) {
1135 client_cmd(0, "spk ^"get red(e80) ninety(s45) to check(e20) use bay(s18) mass(e42) cap(s50)^"");
1136 }
1137 set_task(8.7, "getready", DMAP_TASKID_GET_READY);
1138 return PLUGIN_HANDLED;
1139 }
1140
1141 public getready() {
1142 if (!cycle) {
1143 set_task(0.93, "timetovote", DMAP_TASKID_TIME_TO_VOTE, "", 0, "a", 5);
1144 }
1145 }
1146
1147 public timetovote() {
1148 counttovote++;
1149 new speak[5][] = {"one", "two", "three", "four", "five"};
1150
1151 if (get_timeleft() > 132 || counttovote > 5 || cycle || isbuytime) {
1152 counttovote = 0;
1153 remove_task(DMAP_TASKID_TIME_TO_VOTE);
1154 remove_task(DMAP_TASKID_GET_READY);
1155 return PLUGIN_HANDLED;
1156 } else {
1157 if (counttovote > 0 && counttovote <= 5) {
1158 set_hudmessage(0, 222, 50, -1.0, 0.13, 0, 1.0, 0.94, 0.0, 0.0, 4);
1159 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_VOTING_IN_XSEC", 6 - counttovote);
1160 if (quiet != 1) {
1161 client_cmd(0, "spk ^"fvox/%s^"", speak[5 - counttovote]);
1162 }
1163 }
1164 }
1165 return PLUGIN_HANDLED;
1166 }
1167
1168 available_maps() { //return number of maps that havent that have been added yet
1169 new num = 0, isinlist;
1170 new current_map[32], a, i;
1171 get_mapname(current_map, 31);
1172 for (a = 0; a < num_nmapsfill; a++) {
1173 if (is_map_valid(nmapsfill[a])) {
1174 isinlist = 0;
1175 for (i = 0; i < nmaps_num; i++) {
1176 if (equali(nmapsfill[a], nmaps[i])) {
1177 isinlist = 1;
1178 }
1179 }
1180 if (!isinlist) {
1181 num++;
1182 }
1183 }
1184 }
1185 return num;
1186 }
1187
1188 public askfornextmap() {
1189 display_message();
1190 new timeleft = get_timeleft();
1191
1192 if (isspeedset && timeleft > 30) {
1193 isspeedset = 0;
1194 set_cvar_float("sv_maxspeed", thespeed);
1195 }
1196 if (waited > 0) {
1197 return PLUGIN_HANDLED;
1198 }
1199 if (timeleft > 300) {
1200 isend = 0;
1201 remove_task(DMAP_TASKID_END_OF_ROUND);
1202 }
1203 new mp_winlimit = get_cvar_num("mp_winlimit");
1204 if (mp_winlimit) {
1205 new s = mp_winlimit - 2;
1206 if ((s > teamscore[0] && s > teamscore[1]) && (timeleft > 114 || timeleft < 1)) {
1207 remove_task(DMAP_TASKID_TIME_DIS);
1208 mselected = false;
1209 return PLUGIN_HANDLED;
1210 }
1211 } else {
1212 if (timeleft > 114 || timeleft < 1) {
1213 remove_task(DMAP_TASKID_TIME_DIS);
1214 if (timeleft > 135) {
1215 remove_task(DMAP_TASKID_TIME_DISPLAY);
1216 }
1217 mselected = false;
1218 return PLUGIN_HANDLED;
1219 }
1220 }
1221 if (inprogress || mselected || cycle) {
1222 return PLUGIN_HANDLED;
1223 }
1224 mselected = false;
1225 inprogress = 1;
1226 if (mp_winlimit && !(timeleft >= 115 && timeleft < 134)) {
1227 if (quiet != 2) {
1228 set_hudmessage(0, 222, 50, -1.0, 0.13, 1, 6.0, 6.0, 1.0, 1.0, 4);
1229 show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_START_MAPVOTE");
1230 if (quiet != 1) {
1231 client_cmd(0, "spk ^"get red(e80) ninety(s45) to check(e20) use bay(s18) mass(e42) cap(s50)^"");
1232 }
1233 set_task(4.2, "getready", DMAP_TASKID_GET_READY);
1234 set_task(10.0, "startthevote");
1235 } else {
1236 set_task(1.0, "startthevote");
1237 }
1238 } else {
1239 set_task(0.5, "startthevote");
1240 }
1241 return PLUGIN_HANDLED;
1242 }
1243
1244 public startthevote() {
1245 new j;
1246 if (cycle) {
1247 inprogress = 0;
1248 mselected = false;
1249 remove_task(DMAP_TASKID_TIME_TO_VOTE);
1250 remove_task(DMAP_TASKID_GET_READY);
1251 new smap[32];
1252 get_cvar_string("amx_nextmap", smap, 31);
1253 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_NEXTMAP2", smap);
1254 return PLUGIN_HANDLED;
1255 }
1256 for (j = 0; j < maps_to_select + 2; j++) {
1257 nvotes[j] = 0;
1258 }
1259 mselected = true;
1260 inprogress = 1;
1261 counttovote = 0;
1262 if ((isbuytime || isbetween) && get_timeleft() && get_timeleft() > 54 && get_pcvar_num(pWeaponDelay)) {
1263 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_VOTING_DELAYED");
1264 if (isbetween) {
1265 set_task(15.0, "getready", DMAP_TASKID_GET_READY);
1266 set_task(21.0, "startthevote");
1267 } else {
1268 set_task(8.0, "getready", DMAP_TASKID_GET_READY);
1269 set_task(14.0, "startthevote");
1270 }
1271 return PLUGIN_HANDLED;
1272 } //else startthevote anyways..., regardless of buytime
1273
1274 remove_task(DMAP_TASKID_TIME_TO_VOTE);
1275 remove_task(DMAP_TASKID_GET_READY);
1276
1277 if (quiet != 2) {
1278 if (bIsCstrike) {
1279 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_POSSIBLE_NOMINATIONS", nmaps_num, maps_to_select);
1280 }
1281 }
1282
1283 #if defined DEDICATED_LOG_ENABLED
1284 log_to_file(logfilename, "Nominations for the map vote: %d out of %d possible nominations", nmaps_num, maps_to_select);
1285 #endif
1286
1287 before_num_nmapsfill = num_nmapsfill;
1288 new available = available_maps();
1289
1290 if ((nmaps_num + available) < (maps_to_select + 1)) { //Loads maps from mapcycle.txt/allmaps.txt if not enough are in in mapchoice.ini
1291
1292 new current_map[32];
1293 get_mapname(current_map,31);
1294 new overflowprotect = 0;
1295 new used[MAX_MAPS_AMOUNT];
1296 new k = num_nmapsfill;
1297 new totalfilled = 0;
1298 new alreadyused;
1299 new tryfill, custfill = 0;
1300 new q;
1301 new listpossible = totalmaps;
1302 while (((available_maps() + nmaps_num - custfill) < (maps_to_select + 7)) && listpossible > 0) {
1303 alreadyused = 0;
1304 q = 0;
1305 tryfill = random_num(0, totalmaps - 1);
1306 overflowprotect = 0;
1307 while (used[tryfill] && overflowprotect++ <= totalmaps * 15) {
1308 tryfill = random_num(0, totalmaps - 1);
1309 }
1310 if (overflowprotect >= totalmaps * 15) {
1311 alreadyused = 1;
1312 #if defined DEDICATED_LOG_ENABLED
1313 log_to_file(logfilename, "Overflow detected in Map Nominate plugin, there might not be enough maps in the current vote");
1314 #endif
1315 listpossible -= 1;
1316 } else {
1317 while (q < num_nmapsfill && !alreadyused) {
1318 if (equali(listofmaps[tryfill], nmapsfill[q])) {
1319 alreadyused = used[tryfill] = 1;
1320 listpossible--;
1321 }
1322 q++;
1323 }
1324 q = 0;
1325 while (q < nmaps_num && !alreadyused) {
1326 if (equali(listofmaps[tryfill], nmaps[q])) {
1327 alreadyused = used[tryfill] = 1;
1328 listpossible--;
1329 }
1330 q++;
1331 }
1332 }
1333
1334 if (!alreadyused) {
1335 if (equali(listofmaps[tryfill], current_map) || equali(listofmaps[tryfill], last_map)||
1336 islastmaps(listofmaps[tryfill]) || isbanned(listofmaps[tryfill])) {
1337 listpossible--;
1338 used[tryfill] = 1;
1339 } else {
1340 if (iscustommap(listofmaps[tryfill])) {
1341 custfill++;
1342 }
1343 nmapsfill[k] = listofmaps[tryfill];
1344 num_nmapsfill++;
1345 listpossible--;
1346 used[tryfill] = 1;
1347 k++;
1348 totalfilled++;
1349 }
1350 }
1351 }
1352 #if defined DEDICATED_LOG_ENABLED
1353 log_to_file(logfilename, "Filled %d slots in the fill maps array with maps from mapcycle.txt, %d are custom", totalfilled, custfill);
1354 #endif
1355 }
1356
1357 nbeforefill = nmaps_num; //extra maps do not act as "nominations" they are additions
1358
1359 if (nmaps_num < maps_to_select) {
1360
1361 new need = maps_to_select - nmaps_num;
1362 console_print(0, "%L", LANG_PLAYER, "DMAP_RANDOM_MAPSELECTION", need);
1363 #if defined DEDICATED_LOG_ENABLED
1364 log_to_file(logfilename, "Randomly Filling slots for the vote with %d out of %d", need, num_nmapsfill);
1365 #endif
1366 new fillpossible = num_nmapsfill;
1367 new k = nmaps_num;
1368 new overflowprotect = 0;
1369 new used[MAX_MAPS_AMOUNT];
1370 new totalfilled = 0, custchoice = 0, full = ((amt_custom + custchoice) >= maxcustnom);
1371 new alreadyused;
1372 new tryfill;
1373 if (num_nmapsfill < 1) {
1374 if (quiet != 2) {
1375 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_NOMORE_RANDOM_DEFINED");
1376 }
1377 #if defined DEDICATED_LOG_ENABLED
1378 log_to_file(logfilename, "ERROR: Unable to fill any more voting slots with random maps, none defined in mapchoice.ini/allmaps.txt/mapcycle.txt");
1379 #endif
1380 } else {
1381 while (fillpossible > 0 && k < maps_to_select) {
1382 alreadyused = 0;
1383 new q = 0;
1384 tryfill = random_num(0, num_nmapsfill - 1);
1385 overflowprotect = 0;
1386 while (used[tryfill] && overflowprotect++ <= num_nmapsfill * 10) {
1387 tryfill = random_num(0, num_nmapsfill - 1);
1388 }
1389 if (overflowprotect >= num_nmapsfill * 15) {
1390 alreadyused = 1;
1391 #if defined DEDICATED_LOG_ENABLED
1392 log_to_file(logfilename, "Overflow detected in Map Nominate plugin, there might not be enough maps in the current vote");
1393 #endif
1394 fillpossible -= 2;
1395 } else {
1396 while (q < nmaps_num && !alreadyused) {
1397 if (equali(nmapsfill[tryfill], nmaps[q])) {
1398 alreadyused = used[tryfill] = 1;
1399 fillpossible--;
1400 }
1401 q++;
1402 }
1403 if (!alreadyused) {
1404 if (iscustommap(nmapsfill[tryfill]) && full) {
1405 alreadyused = used[tryfill] = 1;
1406 fillpossible--;
1407 }
1408 }
1409 }
1410
1411 if (!alreadyused) {
1412 if (iscustommap(nmapsfill[tryfill])) {
1413 custchoice++;
1414 full = ((amt_custom + custchoice) >= maxcustnom);
1415 }
1416 nmaps[k] = nmapsfill[tryfill];
1417 nmaps_num++;
1418 fillpossible--;
1419 used[tryfill] = 1;
1420 k++;
1421 totalfilled++;
1422 }
1423 }
1424
1425 if (totalfilled == 0) {
1426 console_print(0, "%L", LANG_PLAYER, "DMAP_NO_DEFAULTMAPS_FOUND");
1427 } else {
1428 if (quiet != 2) {
1429 console_print(0, "%L", LANG_PLAYER, "DMAP_FILLED_RANDOM_MAPS", totalfilled);
1430 }
1431 }
1432 #if defined DEDICATED_LOG_ENABLED
1433 log_to_file(logfilename, "Filled %d vote slots with random maps, %d are custom", totalfilled, custchoice);
1434 #endif
1435 }
1436 }
1437
1438 show_vote_menu(true);
1439 return PLUGIN_HANDLED;
1440 }
1441
1442 show_vote_menu(bool:bFirstTime) {
1443
1444 new menu[512], a, mkeys = (1 << maps_to_select + 1);
1445 new steptime = get_pcvar_num(pExtendmapStep);
1446
1447 new pos;
1448
1449 new mp_winlimit = get_cvar_num("mp_winlimit");
1450 if (bFirstTime == true) {
1451 g_TotalVotes = 0;
1452 for (a = 0; a <= 32; a++) {
1453 g_AlreadyVoted[a] = false;
1454 }
1455 }
1456
1457 if (bIsCstrike) {
1458 pos = formatex(menu, 511, "%L", LANG_SERVER, "DMAP_CS_MENU_TITLE");
1459 } else {
1460 pos = formatex(menu, 511, "%L", LANG_SERVER, "DMAP_MENU_TITLE");
1461 }
1462
1463 new dmax = (nmaps_num > maps_to_select) ? maps_to_select : nmaps_num;
1464
1465 new tagpath[64], sMenuOption[64]; // If size of sMenuOption is changed, change maxlength in append_vote_percent as well
1466 formatex(tagpath, 63, "%s/dmaptags.ini", custompath);
1467
1468 for (nmapstoch = 0; nmapstoch < dmax; ++nmapstoch) {
1469 if (bFirstTime == true) {
1470 a = random_num(0, nmaps_num - 1); // Randomize order of maps in vote
1471 while (isinmenu(a)) {
1472 if (++a >= nmaps_num) {
1473 a = 0;
1474 }
1475 }
1476 nnextmaps[nmapstoch] = a;
1477 nvotes[nmapstoch] = 0; // Reset votes for each map
1478 }
1479
1480 if (iscustommap(nmaps[nnextmaps[nmapstoch]]) && usestandard) {
1481 if (bIsCstrike) {
1482 formatex(sMenuOption, 63, "%L", LANG_SERVER, "DMAP_CS_MENU_CUSTOM", nmapstoch + 1, nmaps[nnextmaps[nmapstoch]]);
1483 } else {
1484 formatex(sMenuOption, 63, "%L", LANG_SERVER, "DMAP_MENU_CUSTOM", nmapstoch + 1, nmaps[nnextmaps[nmapstoch]]);
1485 }
1486 } else { // Don't show (Custom)
1487 formatex(sMenuOption, 63, "%d. %s", nmapstoch + 1, nmaps[nnextmaps[nmapstoch]]);
1488 }
1489
1490 if (file_exists(tagpath)) { // If the tag file is there, check for the extra tag
1491 new iLine, sFullLine[64], sTagMap[32], sTagText[32], txtLen;
1492
1493 while (read_file(tagpath, iLine, sFullLine, 63, txtLen)) {
1494 if (sFullLine[0] == ';') {
1495 iLine++;
1496 continue; // Ignore comments
1497 }
1498
1499 strbreak(sFullLine, sTagMap, 31, sTagText, 31); // Split the map name and tag apart
1500
1501 if (equali(nmaps[nnextmaps[nmapstoch]], sTagMap)) {
1502 format(sMenuOption, 63, "%s [%s]", sMenuOption, sTagText);
1503 break; // Quit reading the file
1504 }
1505 iLine++;
1506 }
1507 }
1508
1509 append_vote_percent(sMenuOption, nmapstoch, true);
1510 pos += formatex(menu[pos], 511, sMenuOption);
1511
1512 mkeys |= (1 << nmapstoch);
1513 }
1514
1515 menu[pos++] = '^n';
1516 if (bFirstTime == true) {
1517 nvotes[maps_to_select] = 0;
1518 nvotes[maps_to_select + 1] = 0;
1519 }
1520 new mapname[32];
1521 get_mapname(mapname, 31);
1522 if (!mp_winlimit && get_cvar_float("mp_timelimit") < get_pcvar_float(pExtendmapMax)) {
1523 formatex(sMenuOption, 63, "%L", LANG_SERVER, "DMAP_MENU_EXTEND", maps_to_select + 1, mapname, steptime);
1524 append_vote_percent(sMenuOption, maps_to_select, true);
1525 pos += formatex(menu[pos], 511, sMenuOption);
1526
1527 mkeys |= (1 << maps_to_select);
1528 }
1529
1530 formatex(sMenuOption, 63, "%L", LANG_SERVER, "DMAP_MENU_NONE", maps_to_select + 2);
1531 append_vote_percent(sMenuOption, maps_to_select + 1);
1532 formatex(menu[pos], 511, sMenuOption);
1533
1534 if (bFirstTime == true) {
1535 g_VoteTimeRemaining = DMAP_VOTE_TIME;
1536 set_task(float(g_VoteTimeRemaining), "check_votes");
1537 show_menu(0, mkeys, menu, --g_VoteTimeRemaining, DMAP_MENU_TITLE);
1538 set_task(1.0, "update_vote_time_remaining", DMAP_TASKID_VTR, "", 0, "a", g_VoteTimeRemaining);
1539 if (bIsCstrike) {
1540 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_TIME_TO_CHOOSE");
1541 }
1542 if (quiet == 0) {
1543 client_cmd(0, "spk Gman/Gman_Choose%d", random_num(1, 2));
1544 }
1545 #if defined DEDICATED_LOG_ENABLED
1546 log_to_file(logfilename, "Vote: Voting for the nextmap started");
1547 #endif
1548 } else {
1549 new players[32], iNum, id;
1550 get_players(players, iNum, "ch");
1551 for (new iPlayer = 0; iPlayer < iNum; iPlayer++) {
1552 id = players[iPlayer];
1553 if (g_AlreadyVoted[id] == false) {
1554 show_menu(players[iPlayer], mkeys, menu, g_VoteTimeRemaining, DMAP_MENU_TITLE);
1555 }
1556 }
1557
1558 }
1559 return PLUGIN_HANDLED;
1560 }
1561
1562 stock percent(iIs, iOf) {
1563 return (iOf != 0) ? floatround(floatmul(float(iIs) / float(iOf), 100.0)) : 0;
1564 }
1565
1566 append_vote_percent(sMenuOption[], iChoice, bool:bNewLine = false) {
1567
1568 new iPercent = percent(nvotes[iChoice], g_TotalVotes);
1569 new sPercent[16];
1570 if (iPercent > 0) { // Don't show 0%
1571 if (bIsCstrike) {
1572 formatex(sPercent, 15, " \d(%d%s)\w", iPercent, "%%");
1573 } else {
1574 formatex(sPercent, 15, " (%d%s)", iPercent, "%%");
1575 }
1576 strcat(sMenuOption, sPercent, 63);
1577 }
1578
1579 if (bNewLine == true) { // Do this even if vote is 0%
1580 strcat(sMenuOption, "^n", 63);
1581 }
1582
1583 return PLUGIN_HANDLED;
1584 }
1585
1586 public update_vote_time_remaining() {
1587 if (--g_VoteTimeRemaining <= 0) {
1588 remove_task(DMAP_TASKID_VTR);
1589 }
1590 return PLUGIN_HANDLED;
1591 }
1592
1593 handle_andchange(id, map2[], bool:bForce = false) {
1594 new tester[32];
1595 if (is_map_valid(map2) == 1) {
1596 handle_nominate(id, map2, bForce);
1597 } else {
1598 formatex(tester, 31, "cs_%s", map2);
1599 if (is_map_valid(tester) == 1) {
1600 handle_nominate(id, tester, bForce);
1601 } else {
1602 formatex(tester, 31, "de_%s", map2);
1603 if (is_map_valid(tester) == 1) {
1604 handle_nominate(id, tester, bForce);
1605 } else {
1606 formatex(tester, 31, "as_%s", map2);
1607 if (is_map_valid(tester) == 1) {
1608 handle_nominate(id, tester, bForce);
1609 } else {
1610 formatex(tester, 31, "dod_%s", map2);
1611 if (is_map_valid(tester) == 1) {
1612 handle_nominate(id, tester, bForce);
1613 } else {
1614 formatex(tester, 31, "fy_%s", map2);
1615 if (is_map_valid(tester) == 1) {
1616 handle_nominate(id, tester, bForce);
1617 } else { // Send invalid map. handle_nominate() handles the error.
1618 handle_nominate(id, map2, bForce);
1619 }
1620 }
1621 }
1622 }
1623 }
1624 }
1625 }
1626
1627 public HandleSay(id) {
1628
1629 new chat[256];
1630 read_args(chat, 255);
1631 new saymap[256];
1632 saymap = chat;
1633 remove_quotes(saymap);
1634 new saymap2[29];
1635 read_args(saymap2, 28);
1636 remove_quotes(saymap2);
1637 new chat2[32];
1638
1639 if (containi(chat, "<") != -1 || containi(chat, "?") != -1 || containi(chat, ">") != -1 || containi(chat, "*") != -1 || containi(chat, "&") != -1 || containi(chat, ".") != -1) {
1640 return PLUGIN_CONTINUE;
1641 }
1642 if (containi(chat, "nominations") != -1) {
1643 if (get_pcvar_num(pNominationsAllowed) == 0) {
1644 client_print(id, print_chat, "%L", id, "DMAP_NOMINATIONS_DISABLED");
1645 return PLUGIN_HANDLED;
1646 }
1647 if (mselected) {
1648 client_print(id, print_chat, "%L", id, "DMAP_VOTE_IN_PROGRESS");
1649 } else {
1650 if (nmaps_num == 0) {
1651 client_print(id, print_chat, "%L", id, "DMAP_NO_NOMINATIONS");
1652 } else {
1653 listnominations(id);
1654 }
1655 }
1656 } else {
1657 if (containi(chat, "nominate ") == 1) {
1658 new mycommand[41];
1659 read_args(mycommand, 40);
1660 remove_quotes(mycommand);
1661 handle_andchange(id, mycommand[9]);
1662 } else {
1663 if (containi(chat, "vote ") == 1) {
1664 new mycommand[37];
1665 read_args(mycommand, 36);
1666 remove_quotes(mycommand);
1667 handle_andchange(id, mycommand[5]);
1668 } else {
1669 if (is_map_valid(saymap) == 1) {
1670 handle_nominate(id, saymap, false);
1671 } else {
1672 formatex(chat2, 31, "cs_%s", saymap2);
1673 if (is_map_valid(chat2) == 1) {
1674 handle_nominate(id, chat2, false);
1675 } else {
1676 formatex(chat2, 31, "de_%s", saymap2);
1677 if (is_map_valid(chat2) == 1) {
1678 handle_nominate(id, chat2, false);
1679 } else {
1680 formatex(chat2, 31, "as_%s", saymap2);
1681 if (is_map_valid(chat2) == 1) {
1682 handle_nominate(id, chat2, false);
1683 } else {
1684 formatex(chat2, 31, "dod_%s", saymap2);
1685 if (is_map_valid(chat2) == 1) {
1686 handle_nominate(id, chat2, false);
1687 } else {
1688 formatex(chat2, 31, "fy_%s", saymap2);
1689 if (is_map_valid(chat2) == 1) {
1690 handle_nominate(id, chat2, false);
1691 }
1692 }
1693 }
1694 }
1695 }
1696 }
1697 }
1698 }
1699 }
1700 return PLUGIN_CONTINUE;
1701 }
1702
1703 public calculate_custom() {
1704 //New optional protection against "too many" custom maps being nominated.
1705 amt_custom = 0;
1706 new i;
1707 for (i = 0; i < nmaps_num; i++) {
1708 if (iscustommap(nmaps[i])) {
1709 amt_custom++;
1710 }
1711 }
1712 }
1713
1714 public handle_nominate(id, map[], bool:bForce) {
1715 if ((get_pcvar_num(pNominationsAllowed) == 0) && (bForce == false)) {
1716 client_print(id, print_chat, "%L", id, "DMAP_NOMINATIONS_DISABLED");
1717 return PLUGIN_HANDLED;
1718 }
1719 strtolower(map);
1720 new current_map[32], iscust = 0, iscust_t = 0, full;
1721 full = (amt_custom >= maxcustnom);
1722 new n = 0, i, done = 0, isreplacement = 0; //0: (not a replacement), 1: (replacing his own), 2: (replacing others)
1723 new tempnmaps = nmaps_num;
1724 get_mapname(current_map, 31);
1725 if (maxnom == 0) {
1726 client_print(id, print_chat, "%L", id, "DMAP_NOMINATIONS_DISABLED");
1727 return PLUGIN_HANDLED;
1728 }
1729 if (inprogress && mselected) {
1730 client_print(id, print_chat, "%L", id, "DMAP_VOTING_IN_PROGRESS");
1731 return PLUGIN_HANDLED;
1732 }
1733 if (mselected) {
1734 new smap[32];
1735 get_cvar_string("amx_nextmap", smap, 31);
1736 client_print(id, print_chat, "%L", id, "DMAP_VOTING_OVER", smap);
1737 return PLUGIN_HANDLED;
1738 }
1739 if (!is_map_valid(map) || is_map_valid(map[1])) {
1740 client_print(id, print_chat, "%L", id, "DMAP_MAP_NOTFOUND", map);
1741 return PLUGIN_HANDLED;
1742 }
1743 if (isbanned(map) && (bForce == false)) {
1744 client_print(id, print_chat, "%L", id, "DMAP_MAPVOTE_NOT_AVAILABLE");
1745 return PLUGIN_HANDLED;
1746 }
1747 if (islastmaps(map) && !equali(map, current_map) && (bForce == false)) {
1748 client_print(id, print_chat, "%L", id, "DMAP_CANT_NOMINATE_LASTMAP", ban_last_maps);
1749 return PLUGIN_HANDLED;
1750 }
1751 if (equali(map, current_map)) {
1752 client_print(id, print_chat, "%L", id, "DMAP_EXTEND_MAP", map);
1753 return PLUGIN_HANDLED;
1754 }
1755 //Insert Strict Style code here, for pcvar dmap_strict 1
1756 if (get_pcvar_num(pDmapStrict) && (bForce == false)) {
1757 new isinthelist = 0;
1758 for (new a = 0; a < totalmaps; a++) {
1759 if (equali(map, listofmaps[a]))
1760 isinthelist = 1;
1761 }
1762 if (!isinthelist) {
1763 client_print(id, print_chat, "%L", id, "DMAP_ALLOWED_MAPS");
1764 return PLUGIN_HANDLED;
1765 }
1766 }
1767 iscust = iscustommap(map);
1768 if (nmaps_num >= maps_to_select || Nominated[id] >= maxnom) { //3 (1,2,3)
1769 if (Nominated[id] > maxnom) { //3
1770 client_print(id, print_chat, "%L", id, "DMAP_MAX_MAPS_REACHED"); //Possible to reach here!
1771 //only if the command dmap_nominations is used to lower amount of maps that can be nominated
1772 return PLUGIN_HANDLED;
1773 }
1774
1775 for (i = 0; i < nmaps_num; i++) {
1776 if (equali(map, nmaps[i])) {
1777
1778 new name[32];
1779 get_user_name(whonmaps_num[i], name, 31);
1780 if (quiet == 2) {
1781 client_print(id, print_chat, "%L", id, "DMAP_ALREADY_NOMINATED", map, name);
1782 } else {
1783 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_ALREADY_NOMINATED", map, name);
1784 }
1785 return PLUGIN_HANDLED;
1786 }
1787 }
1788
1789 while (n < nmaps_num && !done && Nominated[id] > 1) { //If the person has nominated 2 or 3 maps, he can replace his own
1790 if (whonmaps_num[n] == id) { //If a map is found that he has nominated, replace his own nomination.
1791 iscust_t = iscustommap(nmaps[n]);
1792 if (!(full && iscust && !iscust_t)) {
1793 Nominated[id] = Nominated[id] - 1;
1794 nmaps_num = n;
1795 done = 1;
1796 isreplacement = 1;
1797 }
1798 }
1799 n++;
1800 }
1801
1802 if (!done) {
1803 n = 0;
1804 while (n < nmaps_num && !done && Nominated[id] < 2) { //If the person has nom only 1 or no maps, he can replace ppl who nominated 3
1805 if (Nominated[whonmaps_num[n]] > 2) { //Replace the "greedy person's" nomination
1806 iscust_t = iscustommap(nmaps[n]);
1807 if (!(full && iscust && !iscust_t)) {
1808 done = 1;
1809 Nominated[whonmaps_num[n]] = Nominated[whonmaps_num[n]] - 1;
1810 nmaps_num = n;
1811 isreplacement = 2;
1812 }
1813 }
1814 n++;
1815 }
1816 }
1817 if (!done) {
1818 n = 0;
1819
1820 while (n < nmaps_num && !done && Nominated[id] < 1) { //If the person has not nom any maps, he can replace those with more than one
1821 //he cannot replace those with only one nomination, that would NOT be fair
1822
1823 if (Nominated[whonmaps_num[n]] > 1) { //Replace the "greedy person's" nomination
1824 iscust_t = iscustommap(nmaps[n]);
1825 if (!(full && iscust && !iscust_t)) {
1826 done = 1;
1827 Nominated[whonmaps_num[n]] = Nominated[whonmaps_num[n]] - 1;
1828 nmaps_num = n;
1829 isreplacement = 2;
1830 }
1831 }
1832 n++;
1833 }
1834 }
1835
1836 if (!done) {
1837 n = 0;
1838
1839 while (n < nmaps_num && !done && Nominated[id] > 0) { //If the person has nominated a map, he can replace his own
1840 if (whonmaps_num[n] == id) { //If a map is found that he has nominated, replace his own nomination.
1841 iscust_t = iscustommap(nmaps[n]);
1842 if (!(full && iscust && !iscust_t)) { //Check to see if too many custom maps are nominated
1843 Nominated[id] = Nominated[id] - 1;
1844 nmaps_num = n;
1845 done = 1;
1846 isreplacement = 1;
1847 }
1848 }
1849 n++;
1850 }
1851 }
1852 if (!done) {
1853 client_print(id, print_chat, "%L", id, "DMAP_MAX_NOMINATIONS_REACHED", nmaps_num);
1854 return PLUGIN_HANDLED;
1855 }
1856 }
1857
1858 for (i = 0; i < nmaps_num; i++) {
1859 if (equali(map, nmaps[i])) {
1860 new name[32];
1861 get_user_name(whonmaps_num[i], name, 31);
1862
1863 client_print(id, print_chat, "%L", id, "DMAP_ALREADY_NOMINATED", map, name);
1864
1865 nmaps_num = tempnmaps;
1866
1867 return PLUGIN_HANDLED;
1868 }
1869 }
1870
1871 if (!isreplacement && iscust && full) {
1872 client_print(id, print_chat, "%L", id, "DMAP_MAX_CUSTOMMAPS_REACHED", maxcustnom);
1873 return PLUGIN_HANDLED;
1874 }
1875
1876 new name[32];
1877 get_user_name(id, name, 31);
1878 if (isreplacement == 1) { //They are replacing their old map
1879 if (quiet == 2) {
1880 client_print(id, print_chat, "%L", id, "DMAP_REPLACE_PREVIOUS_NOMINATION", nmaps[nmaps_num]);
1881 } else {
1882 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_PLAYER_REPLACED_NOMINATION", name, nmaps[nmaps_num]);
1883 }
1884 } else {
1885 if (isreplacement == 2) {
1886 if (quiet == 2) {
1887 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_NOMINATION_REPLACED", nmaps[nmaps_num]);
1888 } else {
1889 new name21[32];
1890 get_user_name(whonmaps_num[nmaps_num], name21, 31);
1891 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_NOMINATION_REPLACED2", name21, nmaps[nmaps_num]);
1892 }
1893 }
1894 }
1895
1896 Nominated[id]++;
1897
1898 console_print(id, "%L", id, "DMAP_ADD_NOMINATION", map, nmaps_num + 1);
1899
1900 set_task(0.18, "calculate_custom");
1901 copy(nmaps[nmaps_num], 31, map);
1902 whonmaps_num[nmaps_num] = id;
1903
1904 if (isreplacement) {
1905 nmaps_num = tempnmaps;
1906 } else {
1907 nmaps_num = tempnmaps + 1;
1908 }
1909 if ((bForce == true) && (get_pcvar_num(pShowActivity) > 0)) {
1910 switch(get_pcvar_num(pShowActivity)) {
1911 case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_ADMIN_NOMINATED_MAP1", map);
1912 case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_ADMIN_NOMINATED_MAP2", name, map);
1913 }
1914 } else {
1915 client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_NOMINATED_MAP", name, map);
1916 }
1917
1918 return PLUGIN_HANDLED;
1919 }
1920
1921 public team_score() {
1922
1923 new team[2];
1924 read_data(1, team, 1);
1925 teamscore[(team[0] == 'C') ? 0 : 1] = read_data(2);
1926
1927 return PLUGIN_CONTINUE;
1928 }
1929
1930 public plugin_end() {
1931 new current_map[32];
1932 get_mapname(current_map, 31);
1933 set_localinfo("amx_lastmap", current_map);
1934
1935 if (istimeset) {
1936 set_cvar_float("mp_timelimit", oldtimelimit);
1937 } else {
1938 if (istimeset2) {
1939 set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") - 2.0);
1940 }
1941 }
1942 if (isspeedset) {
1943 set_cvar_float("sv_maxspeed", thespeed);
1944 }
1945 if (iswinlimitset) {
1946 set_cvar_num("mp_winlimit", oldwinlimit);
1947 }
1948 return PLUGIN_CONTINUE;
1949 }
1950
1951 public get_listing() {
1952 new i = 0, iavailable = 0;
1953 new line = 0, p;
1954 new stextsize = 0, isinthislist = 0, found_a_match = 0, done = 0;
1955 new linestr[256];
1956 new maptext[32];
1957 new current_map[32];
1958 get_mapname(current_map, 31);
1959 //pathtomaps = "mapcycle.txt";
1960 get_cvar_string("mapcyclefile", pathtomaps, 63);
1961 new smap[32];
1962 get_cvar_string("amx_nextmap", smap, 31);
1963 if (file_exists(pathtomaps)) {
1964 while (read_file(pathtomaps, line, linestr, 255, stextsize) && !done) {
1965 formatex(maptext, 31, "%s", linestr);
1966 if (is_map_valid(maptext) && !is_map_valid(maptext[1]) && equali(maptext, current_map)) {
1967 done = found_a_match = 1;
1968 line++;
1969 if (read_file(pathtomaps, line, linestr, 255, stextsize)) {
1970 formatex(maptext, 31, "%s", linestr);
1971 if (is_map_valid(maptext) && !is_map_valid(maptext[1])) {
1972 //////////////////////////////////////////
1973 if (equali(smap, "")) {
1974 register_cvar("amx_nextmap", "", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY);
1975 }
1976 set_cvar_string("amx_nextmap", maptext);
1977 } else {
1978 found_a_match = 0;
1979 }
1980 } else {
1981 found_a_match = 0;
1982 }
1983 } else {
1984 line++;
1985 }
1986 }
1987 /*
1988 if (!found_a_match) {
1989 line = 0;
1990 while (read_file(pathtomaps, line, linestr, 255, stextsize) && !found_a_match && line < 1024) {
1991 formatex(maptext, 31, "%s", linestr);
1992 if (is_map_valid(maptext) && !is_map_valid(maptext[1])) {
1993 if (equali(smap, "")) {
1994 register_cvar("amx_nextmap", "", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY);
1995 }
1996 set_cvar_string("amx_nextmap", maptext);
1997 found_a_match = 1;
1998 } else {
1999 line++;
2000 }
2001 }
2002 }
2003 */
2004 /* CODE TO RANDOMIZE NEXTMAP VARIABLE!*/
2005 if (!found_a_match) {
2006 line = random_num(0, 50);
2007 new tries = 0;
2008
2009 while ((read_file(pathtomaps, line, linestr, 255, stextsize) || !found_a_match) && (tries < 1024 && !found_a_match)) {
2010 formatex(maptext, 31, "%s", linestr);
2011 if (is_map_valid(maptext) && !is_map_valid(maptext[1])) {
2012 if (equali(smap, "")) {
2013 register_cvar("amx_nextmap", "", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY);
2014 }
2015 set_cvar_string("amx_nextmap", maptext);
2016 found_a_match = 1;
2017 } else {
2018 line = random_num(0, 50);
2019 tries++;
2020 }
2021 }
2022 }
2023 }
2024
2025 line = 0;
2026 formatex(pathtomaps, 63, "%s/allmaps.txt", custompath);
2027 if (!file_exists(pathtomaps)) {
2028 new mapsadded = 0;
2029 while ((line = read_dir("maps", line, linestr, 255, stextsize)) != 0) {
2030 stextsize -= 4;
2031
2032 if (stextsize > 0) {
2033 if (!equali(linestr[stextsize], ".bsp")) {
2034 continue; // skip non map files
2035 }
2036 linestr[stextsize] = 0; // remove .bsp
2037 }
2038
2039 if (is_map_valid(linestr)) {
2040 write_file(pathtomaps, linestr);
2041 mapsadded++;
2042 }
2043 }
2044 #if defined DEDICATED_LOG_ENABLED
2045 log_to_file(logfilename, "Found %d maps in your <mod>/MAPS folder, and added these to the addons/amxmodx/allmaps.txt file", mapsadded);
2046 #endif
2047 line = 0;
2048 }
2049
2050 if (get_pcvar_float(pDmapStrict) == 1.0) {
2051 get_cvar_string("mapcyclefile", pathtomaps, 63);
2052 //pathtomaps = "mapcycle.txt";
2053 }
2054
2055 if (file_exists(pathtomaps)) {
2056 while (read_file(pathtomaps, line, linestr, 255, stextsize) && i < MAX_MAPS_AMOUNT) {
2057 formatex(maptext, 31, "%s", linestr);
2058 if (is_map_valid(maptext) && !is_map_valid(maptext[1])) {
2059 isinthislist = 0;
2060 for (p = 0; p < i; p++) {
2061 if (equali(maptext, listofmaps[p])) {
2062 isinthislist = 1;
2063 }
2064 }
2065 if (!isinthislist) {
2066 listofmaps[i++] = maptext;
2067 }
2068 }
2069 line++;
2070 }
2071 }
2072
2073 line = 0;
2074 for (p = 0; p < i; p++) {
2075 if (!isbanned(listofmaps[p]) && !islastmaps(listofmaps[p])) {
2076 iavailable++;
2077 }
2078 }
2079 new dummy_str[64];
2080 get_cvar_string("mapcyclefile", dummy_str, 63);
2081 //if (iavailable < maps_to_select && !equali(pathtomaps, "mapcycle.txt"))
2082 if (iavailable < maps_to_select && !equali(pathtomaps, dummy_str)) {
2083 //pathtomaps = "mapcycle.txt";
2084 get_cvar_string("mapcyclefile", pathtomaps, 63);
2085 if (file_exists(pathtomaps)) {
2086 while (read_file(pathtomaps, line, linestr, 255, stextsize) && i < MAX_MAPS_AMOUNT) {
2087 formatex(maptext, 31, "%s", linestr);
2088 if (is_map_valid(maptext) && !is_map_valid(maptext[1])) {
2089 isinthislist = 0;
2090 for (p = 0; p < i; p++) {
2091 if (equali(maptext, listofmaps[p])) {
2092 isinthislist = 1;
2093 }
2094 }
2095 if (!isinthislist) {
2096 listofmaps[i++] = maptext;
2097 }
2098 }
2099 line++;
2100 }
2101 }
2102 }
2103 totalmaps = i;
2104 iavailable = 0;
2105 for (p = 0; p < i; p++) {
2106 if (!isbanned(listofmaps[p]) && !islastmaps(listofmaps[p])) {
2107 iavailable++;
2108 }
2109 }
2110 #if defined DEDICATED_LOG_ENABLED
2111 log_to_file(logfilename, "Found %d Maps in your mapcycle.txt/allmaps.txt file, %d are available for filling slots", i, iavailable);
2112 #endif
2113 }
2114
2115 public ban_some_maps() {
2116 //BAN MAPS FROM CONFIG FILE
2117 new banpath[64];
2118 formatex(banpath, 63, "%s/mapstoban.ini", custompath);
2119 new i = 0;
2120 new line = 0;
2121 new stextsize = 0;
2122 new linestr[256];
2123 new maptext[32];
2124
2125 if (file_exists(banpath)) {
2126 while (read_file(banpath, line, linestr, 255, stextsize) && i < MAX_MAPS_AMOUNT) {
2127 formatex(maptext, 31, "%s", linestr);
2128 if (is_map_valid(maptext) && !is_map_valid(maptext[1])) {
2129 banthesemaps[i++] = maptext;
2130 }
2131 line++;
2132 }
2133 }
2134 totalbanned = i;
2135 #if defined DEDICATED_LOG_ENABLED
2136 if (totalbanned > 0) {
2137 log_to_file(logfilename, "Banned %d Maps in your mapstoban.ini file", totalbanned);
2138 } else {
2139 log_to_file(logfilename, "Did not ban any maps from mapstoban.ini file");
2140 }
2141 #endif
2142 //BAN RECENT MAPS PLAYED
2143 new lastmapspath[64];
2144 formatex(lastmapspath, 63, "%s/lastmapsplayed.txt", custompath);
2145 //new linestring[32];
2146 line = stextsize = 0;
2147 new current_map[32];
2148 get_mapname(current_map, 31);
2149 lastmaps[0] = current_map;
2150 bannedsofar++;
2151 currentplayers = activeplayers = rocks = 0;
2152 if (file_exists(lastmapspath)) {
2153 while(read_file(lastmapspath, line, linestr, 255, stextsize) && bannedsofar <= ban_last_maps) {
2154 if ((strlen(linestr) > 0) && (is_map_valid(linestr))) {
2155 formatex(lastmaps[bannedsofar++], 31, "%s", linestr);
2156 }
2157 line++;
2158 }
2159 }
2160 write_lastmaps(); //deletes and writes to lastmapsplayed.txt
2161 }
2162
2163 public write_lastmaps() {
2164 new lastmapspath[64];
2165 formatex(lastmapspath, 63, "%s/lastmapsplayed.txt", custompath);
2166 if (file_exists(lastmapspath)) {
2167 delete_file(lastmapspath);
2168 }
2169 new text[256], p;
2170 for (p = 0; p < bannedsofar; p++) {
2171 formatex(text, 255, "%s", lastmaps[p]);
2172 write_file(lastmapspath, text);
2173 }
2174 write_file(lastmapspath, "Generated by map_nominate plugin,");
2175 write_file(lastmapspath, "these are most recent maps played");
2176
2177 load_maps();
2178 }
2179
2180 public load_maps() {
2181 new choicepath[64];
2182 formatex(choicepath, 63, "%s/mapchoice.ini", custompath);
2183 new line = 0;
2184 new stextsize = 0, isinlist, unable = 0, i;
2185 new linestr[256];
2186 new maptext[32];
2187 new current_map[32];
2188 get_mapname(current_map, 31);
2189 if (file_exists(choicepath)) {
2190 while (read_file(choicepath, line, linestr, 255, stextsize) && (num_nmapsfill < MAX_MAPS_AMOUNT)) {
2191 formatex(maptext, 31, "%s", linestr);
2192 if (is_map_valid(maptext) && !is_map_valid(maptext[1])) {
2193 isinlist = 0;
2194 if (isbanned(maptext) || islastmaps(maptext)) {
2195 isinlist = 1;
2196 } else {
2197 if (equali(maptext, current_map) || equali(maptext, last_map)) {
2198 isinlist = 1;
2199 } else {
2200 for (i = 0; i < num_nmapsfill; i++) {
2201 if (equali(maptext, nmapsfill[i])) {
2202 #if defined DEDICATED_LOG_ENABLED
2203 log_to_file(logfilename, "Map ^"%s^" is already in list! It is defined it twice", maptext);
2204 #endif
2205 isinlist = 1;
2206 }
2207 }
2208 }
2209 }
2210 if (!isinlist) {
2211 copy(nmapsfill[num_nmapsfill++], 31, maptext);
2212 } else {
2213 unable++;
2214 }
2215 }
2216 line++;
2217 }
2218 #if defined DEDICATED_LOG_ENABLED
2219 log_to_file(logfilename, "Loaded %d Maps into the maps that will be picked for the vote", num_nmapsfill);
2220 log_to_file(logfilename, "%d Maps were not loaded because they were the last maps played, or defined twice, or banned", unable);
2221 } else {
2222 log_to_file(logfilename, "Unable to open file %s, In order to get maps: your mapcycle.txt file will be searched", choicepath);
2223 #endif
2224 }
2225 get_listing();
2226 }
2227
2228 public load_defaultmaps() {
2229 new standardpath[64];
2230 formatex(standardpath, 63, "%s/standardmaps.ini", custompath);
2231 new i = 0;
2232 new line = 0;
2233 new stextsize = 0;
2234 new linestr[256];
2235 new maptext[32];
2236 usestandard = 1;
2237 if (!file_exists(standardpath)) {
2238 usestandard = standardtotal = 0;
2239 } else {
2240 while(read_file(standardpath, line, linestr, 255, stextsize) && i < 40) {
2241 formatex(maptext, 31, "%s", linestr);
2242 if (is_map_valid(maptext)) {
2243 standard[i++] = maptext;
2244 }
2245 line++;
2246 }
2247 standardtotal = i;
2248 }
2249 if (standardtotal < 5) {
2250 usestandard = 0;
2251 #if defined DEDICATED_LOG_ENABLED
2252 log_to_file(logfilename, "Attention, %d Maps were found in the standardmaps.ini file. This is no problem, but the words Custom will not be used", standardtotal);
2253 #endif
2254 }
2255 }
2256
2257 bool:iscustommap(map[]) {
2258 new a;
2259 for (a = 0; a < standardtotal; a++) {
2260 if (equali(map, standard[a])) {
2261 return false;
2262 }
2263 }
2264 if (usestandard) {
2265 return true;
2266 }
2267 return false;
2268 }
2269
2270 bool:islastmaps(map[]) {
2271 new a;
2272 for (a = 0; a < bannedsofar; a++) {
2273 if (equali(map, lastmaps[a])) {
2274 return true;
2275 }
2276 }
2277 return false;
2278 }
2279
2280 bool:isnominated(map[]) {
2281 new a;
2282 for (a = 0; a < nmaps_num; a++) {
2283 if (equali(map, nmaps[a])) {
2284 return true;
2285 }
2286 }
2287 return false;
2288 }
2289
2290 bool:isbanned(map[]) {
2291 new a;
2292 for (a = 0; a < totalbanned; a++) {
2293 if (equali(map, banthesemaps[a])) {
2294 return true;
2295 }
2296 }
2297 return false;
2298 }
2299
2300 loadsettings(filename[]) {
2301 if (!file_exists(filename)) {
2302 return 0;
2303 }
2304
2305 new text[256], percent[5], strban[4], strplay[3], strwait[3], strwait2[3], strurl[64], strnum[3], strnum2[3];
2306 new len, pos = 0;
2307 new Float:numpercent;
2308 new banamount, nplayers, waittime, mapsnum;
2309 while (read_file(filename, pos++, text, 255, len)) {
2310 if (text[0] == ';') {
2311 continue;
2312 }
2313 switch(text[0]) {
2314 case 'r': {
2315 formatex(percent, 4, "%s", text[2]);
2316 numpercent = float(str_to_num(percent)) / 100.0;
2317 if (numpercent >= 0.03 && numpercent <= 1.0) {
2318 rtvpercent = numpercent;
2319 }
2320 }
2321 case 'q': {
2322 if (text[1] == '2') {
2323 quiet = 2;
2324 } else {
2325 quiet = 1;
2326 }
2327 }
2328 case 'c': {
2329 cycle = 1;
2330 }
2331 case 'd': {
2332 enabled = 0;
2333 }
2334 case 'f': {
2335 if (text[1] == 'r') {
2336 formatex(strwait2, 2, "%s", text[2]);
2337 waittime = str_to_num(strwait2);
2338 if (waittime >= 2 && waittime <= 20) {
2339 frequency = waittime;
2340 }
2341 } else {
2342 dofreeze = 0;
2343 }
2344 }
2345 case 'b': {
2346 formatex(strban, 3, "%s", text[2]);
2347 banamount = str_to_num(strban);
2348 if (banamount >= 0 && banamount <= 100) {
2349 if ((banamount == 0 && text[2] == '0') || banamount > 0) {
2350 ban_last_maps = banamount;
2351 }
2352 }
2353 }
2354 case 'm': {
2355 if (atstart) {
2356 formatex(strnum, 2, "%s", text[2]);
2357 mapsnum = str_to_num(strnum);
2358 if (mapsnum >= 2 && mapsnum <= 8) {
2359 maps_to_select = mapssave = mapsnum;
2360 }
2361 }
2362 }
2363 case 'p': {
2364 formatex(strplay, 2, "%s", text[2]);
2365 nplayers = str_to_num(strplay);
2366 if (nplayers > 0 && nplayers <= 32) {
2367 minimum = nplayers;
2368 }
2369 }
2370 case 'u': {
2371 formatex(strurl, 63, "%s", text[2]);
2372 if ((containi(strurl, "www") != -1 || containi(strurl, "http") != -1) && !equali(strurl, "http")) {
2373 mapsurl = strurl;
2374 }
2375 }
2376 case 'w': {
2377 formatex(strwait, 2, "%s", text[2]);
2378 waittime = str_to_num(strwait);
2379 if (waittime >= 5 && waittime <= 30) {
2380 minimumwait = waittime;
2381 }
2382 }
2383 case 'x': {
2384 formatex(strnum2, 2, "%s", text[2]);
2385 mapsnum = str_to_num(strnum2);
2386 if (mapsnum >= 1 && mapsnum <= 3) {
2387 maxnom = mapsnum;
2388 }
2389 }
2390 case 'y': {
2391 formatex(strnum2, 2, "%s", text[2]);
2392 mapsnum = str_to_num(strnum2);
2393 if (mapsnum >= 0 && mapsnum <= mapssave) {
2394 maxcustnom = mapsnum;
2395 }
2396 }
2397 }
2398 }
2399 return 1;
2400 }
2401
2402 set_defaults(myid) {
2403
2404 rtvpercent = 0.6;
2405 ban_last_maps = 4;
2406 maxnom = frequency = 3;
2407 quiet = cycle = 0;
2408 minimum = enabled = 1;
2409 minimumwait = 10;
2410 mapssave = maxcustnom = 5;
2411 mapsurl = "";
2412 dofreeze = bIsCstrike;
2413
2414 if (myid < 0) {
2415 savesettings(-1);
2416 } else {
2417 savesettings(myid);
2418 showsettings(myid);
2419 console_print(myid, "================== DEFAULTS SET =========================");
2420 }
2421 }
2422
2423 public dmaprtvpercent(id, level, cid) {
2424 if (!cmd_access(id, level, cid, 2)) {
2425 return PLUGIN_HANDLED;
2426 }
2427
2428 if (id == 0) {
2429 announce_config_error("dmap_rtvpercent");
2430 return PLUGIN_HANDLED;
2431 }
2432
2433 new arg[32];
2434 read_argv(1, arg, 3);
2435 new Float:percentage = float(str_to_num(arg)) / 100.0;
2436 if (percentage >= 0.03 && percentage <= 1.0) {
2437 rtvpercent = percentage;
2438 savesettings(id);
2439 showsettings(id);
2440 } else {
2441 console_print(id, "You must specify a value between 3 and 100 for dmap_rtvpercent");
2442 console_print(id, "This sets minimum percent of players that must say rockthevote to rockit");
2443 }
2444 return PLUGIN_HANDLED;
2445 }
2446
2447 public dmaprtvplayers(id, level, cid) {
2448 if (!cmd_access(id, level, cid, 2)) {
2449 return PLUGIN_HANDLED;
2450 }
2451
2452 if (id == 0) {
2453 announce_config_error("dmap_rtvplayers");
2454 return PLUGIN_HANDLED;
2455 }
2456
2457 new arg[32];
2458 read_argv(1, arg, 3);
2459 new players = str_to_num(arg);
2460 if (players >= 1 && players <= 32) {
2461 minimum = players;
2462 savesettings(id);
2463 showsettings(id);
2464 } else {
2465 console_print(id, "You must specify a value between 1 and 32 for dmap_rtvplayers");
2466 console_print(id, "This sets minimum num of players that must say rockthevote to rockit");
2467 }
2468 return PLUGIN_HANDLED;
2469 }
2470
2471 public dmaprtvwait(id, level, cid) {
2472 if (!cmd_access(id, level, cid, 2)) {
2473 return PLUGIN_HANDLED;
2474 }
2475
2476 if (id == 0) {
2477 announce_config_error("dmap_rtvwait");
2478 return PLUGIN_HANDLED;
2479 }
2480
2481 new arg[32];
2482 read_argv(1, arg, 3);
2483 new wait = str_to_num(arg);
2484 if (wait >= 5 && wait <= 30) {
2485 minimumwait = wait;
2486 savesettings(id);
2487 showsettings(id);
2488 } else {
2489 console_print(id, "You must specify a value between 5 and 30 for dmap_rtvwait");
2490 console_print(id, "This sets how long must pass from the start of map before players may rockthevote");
2491 }
2492 return PLUGIN_HANDLED;
2493 }
2494
2495 public dmapmessages(id, level, cid) {
2496 if (!cmd_access(id, level, cid, 2)) {
2497 return PLUGIN_HANDLED;
2498 }
2499
2500 if (id == 0) {
2501 announce_config_error("dmap_messages");
2502 return PLUGIN_HANDLED;
2503 }
2504
2505 new arg[32];
2506 read_argv(1, arg, 3);
2507 new wait = str_to_num(arg);
2508 if (wait >= 2 && wait <= 20) {
2509 frequency = wait;
2510 savesettings(id);
2511 showsettings(id);
2512 } else {
2513 console_print(id, "You must specify a value between 2 and 20 minutes for dmap_messages");
2514 console_print(id, "This sets how many minutes will pass between messages for nominations for available maps");
2515 }
2516 return PLUGIN_HANDLED;
2517 }
2518
2519 public dmapmapsnum(id, level, cid) {
2520 if (!cmd_access(id, level, cid, 2)) {
2521 return PLUGIN_HANDLED;
2522 }
2523
2524 if (id == 0) {
2525 announce_config_error("dmap_mapsnum");
2526 return PLUGIN_HANDLED;
2527 }
2528
2529 new arg[32];
2530 read_argv(1, arg, 3);
2531 new maps = str_to_num(arg);
2532 if (maps >= 2 && maps <= 8) {
2533 mapssave = maps;
2534 savesettings(id);
2535 showsettings(id);
2536 console_print(id, "***** Settings for dmap_mapsnum do NOT take effect until the next map!!! ******");
2537 } else {
2538 console_print(id, "You must specify a value between 2 and 8 for dmap_mapsnum");
2539 console_print(id, "This sets the # of maps in the vote, changing this doesn't take effect until the next map");
2540 }
2541 return PLUGIN_HANDLED;
2542 }
2543
2544 public dmapnominations(id, level, cid) {
2545 if (!cmd_access(id, level, cid, 2)) {
2546 return PLUGIN_HANDLED;
2547 }
2548
2549 if (id == 0) {
2550 announce_config_error("dmap_nominations");
2551 return PLUGIN_HANDLED;
2552 }
2553
2554 new arg[32];
2555 read_argv(1, arg, 3);
2556 new thisnumber = str_to_num(arg);
2557 if (thisnumber >= 0 && thisnumber <= 3) {
2558 maxnom = thisnumber;
2559 savesettings(id);
2560 showsettings(id);
2561 console_print(id, "***** Settings for dmap_nominations do NOT take effect until the next map!!! ******");
2562 } else {
2563 console_print(id, "You must specify a value between 0 and 3 for dmap_nominations");
2564 console_print(id, "This sets the maximum number of maps a person can nominate");
2565 }
2566 return PLUGIN_HANDLED;
2567 }
2568
2569 public dmapmaxcustom(id, level, cid) {
2570 if (!cmd_access(id, level, cid, 2)) {
2571 return PLUGIN_HANDLED;
2572 }
2573
2574 if (id == 0) {
2575 announce_config_error("dmap_maxcustom");
2576 return PLUGIN_HANDLED;
2577 }
2578
2579 new arg[32];
2580 read_argv(1, arg, 3);
2581 new thisnumber = str_to_num(arg);
2582 if (thisnumber >= 0 && thisnumber <= mapssave) {
2583 maxcustnom = thisnumber;
2584 savesettings(id);
2585 showsettings(id);
2586 } else {
2587 console_print(id, "You must specify a value between {0} and maximum maps in the vote, which is {%d}, for dmap_maxcustom", mapssave);
2588 console_print(id, "This sets the maximum number of custom maps that may be nominated by the players");
2589 }
2590 return PLUGIN_HANDLED;
2591 }
2592
2593 public dmapquietmode(id, level, cid) {
2594 if (!cmd_access(id, level, cid, 2)) {
2595 return PLUGIN_HANDLED;
2596 }
2597
2598 if (id == 0) {
2599 announce_config_error("dmap_quietmode");
2600 return PLUGIN_HANDLED;
2601 }
2602
2603 new arg[32];
2604 read_argv(1, arg, 31);
2605 if (containi(arg, "off") != -1) {
2606 console_print(id, "======Quiet mode is now OFF, messages pertaining to maps will be shown=====");
2607 quiet = 0;
2608 } else if (containi(arg, "silent") != -1) {
2609 console_print(id, "======Quiet mode is now set to SILENT, A minimal amount of messages will be shown!=====");
2610 quiet = 2;
2611 } else if (containi(arg, "nosound") != -1) {
2612 console_print(id, "======Quiet mode is now set to NOSOUND, messages pertaining to maps will be shown, with no sound=====");
2613 quiet = 1;
2614 } else {
2615 console_print(id, "USAGE: dmap_quietmode <OFF|NOSOUND|SILENT>");
2616 return PLUGIN_HANDLED;
2617 }
2618 savesettings(id);
2619 showsettings(id);
2620 return PLUGIN_HANDLED;
2621 }
2622
2623 public dmaprtvtoggle(id, level, cid) {
2624 if (!cmd_access(id, level, cid, 1)) {
2625 return PLUGIN_HANDLED;
2626 }
2627
2628 if (id == 0) {
2629 announce_config_error("dmap_rtvtoggle");
2630 return PLUGIN_HANDLED;
2631 }
2632
2633 if (enabled == 0) {
2634 console_print(id, "=========Rockthevote is now enabled=========");
2635 } else {
2636 console_print(id, "=========Rockthevote is now disabled=========");
2637 }
2638 enabled = !enabled;
2639 savesettings(id);
2640 showsettings(id);
2641 return PLUGIN_HANDLED;
2642 }
2643
2644 public dmapfreeze(id, level, cid) {
2645 if (!cmd_access(id, level, cid, 1)) {
2646 return PLUGIN_HANDLED;
2647 }
2648
2649 if (id == 0) {
2650 announce_config_error("dmap_freeze");
2651 return PLUGIN_HANDLED;
2652 }
2653
2654 if (!bIsCstrike) {
2655 console_print(id, "Freeze is always off on non-Counter Strike Servers");
2656 return PLUGIN_HANDLED;
2657 }
2658
2659 new arg[32];
2660 read_argv(1, arg, 31);
2661 if (containi(arg, "off") != -1) {
2662 console_print(id, "=========FREEZE/Weapon Drop at end of round is now disabled==============");
2663 dofreeze = 0;
2664 } else {
2665 if (containi(arg, "on") != -1) {
2666 console_print(id, "=========FREEZE/Weapon Drop at end of round is now enabled==============");
2667 dofreeze = 1;
2668 } else {
2669 console_print(id, "========= USAGE of dmap_freeze: dmap_freeze on|off (this will turn freeze/weapons drop at end of round on/off");
2670 return PLUGIN_HANDLED;
2671 }
2672 }
2673 savesettings(id);
2674 showsettings(id);
2675 return PLUGIN_HANDLED;
2676 }
2677
2678 public dmapcyclemode(id, level, cid) {
2679 if (!cmd_access(id, level, cid, 1)) {
2680 return PLUGIN_HANDLED;
2681 }
2682
2683 if (id == 0) {
2684 announce_config_error("dmap_cyclemode");
2685 return PLUGIN_HANDLED;
2686 }
2687
2688 if (!cycle) {
2689 console_print(id, "========= Cycle mode is now ON, NO VOTE will take place! =========");
2690 } else {
2691 console_print(id, "========= Cycle Mode is already on, no change is made =========");
2692 console_print(id, "========= If you are trying to enable voting, use command dmap_votemode");
2693 return PLUGIN_HANDLED;
2694 }
2695 cycle = 1;
2696 savesettings(id);
2697 showsettings(id);
2698 if (inprogress) {
2699 console_print(id, "========= The Vote In Progress cannot be terminated, unless it hasn't started! =========");
2700 }
2701 return PLUGIN_HANDLED;
2702 }
2703
2704 public dmapvotemode(id, level, cid) {
2705 if (!cmd_access(id, level, cid, 1)) {
2706 return PLUGIN_HANDLED;
2707 }
2708
2709 if (id == 0) {
2710 announce_config_error("dmap_votemode");
2711 return PLUGIN_HANDLED;
2712 }
2713
2714 if (cycle) {
2715 console_print(id, "========= Voting mode is now ON, Votes WILL take place =========");
2716 } else {
2717 console_print(id, "========= Voting mode is already ON, no change is made =========");
2718 console_print(id, "========= If you are trying to disable voting, use command dmap_cyclemode");
2719 return PLUGIN_HANDLED;
2720 }
2721 cycle = 0;
2722 savesettings(id);
2723 showsettings(id);
2724 return PLUGIN_HANDLED;
2725 }
2726
2727 public dmapbanlastmaps(id, level, cid) {
2728 if (!cmd_access(id, level, cid, 2)) {
2729 return PLUGIN_HANDLED;
2730 }
2731
2732 if (id == 0) {
2733 announce_config_error("dmap_banlastmaps");
2734 return PLUGIN_HANDLED;
2735 }
2736
2737 new arg[32];
2738 read_argv(1, arg, 4);
2739 new banamount;
2740 banamount = str_to_num(arg);
2741 if (banamount >= 0 && banamount <= 99) {
2742 if (banamount > ban_last_maps) {
2743 console_print(id, "You have choosen to increase the number of banned maps");
2744 console_print(id, "Changes will not take affect until the nextmap; maps played more than %d maps ago will not be included in the ban", ban_last_maps);
2745 } else {
2746 if (banamount < ban_last_maps) {
2747 console_print(id, "You have choosen to decrease the number of banned maps");
2748 }
2749 }
2750 ban_last_maps = banamount;
2751 savesettings(id);
2752 showsettings(id);
2753 } else {
2754 console_print(id, "You must specify a value between 0 and 99 for dmap_banlastmaps");
2755 console_print(id, "dmap_banlastmaps <n> will ban the last <n> maps from being voted/nominated");
2756 }
2757 return PLUGIN_HANDLED;
2758 }
2759
2760 public dmaphelp(id) {
2761 if (!(get_user_flags(id) & ADMIN_MAP)) {
2762 new myversion[32];
2763 get_cvar_string("Deags_Map_Manage", myversion, 31);
2764 console_print(id, "*****This server uses the plugin Deagles Map Manager %s *****", myversion);
2765 console_print(id, "");
2766 if (cycle) {
2767 console_print(id, "=================== The plugin is set to cycle mode. No vote will take place =================");
2768 return PLUGIN_HANDLED;
2769 }
2770 console_print(id, "Say ^"vote mapname^" ^"nominate mapname^" or just simply ^"mapname^" to nominate a map");
2771 console_print(id, "");
2772 console_print(id, "Say ^"nominations^" to see a list of maps already nominated.");
2773 console_print(id, "Say ^"listmaps^" for a list of maps you can nominate");
2774 console_print(id, "Number of maps for the vote at the end of this map will be: %d", maps_to_select);
2775 console_print(id, "Players may nominate up to %d maps for the vote (dmap_nominations)", maxnom);
2776 console_print(id, "Players may nominate up to %d **Custom** maps for the vote (dmap_maxcustom)", maxcustnom);
2777 if (enabled) {
2778 console_print(id, "Say ^"rockthevote^" to rockthevote");
2779 console_print(id, "In order to rockthevote the following 3 conditions need to be true:");
2780 console_print(id, "%d percent of players must rockthevote, and at least %d players must rockthevote", floatround(rtvpercent * 100.0), minimum);
2781 console_print(id, "Vote may not be rocked before %d minutes have elapsed on the map", minimumwait);
2782 }
2783 if (containi(mapsurl, "www") != -1 || containi(mapsurl, "http") != -1) {
2784 console_print(id, "You can download Custom maps at %s (dmap_mapsurl)", mapsurl);
2785 }
2786 return PLUGIN_HANDLED;
2787 }
2788 console_print(id, "%L", id, "DMAP_MOTD_LOADING");
2789 client_print(id, print_chat, "%L", id, "DMAP_MOTD_LOADING");
2790 showmotdhelp(id);
2791
2792 return PLUGIN_HANDLED;
2793 }
2794
2795 public gen_maphelphtml() {
2796 new path[64], text[128];
2797 formatex(path, 63, "%s/map_manage_help.htm", custompath);
2798 if (file_exists(path)) {
2799 delete_file(path);
2800 }
2801 formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP");
2802 write_file(path, text);
2803 formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP2");
2804 write_file(path, text);
2805 formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP3");
2806 write_file(path, text);
2807 formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP4");
2808 write_file(path, text);
2809 formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP5");
2810 write_file(path, text);
2811 formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP6");
2812 write_file(path, text);
2813 formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP7");
2814 write_file(path, text);
2815 formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP8");
2816 write_file(path, text);
2817 }
2818
2819 public showmotdhelp(id) {
2820 new header[80];
2821 new myversion[32];
2822 new helpfile[64];
2823 formatex(helpfile, 63, "%s/map_manage_help.htm", custompath);
2824 get_cvar_string("Deags_Map_Manage", myversion, 31);
2825 formatex(header, 79, "%L", id, "DMAP_HELP9", myversion);
2826 if (!file_exists(helpfile)) {
2827 gen_maphelphtml();
2828 }
2829 show_motd(id, helpfile, header);
2830 }
2831
2832 public dmapstatus(id, level, cid) {
2833 if (!cmd_access(id, level, cid, 1)) {
2834 return PLUGIN_HANDLED;
2835 }
2836
2837 showsettings(id);
2838 return PLUGIN_CONTINUE;
2839 }
2840
2841 showsettings(id) {
2842
2843 console_print(id, "-----------------------------------------------------------------------------------------------");
2844 console_print(id, " Status of Deagles Map Manager Version %s", VERSION);
2845
2846 if (cycle) {
2847 console_print(id, "=================== Mode is Cycle Mode NO vote will take place =================");
2848 console_print(id, "=================== To enable voting use command dmap_votemode ===================");
2849 } else {
2850 console_print(id, "======================= Current Mode is Voting Mode ===============================");
2851 if (quiet == 2) {
2852 console_print(id, "Quiet Mode is set to SILENT. Minimal text messages will be shown, no sound will be played (dmap_quietmode)");
2853 } else {
2854 if (quiet == 1) {
2855 console_print(id, "Quiet Mode is set to NOSOUND. Text messages will be shown, with no sound. (dmap_quietmode)");
2856 } else {
2857 console_print(id, "Quiet Mode is OFF, messages will be shown with sound (dmap_quietmode)");
2858 }
2859 console_print(id, "The time between messages about maps is %d minutes (dmap_messages)", frequency);
2860 }
2861
2862 console_print(id, "The last %d Maps played will not be in the vote (changing this will not start until the Next Map)", ban_last_maps);
2863
2864 if (maps_to_select != mapssave) {
2865 console_print(id, "Number of maps for the vote on this map is: %d (Next Map it will be: %d)", maps_to_select, mapssave);
2866 } else {
2867 console_print(id, "Number of maps for the vote at the end of this map will be: %d (dmap_mapsnum)", maps_to_select);
2868 }
2869
2870 console_print(id, "Players may nominate up to %d maps each for the vote (dmap_nominations)", maxnom);
2871
2872 console_print(id, "Players may nominate up to %d **Custom** maps each for the vote (dmap_maxcustom)", maxcustnom);
2873
2874 if (get_pcvar_num(pEnforceTimelimit)) {
2875 console_print(id, "^"Timeleft^" will be followed to change the maps, not allowing players to finish the round");
2876 console_print(id, "To change this, ask your server admin to set the cvar ^"enforce_timelimit^" to 0");
2877 }
2878
2879 if (enabled == 0) {
2880 if (!get_cvar_num("mp_timelimit")) {
2881 console_print(id, "rockthevote is disabled since mp_timelimit is set to 0");
2882 } else {
2883 console_print(id, "rockthevote is disabled; (dmap_rtvtoggle)");
2884 }
2885 }
2886 console_print(id, "In order to rockthevote the following 3 conditions need to be met:");
2887 console_print(id, "%d percent of players must rockthevote, and at least %d players must rockthevote", floatround(rtvpercent * 100.0), minimum);
2888 console_print(id, "Vote may not be rocked before %d minutes have elapsed on the map (10 is recommended)", minimumwait);
2889 }
2890
2891 console_print(id, "The Freeze/Weapons Drop at the end of the round is %s (dmap_freeze)", dofreeze ? "ENABLED" : "DISABLED");
2892
2893 if (!usestandard) {
2894 console_print(id, "Custom will not be shown by any maps, since file standardmaps.ini is not on the server");
2895 } else {
2896 console_print(id, "The words custom will be shown by Custom maps");
2897 }
2898 if (containi(mapsurl, "www") != -1 || containi(mapsurl, "http") != -1) {
2899 console_print(id, "URL to download Custom maps is %s (dmap_mapsurl)", mapsurl);
2900 } else {
2901 console_print(id, "URL to download maps from will not be shown (dmap_mapsurl)");
2902 }
2903 console_print(id, "------------------------------------------------------------------------------------------------");
2904 console_print(id, "Commands: dmap_banlastmaps <n>; dmap_cyclemode; dmap_default; dmap_freeze <ON|OFF>; dmap_mapsnum <n>;");
2905 console_print(id, "Commands: dmap_mapsurl <url>; dmap_maxcustom <n>; dmap_messages <n(minutes)>; dmap_nominate <map>;");
2906 console_print(id, "Commands: dmap_nominations <n>; dmap_quietmode <OFF|NOSOUND|SILENT>; dmap_rockthevote; dmap_rtvpercent <n>;");
2907 console_print(id, "Commands: dmap_rtvplayers <n>; dmap_rtvtoggle; dmap_rtvwait <n>; dmap_status; dmap_votemode;");
2908 console_print(id, "Cvars: amx_emptymap <map>; amx_idletime <n>; amx_staytime <n>; dmap_strict <0|1>;");
2909 console_print(id, "Cvars: emptymap_allowed <0|1>; enforce_timelimit <0|1>; amx_extendmap_max <n>; amx_extendmap_step <n>;");
2910 console_print(id, "Cvars: nominations_allowed <0|1>; weapon_delay <0|1>");
2911 console_print(id, "------------------------- use command dmap_help for more information -----------------------");
2912 }
2913
2914 change_custom_path() {
2915 new temp[64];
2916 formatex(temp, 63, "%s/dmap", custompath);
2917 if (dir_exists(temp)) {
2918 copy(custompath, 48, temp);
2919 }
2920 }
2921
2922 savesettings(myid) {
2923
2924 new settings[64];
2925 formatex(settings, 63, "%s/mapvault.dat", custompath);
2926
2927 if (file_exists(settings)) {
2928 delete_file(settings);
2929 }
2930 new text[32], text2[128], percent, success = 1, usedany = 0;
2931 formatex(text2, 127, ";To use comments simply use ;");
2932 if (!write_file(settings,text2)) {
2933 success = 0;
2934 }
2935 formatex(text2, 127, ";Do not modify this variables, this is used by the Nomination_style_voting plugin to save settings");
2936
2937 if (!write_file(settings, text2)) {
2938 success = 0;
2939 }
2940 formatex(text2, 127, ";If you delete this file, defaults will be restored.");
2941 if (!write_file(settings, text2)) {
2942 success = 0;
2943 }
2944 formatex(text2, 127, ";If you make an invalid setting, that specific setting will restore to the default");
2945 if (!write_file(settings, text2)) {
2946 success = 0;
2947 }
2948 if (!enabled) {
2949 formatex(text, 31, "d"); //d for disabled
2950 usedany = 1;
2951 if (!write_file(settings, text)) {
2952 success = 0;
2953 }
2954 }
2955 if (quiet != 0) {
2956 if (quiet == 1) {
2957 formatex(text, 31, "q1"); //d for disabled
2958 } else {
2959 formatex(text, 31, "q2"); //d for disabled
2960 }
2961 usedany = 1;
2962 if (!write_file(settings, text)) {
2963 success = 0;
2964 }
2965 }
2966 if (!dofreeze || !bIsCstrike) {
2967 formatex(text, 31, "f");
2968 if (!write_file(settings, text)) {
2969 success = 0;
2970 }
2971 }
2972 if (cycle) {
2973 formatex(text, 31, "c"); //c for Cycle mode=on
2974 usedany = 1;
2975 if (!write_file(settings, text)) {
2976 success = 0;
2977 }
2978 }
2979 percent = floatround(rtvpercent * 100.0);
2980 if (percent >= 3 && percent <= 100) {
2981 formatex(text, 31, "r %d", percent);
2982 usedany = 1;
2983 if (!write_file(settings, text)) {
2984 success = 0;
2985 }
2986 }
2987 if (ban_last_maps >= 0 && ban_last_maps <= 100) {
2988 formatex(text, 31, "b %d", ban_last_maps);
2989 usedany = 1;
2990 if (!write_file(settings, text)) {
2991 success = 0;
2992 }
2993 }
2994 if (mapssave >= 2 && mapssave <= 8) {
2995 formatex(text, 31, "m %d", mapssave);
2996 usedany = 1;
2997 if (!write_file(settings, text)) {
2998 success = 0;
2999 }
3000 }
3001 if (maxnom >= 0 && maxnom <= 3) {
3002 formatex(text, 31, "x %d", maxnom);
3003 usedany = 1;
3004 if (!write_file(settings, text)) {
3005 success = 0;
3006 }
3007 }
3008 if (maxcustnom >= 0 && maxcustnom <= mapssave) {
3009 formatex(text, 31, "y %d", maxcustnom);
3010 usedany = 1;
3011 if (!write_file(settings, text)) {
3012 success = 0;
3013 }
3014 }
3015 if (minimum > 0 && minimum <= 32) {
3016 formatex(text, 31, "p %d", minimum);
3017 usedany = 1;
3018 if (!write_file(settings, text)) {
3019 success = 0;
3020 }
3021 }
3022 if (minimumwait >= 5 && minimumwait <= 30) {
3023 formatex(text, 31, "w %d", minimumwait);
3024 usedany = 1;
3025 if (!write_file(settings, text)) {
3026 success = 0;
3027 }
3028 }
3029 if (frequency >= 2 && frequency <= 20) {
3030 formatex(text, 31, "fr %d", frequency);
3031 usedany = 1;
3032 if (!write_file(settings, text)) {
3033 success = 0;
3034 }
3035 }
3036 if (containi(mapsurl, "www") != -1 || containi(mapsurl, "http") != -1) {
3037 formatex(text2, 75, "u %s", mapsurl);
3038 usedany = 1;
3039 if (!write_file(settings, text2)) {
3040 success = 0;
3041 }
3042 }
3043 if (usedany) {
3044 if (myid >= 0) {
3045 if (success) {
3046 console_print(myid, "********* Settings saved successfully *********");
3047 } else {
3048 console_print(myid, "Unable to write to file %s", settings);
3049 }
3050 }
3051 if (!success) {
3052 #if defined DEDICATED_LOG_ENABLED
3053 log_to_file(logfilename, "Unable to write to file %s", settings);
3054 #endif
3055 return 0;
3056 }
3057 } else {
3058 if (myid >= 0) {
3059 console_print(myid, "Variables not valid, not saving to %s", settings);
3060 }
3061 #if defined DEDICATED_LOG_ENABLED
3062 log_to_file(logfilename, "Warning: Variables not valid, not saving to %s", settings);
3063 #endif
3064 return 0;
3065 }
3066 return 1;
3067 }
3068
3069 public dmapmapsurl(id, level, cid) {
3070 if (!cmd_access(id, level, cid, 2)) {
3071 return PLUGIN_HANDLED;
3072 }
3073
3074 if (id == 0) {
3075 announce_config_error("dmap_mapsurl");
3076 return PLUGIN_HANDLED;
3077 }
3078
3079 new arg[64];
3080 read_argv(1, arg, 63);
3081 if (equali(arg, "http")) {
3082 console_print(id, "You must specify a url that contains www or http (do not use any colons)(use ^"none^" to disable)");
3083 return PLUGIN_HANDLED;
3084 }
3085 if (containi(arg, "www") != -1 || containi(arg, "http") != -1) {
3086 console_print(id, "You have changed the mapsurl to %s", arg);
3087 mapsurl = arg;
3088 savesettings(id);
3089 showsettings(id);
3090 } else {
3091 if (containi(arg, "none") != -1) {
3092 console_print(id, "You have choosen to disable your mapsurl, none will be used");
3093 mapsurl = "";
3094 savesettings(id);
3095 showsettings(id);
3096 } else {
3097 console_print(id, "You must specify a url that contains www or http (do not use any colons)(use ^"none^" to disable)");
3098 }
3099 }
3100 return PLUGIN_HANDLED;
3101 }
3102
3103 public dmapdefaults(id, level, cid) {
3104 if (!cmd_access(id, level, cid, 1)) {
3105 return PLUGIN_HANDLED;
3106 }
3107
3108 set_defaults(id);
3109 return PLUGIN_HANDLED;
3110 }
3111
3112 public event_RoundStart() {
3113 isbetween = 0;
3114 isbuytime = 1;
3115 set_task(10.0, "now_safe_to_vote");
3116
3117 currounds++;
3118 new players[32], playernum;
3119 get_players(players, playernum, "c");
3120 curplayers += playernum;
3121 }
3122
3123 public event_RoundEnd() {
3124 isbetween = 1;
3125 }
3126
3127 public now_safe_to_vote() {
3128 //client_print(0, print_chat, "Now it is safe to vote");
3129 isbuytime = 0;
3130 }
3131
3132 public listmaps_override(id) {
3133 //TODO: if some cvar = 0 then return
3134 list_maps(id);
3135 return PLUGIN_HANDLED;
3136 }
3137
3138 public votemap_override(id) {
3139 console_print(id, "%L", id, "DMAP_COMMAND_DISABLED");
3140 return PLUGIN_HANDLED;
3141 }
3142
3143 public say_currentmap(id) {
3144 new mapname[32];
3145 get_mapname(mapname, 31);
3146 client_print(id, print_chat, "%L", id, "DMAP_CURRENT_MAP", mapname);
3147 return PLUGIN_HANDLED;
3148 }
3149
3150 public say_recentmaps(id) {
3151 if (bannedsofar <= 1) {
3152 client_print(id, print_chat, "%L", id, "DMAP_RECENT_NONE");
3153 return PLUGIN_HANDLED;
3154 }
3155
3156 new sMaps[192];
3157 for (new i=1; i < bannedsofar; i++) { // Start at 1 to skip current map
3158 if (i == 1) {
3159 formatex(sMaps, 31, "%s", lastmaps[i]);
3160 } else {
3161 format(sMaps, 191, "%s, %s", sMaps, lastmaps[i]);
3162 }
3163 }
3164 client_print(id, print_chat, "%L", id, "DMAP_RECENT_MAPS", sMaps);
3165
3166 return PLUGIN_HANDLED;
3167 }
3168
3169
3170 public check_conflict() {
3171 new sDV[8], iDV, bRepeat;
3172
3173 //repeat error over and over..
3174 if (is_plugin_loaded("Nextmap Chooser") > -1) {
3175 bRepeat = true;
3176 announce_conflict("mapchooser.amxx");
3177 }
3178 if (is_plugin_loaded("NextMap") > -1) {
3179 bRepeat = true;
3180 announce_conflict("nextmap.amxx");
3181 }
3182 if (is_plugin_loaded("Galileo") > -1) {
3183 bRepeat = true;
3184 announce_conflict("galileo.amxx");
3185 }
3186 if (is_plugin_loaded("Crab'sMapManager") > -1) {
3187 bRepeat = true;
3188 announce_conflict("crabmapmanager.amxx");
3189 }
3190
3191 // Using -2 for the language key seems to default to en, even with amx_mldebug set.
3192 // This is a hack, but it works.
3193 // ML_NOTFOUND will return 0 for version, so additional error handling isn't needed.
3194 formatex(sDV, 7, "%L", -2, "DV");
3195 iDV = str_to_num(sDV);
3196
3197 // Allow for 9 newer version of dictionary file before plugin recompile is needed.
3198 if ((iDV < DMAP_EXPECTED_DV) || (iDV > (DMAP_EXPECTED_DV + 9))) {
3199 bRepeat = true;
3200 console_print(0, "[DMM] INVALID DICTIONARY FILE! Current version: %d. Expected version: %d to %d.", iDV, DMAP_EXPECTED_DV, DMAP_EXPECTED_DV + 9);
3201 client_print(0, print_chat, "[DMM] INVALID DICTIONARY FILE! Current version: %d. Expected version: %d to %d.", iDV, DMAP_EXPECTED_DV, DMAP_EXPECTED_DV + 9);
3202 }
3203
3204 if (bRepeat) {
3205 set_task(5.0, "check_conflict", DMAP_TASKID_CONFLICT);
3206 }
3207 return PLUGIN_HANDLED;
3208 }
3209
3210 announce_conflict(sPlugin[]) {
3211 console_print(0, "[DMM] CONFLICT DETECTED! Disable %s in plugins.ini.", sPlugin);
3212 client_print(0, print_chat, "[DMM] CONFLICT DETECTED! Disable %s in plugins.ini.", sPlugin);
3213 }
3214
3215 announce_config_error(sCommand[]) {
3216 console_print(0, "[DMM] ERROR: The %s command does not belong in any config file.", sCommand);
3217 console_print(0, "[DMM] If you really want to run this command, do it from a client console.");
3218 }
3219
3220 public say_ff(id) {
3221 client_print(id, print_chat, "%L: %L", LANG_PLAYER, "DMAP_FRIEND_FIRE", LANG_PLAYER, get_cvar_num("mp_friendlyfire") ? "ON" : "OFF");
3222 return PLUGIN_CONTINUE;
3223 }
3224
3225
3226 public plugin_init() {
3227
3228 register_plugin(PLUGIN, VERSION, AUTHOR);
3229 register_dictionary("common.txt");
3230 register_dictionary("deagsmapmanager.txt");
3231
3232 get_configsdir(custompath, 49);
3233 change_custom_path();
3234
3235 check_conflict(); // Check for problems immediately
3236
3237 register_clcmd("say", "HandleSay", 0, "Say: vote mapname, nominate mapname, or just mapname to nominate a map, say: nominations");
3238 register_clcmd("say rockthevote", "rock_the_vote", 0, "Rocks the Vote");
3239 register_clcmd("say rtv", "rock_the_vote", 0, "Rocks the Vote");
3240 register_clcmd("say ff", "say_ff", 0, "Displays friendly fire status");
3241 register_clcmd("say listmaps", "list_maps", 0, "Lists all maps in the console");
3242 register_clcmd("say nextmap", "say_nextmap", 0, "Shows next map information to players");
3243 register_clcmd("say currentmap", "say_currentmap", 0, "Shows name of the current map");
3244 register_clcmd("say recentmaps", "say_recentmaps", 0, "Shows names of recently played maps");
3245 register_clcmd("votemap", "votemap_override", 0, "Override for votemap command in GoldSrc engine");
3246 register_concmd("dmap_help", "dmaphelp", 0, "Shows on-screen help information about Map Plugin");
3247 register_concmd("dmap_status", "dmapstatus", ADMIN_DMAP, "Shows settings/status/help of the map management variables");
3248 register_concmd("dmap_votemode", "dmapvotemode", ADMIN_SUPER_DMAP, "Enables Voting (This is default mode)");
3249 register_concmd("dmap_cyclemode", "dmapcyclemode", ADMIN_SUPER_DMAP, "Disables Voting (To restore voting use dmap_votemode)");
3250 register_concmd("dmap_banlastmaps", "dmapbanlastmaps", ADMIN_SUPER_DMAP, "Bans the last <n> maps played from being voted (0-99)");
3251 register_concmd("dmap_quietmode", "dmapquietmode", ADMIN_SUPER_DMAP, "Usage: <OFF|NOSOUND|SILENT>");
3252 register_concmd("dmap_freeze", "dmapfreeze", ADMIN_SUPER_DMAP, "Toggles Freeze/Drop at end of round ON|off");
3253 register_concmd("dmap_messages", "dmapmessages", ADMIN_SUPER_DMAP, "Sets the time interval in minutes between messages");
3254 register_concmd("dmap_rtvtoggle", "dmaprtvtoggle", ADMIN_SUPER_DMAP, "Toggles on|off Ability of players to use rockthevote");
3255 register_concmd("dmap_rockthevote", "admin_rockit", ADMIN_DMAP, "Allows admins to force a vote");
3256 register_concmd("amx_rockthevote", "admin_rockit", ADMIN_DMAP, "Allows admins to force a vote");
3257 register_concmd("amx_rtv", "admin_rockit", ADMIN_DMAP, "Allows admins to force a vote");
3258 register_concmd("dmap_rtvpercent", "dmaprtvpercent", ADMIN_SUPER_DMAP, "Set the percent (3-100) of players for a rtv");
3259 register_concmd("dmap_rtvplayers", "dmaprtvplayers", ADMIN_SUPER_DMAP, "Sets the minimum number of players needed to rockthevote");
3260 register_concmd("dmap_rtvwait", "dmaprtvwait", ADMIN_SUPER_DMAP, "Sets the minimum time before rockthevote can occur (5-30)");
3261 register_concmd("dmap_default", "dmapdefaults", ADMIN_SUPER_DMAP, "Will restore settings to default");
3262 register_concmd("dmap_mapsurl", "dmapmapsurl", ADMIN_SUPER_DMAP, "Specify what website to get custom maps from");
3263 register_concmd("dmap_mapsnum", "dmapmapsnum", ADMIN_SUPER_DMAP, "Set number of maps in vote (will not take effect until next map");
3264 register_concmd("dmap_nominations", "dmapnominations", ADMIN_SUPER_DMAP, "Set maximum number of nominations for each person");
3265 register_concmd("dmap_maxcustom", "dmapmaxcustom", ADMIN_SUPER_DMAP, "Set maximum number of custom nominations that may be made");
3266 register_concmd("dmap_cancelvote", "dmapcancelvote", ADMIN_DMAP, "Cancels the rocked vote");
3267 register_concmd("dmap_nominate", "dmapnominate", ADMIN_DMAP, "<mapname> - Force nomination of a map by an admin");
3268 register_concmd("listmaps", "listmaps_override", 0, "Lists all maps in the console");
3269
3270 register_logevent("event_RoundStart", 2, "0=World triggered", "1=Round_Start");
3271 register_logevent("event_RoundEnd", 2, "0=World triggered", "1=Round_End");
3272
3273 register_event("30", "changeMap", "a");
3274 #if defined DEDICATED_LOG_ENABLED
3275 get_time("dmaplog%m%d.log", logfilename, 255);
3276 #endif
3277
3278 pDmapStrict = register_cvar("dmap_strict", "0");
3279 pEmptyMap = register_cvar("amx_emptymap", "de_dust2");
3280 pEmptymapAllowed = register_cvar("emptymap_allowed", "0");
3281 pEnforceTimelimit = register_cvar("enforce_timelimit", "0");
3282 pExtendmapMax = register_cvar("amx_extendmap_max", "90");
3283 pExtendmapStep = register_cvar("amx_extendmap_step", "15");
3284 pIdleTime = register_cvar("amx_idletime", "5");
3285 pNominationsAllowed = register_cvar("nominations_allowed", "1");
3286 pShowActivity = register_cvar("amx_show_activity", "2");
3287 register_cvar("amx_staytime", "300"); // No pointer; only used once
3288 pWeaponDelay = register_cvar("weapon_delay", "1");
3289
3290 staytime = get_cvar_num("amx_staytime");
3291
3292 bIsCstrike = (cstrike_running() == 1);
3293 nmaps_num = num_nmapsfill = 0;
3294
3295 if (bIsCstrike) {
3296 register_cvar("Deags_Map_Manage", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY);
3297 register_event("TeamScore", "team_score", "a");
3298 } else {
3299 dofreeze = 0;
3300 register_cvar("Deags_Map_Manage", VERSION);
3301 }
3302 rtvpercent = 0.6;
3303 ban_last_maps = 4;
3304 minimumwait = 10;
3305 atstart = enabled = minimum = 1;
3306 quiet = cycle = isend = 0;
3307 mapsurl = "";
3308 set_task(3.0, "ban_some_maps"); //reads from lastmapsplayed.txt and stores into global array
3309 //set_task(8.0, "write_lastmaps"); //deletes and writes to lastmapsplayed.txt
3310 //set_task(2.0, "get_listing"); //loads mapcycle / allmaps.txt
3311 set_task(14.0, "load_defaultmaps"); //loads standardmaps.ini
3312 //set_task(17.0, "load_maps"); //loads mapchoice.ini
3313 set_task(15.0, "askfornextmap", DMAP_TASKID_ASK_FOR_NEXT, "", 0, "b");
3314 set_task(5.0, "loopmessages", DMAP_TASKID_LOOP_MESSAGES, "", 0, "b");
3315 set_task(34.0, "gen_maphelphtml"); //Writes to help file, which is read every time that dmap_help is called by ANY player
3316 oldtimelimit = get_cvar_float("mp_timelimit");
3317 get_localinfo("amx_lastmap", last_map, 31);
3318 set_localinfo("amx_lastmap", "");
3319 set_task(1.0, "timer", DMAP_TASKID_TIMER, "curtime", 0, "b", 1);
3320 maps_to_select = mapssave = 5;
3321 new temparray[64];
3322 formatex(temparray, 63, "%s/mapvault.dat", custompath);
3323 if (!loadsettings(temparray)) {
3324 set_defaults(-1);
3325 }
3326 atstart = 0;
3327 register_menucmd(register_menuid(DMAP_MENU_TITLE), (-1 ^ (-1 << (maps_to_select + 2))), "vote_count");
3328 }

Contact webmaster
ViewVC Help
Powered by ViewVC RSS 2.0 feed