--- hlds/cstrike/addons/amxmodx/scripting/deagsmapmanager.sma 2008/11/23 19:48:46 26 +++ hlds/cstrike/addons/amxmodx/scripting/deagsmapmanager.sma 2008/12/09 07:21:03 27 @@ -50,7 +50,7 @@ #include new const PLUGIN[] = "DeagsMapManager"; -new const VERSION[] = "3.21"; +new const VERSION[] = "3.21SVN"; new const AUTHOR[] = "Deags/AMXX Community"; // Comment out the following line to disable the dedicated log file @@ -60,6 +60,13 @@ #define ADMIN_DMAP ADMIN_LEVEL_A #define ADMIN_SUPER_DMAP ADMIN_LEVEL_F +#define DMAP_VOTE_TIME 20 // Total time (in seconds) from vote start to checking votes + +#define DMAP_TASKID_VTR 10000 // Vote Time Remaining +// non-DEFINE ids currently used: +// 123400, 123450, 123452, 127600(+id), 127600(+idreal),333333, 444444, 454500, +// 454510, 459100, 459200, 765100, 986100, 986200, 987111, 987300, 987456 + new maps_to_select, isbuytime = 0, isbetween = 0; new ban_last_maps = 0, quiet = 0; //quiet=0 (words and sounds) quiet=1 (words only, no sound) quiet=2 (no sound, no words) new Float:rtvpercent, Float:thespeed, Float:oldtimelimit; @@ -84,7 +91,9 @@ new nmapsfill[MAX_MAPS_AMOUNT][32]; new num_nmapsfill; //this is number of maps in users admin.cfg file that are valid new bool:is_cstrike; -new nnextmaps[10], nvotes[12], nmapstoch, before_num_nmapsfill = 0, bool:mselected = false; +new nnextmaps[10]; +new nvotes[12]; // Holds the number of votes for each map +new nmapstoch, before_num_nmapsfill = 0, bool:mselected = false; #if defined DEDICATED_LOG_ENABLED new logfilename[256]; #endif @@ -93,6 +102,9 @@ new whonmaps_num[MAX_MAPS_AMOUNT]; new curtime = 0, staytime = 0, curplayers = 0, currounds = 0; new dmap_strict, nominations_allowed, emptymap, idletime, emptymap_allowed, weapon_delay; +new g_TotalVotes; // Running total used to calculate percentages +new bool:g_AlreadyVoted[33]; // Keep track of who voted in current round +new g_VoteTimeRemaining; // Used to set duration of display of vote menu forward public hudtext16(textblock[], colr, colg, colb, posx, posy, screen, time, id); forward bool:isbanned(map[]); @@ -204,6 +216,7 @@ } currentplayers--; activeplayers--; + g_AlreadyVoted[id] = false; if (rocked[id]) { rocked[id] = 0; rocks--; @@ -614,9 +627,9 @@ if (quiet != 2) { new whenChange[40]; if (get_cvar_float("enforce_timelimit") == 1.0 && is_cstrike) { - format(whenChange, 39, "%L", LANG_PLAYER, "DMAP_IN_SECONDS", timeleft); + formatex(whenChange, 39, "%L", LANG_PLAYER, "DMAP_IN_SECONDS", timeleft); } else { - format(whenChange, 39, "%L", LANG_PLAYER, "DMAP_SHORTLY"); + formatex(whenChange, 39, "%L", LANG_PLAYER, "DMAP_SHORTLY"); } set_hudmessage(222, 70,0, -1.0, 0.36, 0, 4.0, 10.0, 2.0, 2.0, 4); if (timeleft <= 0 || timeleft > 300) { @@ -760,7 +773,11 @@ client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_CHOSE_MAP", name, nmaps[nnextmaps[key]]); } } - nvotes[key] = nvotes[key] + 1; + nvotes[key] += 1; + g_TotalVotes += 1; + g_AlreadyVoted[id] = true; + show_vote_menu(false); + return PLUGIN_HANDLED; } @@ -801,6 +818,16 @@ return PLUGIN_HANDLED; } +public dmapnominate(id, level, cid) { + if (!cmd_access(id, level, cid, 1)) { + return PLUGIN_HANDLED; + } + // + // TODO: Add some code.. + // + return PLUGIN_HANDLED; +} + public levelchange() { if (istimeset2 == 1) { //Allow automatic map change to take place. set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") - 2.0); @@ -994,21 +1021,21 @@ new string[256], string2[256], string3[512]; if (nmaps_num < 1) { - format(string3, 511, "%L", LANG_PLAYER, "DMAP_NO_MAPS_NOMINATED"); + formatex(string3, 511, "%L", LANG_PLAYER, "DMAP_NO_MAPS_NOMINATED"); } else { new n = 0, foundone = 0; - format(string, 255, "%L", LANG_PLAYER, "DMAP_NOMINATIONS"); + formatex(string, 255, "%L", LANG_PLAYER, "DMAP_NOMINATIONS"); while (n < 3 && n < nmaps_num) { - format(string, 255, "%s %s", string, nmaps[n++]); + formatex(string, 255, "%s %s", string, nmaps[n++]); } while (n < 6 && n < nmaps_num) { foundone = 1; format(string2, 255, "%s %s", string2, nmaps[n++]); } if (foundone) { - format(string3, 511, "%s^n%s", string, string2); + formatex(string3, 511, "%s^n%s", string, string2); } else { - format(string3, 511, "%s", string); + formatex(string3, 511, "%s", string); } } hudtext16(string3, random_num(0, 222), random_num(0, 111), random_num(111, 222), -1000, 50, random_num(1, 4), 10, 0); @@ -1020,7 +1047,7 @@ new a = 0, string3[512], string1[128], temp[256]; if (a < nmaps_num) { //show_hudmessage(id, "The following maps have been nominated for the next map vote:"); - format(temp, 255, "%L", LANG_PLAYER, "DMAP_NOMINATED_MAPS"); + formatex(temp, 255, "%L", LANG_PLAYER, "DMAP_NOMINATED_MAPS"); add(string3, 511, temp); } while (a < nmaps_num) { @@ -1028,7 +1055,7 @@ get_user_name(whonmaps_num[a], name1, 32); //set_hudmessage(255, 0, 0, 0.12, 0.3 + 0.08 * float(a), 0, 15.0, 15.04, 1.5, 3.75, 2 + a); //show_hudmessage(id, "%s by: %s", nmaps[a], name1); - format(string1, 128, "%L", LANG_PLAYER, "DMAP_MAP_BY", nmaps[a], name1); + formatex(string1, 128, "%L", LANG_PLAYER, "DMAP_MAP_BY", nmaps[a], name1); add(string3, 511, string1, 100); a++; } @@ -1065,7 +1092,7 @@ if (total > 0) { //show_hudmessage(0, "The following maps are available to nominate:^n%s", string); new temp[256]; - format(temp, 255, "%L", LANG_PLAYER, "DMAP_AVAILABLE_MAPS"); + formatex(temp, 255, "%L", LANG_PLAYER, "DMAP_AVAILABLE_MAPS"); add(string3, 511, temp, 100); add(string3, 511, string, 100); add(string3, 511, "^n"); @@ -1199,7 +1226,7 @@ } public startthevote() { - new mp_winlimit = get_cvar_num("mp_winlimit"), j; + new j; if (cycle) { inprogress = 0; mselected = false; @@ -1392,117 +1419,184 @@ } } + show_vote_menu(true); + return PLUGIN_HANDLED; +} + +show_vote_menu(bool:bFirstTime) { + new menu[512], a, mkeys = (1 << maps_to_select + 1); new Float:steptime = get_cvar_float("amx_extendmap_step"); new extendint = floatround(steptime); - //new pos = copy(menu, 511, cstrike_running ? "\yAMX Choose nextmap:\w^n^n" : "AMX Choose nextmap:^n^n"); - //ERROR LIES BELOW cstrike_running new pos; + new mp_winlimit = get_cvar_num("mp_winlimit"); + if (bFirstTime == true) { + g_TotalVotes = 0; + for (a = 0; a <= 32; a++) { + g_AlreadyVoted[a] = false; + } + } + if (cstrike_running() == 1) { - pos = format(menu, 511, "%L", LANG_PLAYER, "DMAP_CS_MENU_TITLE"); + pos = formatex(menu, 511, "%L", LANG_PLAYER, "DMAP_CS_MENU_TITLE"); } else { - pos = format(menu, 511, "%L", LANG_PLAYER, "DMAP_MENU_TITLE"); + pos = formatex(menu, 511, "%L", LANG_PLAYER, "DMAP_MENU_TITLE"); } new dmax = (nmaps_num > maps_to_select) ? maps_to_select : nmaps_num; + new tagpath[64], sMenuOption[64]; // If size of sMenuOption is changed, change maxlength in append_vote_percent as well + formatex(tagpath, 63, "%s/dmaptags.ini", custompath); + for (nmapstoch = 0; nmapstoch < dmax; ++nmapstoch) { - a = random_num(0, nmaps_num - 1); - while (isinmenu(a)) { - if (++a >= nmaps_num) { - a = 0; + if (bFirstTime == true) { + a = random_num(0, nmaps_num - 1); // Randomize order of maps in vote + while (isinmenu(a)) { + if (++a >= nmaps_num) { + a = 0; + } } + nnextmaps[nmapstoch] = a; + nvotes[nmapstoch] = 0; // Reset votes for each map } - nnextmaps[nmapstoch] = a; - - new tagpath[64], sMenuOption[64]; - format(tagpath, 64, "%s/dmaptags.ini", custompath); - if (iscustommap(nmaps[a]) && usestandard) { + if (iscustommap(nmaps[nnextmaps[nmapstoch]]) && usestandard) { if (cstrike_running() == 1) { - formatex(sMenuOption, 64, "%L", LANG_PLAYER, "DMAP_CS_MENU_CUSTOM", nmapstoch + 1, nmaps[a]); + formatex(sMenuOption, 63, "%L", LANG_PLAYER, "DMAP_CS_MENU_CUSTOM", nmapstoch + 1, nmaps[nnextmaps[nmapstoch]]); } else { - formatex(sMenuOption, 64, "%L", LANG_PLAYER, "DMAP_MENU_CUSTOM", nmapstoch + 1, nmaps[a]); + formatex(sMenuOption, 63, "%L", LANG_PLAYER, "DMAP_MENU_CUSTOM", nmapstoch + 1, nmaps[nnextmaps[nmapstoch]]); } } else { // Don't show (Custom) - formatex(sMenuOption, 64, "%d. %s", nmapstoch + 1, nmaps[a]); + formatex(sMenuOption, 63, "%d. %s", nmapstoch + 1, nmaps[nnextmaps[nmapstoch]]); } if (file_exists(tagpath)) { // If the tag file is there, check for the extra tag new iLine, sFullLine[64], sTagMap[32], sTagText[32], txtLen; - while (read_file(tagpath, iLine, sFullLine, 64, txtLen)) { + while (read_file(tagpath, iLine, sFullLine, 63, txtLen)) { if (sFullLine[0] == ';') { iLine++; continue; // Ignore comments } - strbreak(sFullLine, sTagMap, 32, sTagText, 32); // Split the map name and tag apart + strbreak(sFullLine, sTagMap, 31, sTagText, 31); // Split the map name and tag apart - if (equali(nmaps[a], sTagMap)) { - format(sMenuOption, 64, "%s [%s]", sMenuOption, sTagText); + if (equali(nmaps[nnextmaps[nmapstoch]], sTagMap)) { + format(sMenuOption, 63, "%s [%s]", sMenuOption, sTagText); break; // Quit reading the file } iLine++; } } - strcat(sMenuOption, "^n", 64); + append_vote_percent(sMenuOption, nmapstoch, true); pos += formatex(menu[pos], 511, sMenuOption); mkeys |= (1 << nmapstoch); - nvotes[nmapstoch] = 0; } menu[pos++] = '^n'; - nvotes[maps_to_select] = 0; - nvotes[maps_to_select + 1] = 0; + if (bFirstTime == true) { + nvotes[maps_to_select] = 0; + nvotes[maps_to_select + 1] = 0; + } new mapname[32]; get_mapname(mapname, 31); if (!mp_winlimit && get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max")) { - pos += format(menu[pos], 511, "%L", LANG_PLAYER, "DMAP_MENU_EXTEND", maps_to_select + 1, mapname, extendint); + formatex(sMenuOption, 63, "%L", LANG_PLAYER, "DMAP_MENU_EXTEND", maps_to_select + 1, mapname, extendint); + append_vote_percent(sMenuOption, maps_to_select, true); + pos += formatex(menu[pos], 511, sMenuOption); + mkeys |= (1 << maps_to_select); } - format(menu[pos], 511, "%L", LANG_PLAYER, "DMAP_MENU_NONE", maps_to_select + 2); - show_menu(0, mkeys, menu, 19); - set_task(20.0, "check_votes"); //set_task(15.0, "check_votes") - if (is_cstrike) { - client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_TIME_TO_CHOOSE"); - } - if (quiet == 0) { - client_cmd(0, "spk Gman/Gman_Choose%d", random_num(1, 2)); - } + formatex(sMenuOption, 63, "%L", LANG_PLAYER, "DMAP_MENU_NONE", maps_to_select + 2); + append_vote_percent(sMenuOption, maps_to_select + 1); + formatex(menu[pos], 511, sMenuOption); + + if (bFirstTime == true) { + g_VoteTimeRemaining = DMAP_VOTE_TIME; + set_task(float(g_VoteTimeRemaining), "check_votes"); + show_menu(0, mkeys, menu, --g_VoteTimeRemaining); + set_task(1.0, "update_vote_time_remaining", DMAP_TASKID_VTR, "", 0, "a", g_VoteTimeRemaining); + if (is_cstrike) { + client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_TIME_TO_CHOOSE"); + } + if (quiet == 0) { + client_cmd(0, "spk Gman/Gman_Choose%d", random_num(1, 2)); + } #if defined DEDICATED_LOG_ENABLED - log_to_file(logfilename, "Vote: Voting for the nextmap started"); + log_to_file(logfilename, "Vote: Voting for the nextmap started"); #endif - return PLUGIN_HANDLED; + } else { + new players[32], iNum, id; + get_players(players, iNum, "ch"); + for (new iPlayer = 0; iPlayer < iNum; iPlayer++) { + id = players[iPlayer]; + if (g_AlreadyVoted[id] == false) { + show_menu(players[iPlayer], mkeys, menu, g_VoteTimeRemaining); + } + } + + } + return PLUGIN_HANDLED; +} + +stock percent(iIs, iOf) { + return (iOf != 0) ? floatround(floatmul(float(iIs) / float(iOf), 100.0)) : 0; +} + +append_vote_percent(sMenuOption[], iChoice, bool:bNewLine = false) { + + new iPercent = percent(nvotes[iChoice], g_TotalVotes); + new sPercent[16]; + if (iPercent > 0) { // Don't show 0% + if (cstrike_running() == 1) { + formatex(sPercent, 15, " \d(%d%s)\w", iPercent, "%%"); + } else { + formatex(sPercent, 15, " (%d%s)", iPercent, "%%"); + } + strcat(sMenuOption, sPercent, 63); + } + + if (bNewLine == true) { // Do this even if vote is 0% + strcat(sMenuOption, "^n", 63); + } + + return PLUGIN_HANDLED; +} + +public update_vote_time_remaining() { + if (--g_VoteTimeRemaining <= 0) { + remove_task(DMAP_TASKID_VTR); + } + return PLUGIN_HANDLED; } public handle_andchange(id, map2[]) { - new tester[128]; + new tester[32]; if (is_map_valid(map2) == 1) { handle_nominate(id, map2); } else { - format(tester, 31, "cs_%s", map2); + formatex(tester, 31, "cs_%s", map2); if (is_map_valid(tester) == 1) { handle_nominate(id, tester); } else { - format(tester, 31, "de_%s", map2); + formatex(tester, 31, "de_%s", map2); if (is_map_valid(tester) == 1) { handle_nominate(id, tester); } else { - format(tester, 31, "as_%s", map2); + formatex(tester, 31, "as_%s", map2); if (is_map_valid(tester) == 1) { handle_nominate(id, tester); } else { - format(tester, 31, "dod_%s", map2); + formatex(tester, 31, "dod_%s", map2); if (is_map_valid(tester) == 1) { handle_nominate(id, tester); } else { - format(tester, 31, "fy_%s", map2); + formatex(tester, 31, "fy_%s", map2); if (is_map_valid(tester) == 1) { handle_nominate(id, tester); } else { @@ -1518,15 +1612,15 @@ public HandleSay(id) { new chat[256]; - read_args(chat, 256); + read_args(chat, 255); new saymap[256]; saymap = chat; remove_quotes(saymap); - new saymap2[28]; - read_args(saymap2,28); + new saymap2[29]; + read_args(saymap2, 28); remove_quotes(saymap2); new chat2[32]; - format(chat2, 31, "cs_%s", saymap2); + if (containi(chat, "<") != -1 || containi(chat, "?") != -1 || containi(chat, ">") != -1 || containi(chat, "*") != -1 || containi(chat, "&") != -1 || containi(chat, ".") != -1) { return PLUGIN_CONTINUE; } @@ -1560,23 +1654,23 @@ if (is_map_valid(saymap) == 1) { handle_nominate(id, saymap); } else { - format(chat2, 31, "cs_%s", saymap2); + formatex(chat2, 31, "cs_%s", saymap2); if (is_map_valid(chat2) == 1) { handle_nominate(id, chat2); } else { - format(chat2, 31, "de_%s", saymap2); + formatex(chat2, 31, "de_%s", saymap2); if (is_map_valid(chat2) == 1) { handle_nominate(id, chat2); } else { - format(chat2, 31, "as_%s", saymap2); + formatex(chat2, 31, "as_%s", saymap2); if (is_map_valid(chat2) == 1) { handle_nominate(id, chat2); } else { - format(chat2, 31, "dod_%s", saymap2); + formatex(chat2, 31, "dod_%s", saymap2); if (is_map_valid(chat2) == 1) { handle_nominate(id, chat2); } else { - format(chat2, 31, "fy_%s", saymap2); + formatex(chat2, 31, "fy_%s", saymap2); if (is_map_valid(chat2) == 1) { handle_nominate(id, chat2); } @@ -1846,12 +1940,12 @@ get_cvar_string("amx_nextmap", smap, 31); if (file_exists(pathtomaps)) { while (read_file(pathtomaps, line, linestr, 255, stextsize) && !done) { - format(maptext, 31, "%s", linestr); + formatex(maptext, 31, "%s", linestr); if (is_map_valid(maptext) && !is_map_valid(maptext[1]) && equali(maptext, current_map)) { done = found_a_match = 1; line++; if (read_file(pathtomaps, line, linestr, 255, stextsize)) { - format(maptext, 31, "%s", linestr); + formatex(maptext, 31, "%s", linestr); if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { ////////////////////////////////////////// if (equali(smap, "")) { @@ -1872,7 +1966,7 @@ if (!found_a_match) { line = 0; while (read_file(pathtomaps, line, linestr, 255, stextsize) && !found_a_match && line < 1024) { - format(maptext, 31, "%s", linestr); + formatex(maptext, 31, "%s", linestr); if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { if (equali(smap, "")) { register_cvar("amx_nextmap", "", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY); @@ -1891,7 +1985,7 @@ new tries = 0; while ((read_file(pathtomaps, line, linestr, 255, stextsize) || !found_a_match) && (tries < 1024 && !found_a_match)) { - format(maptext, 31, "%s", linestr); + formatex(maptext, 31, "%s", linestr); if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { if (equali(smap, "")) { register_cvar("amx_nextmap", "", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY); @@ -1907,7 +2001,7 @@ } line = 0; - format(pathtomaps, 64, "%s/allmaps.txt", custompath); + formatex(pathtomaps, 63, "%s/allmaps.txt", custompath); if (!file_exists(pathtomaps)) { new mapsadded = 0; while ((line = read_dir("maps", line, linestr, 255, stextsize)) != 0) { @@ -1938,7 +2032,7 @@ if (file_exists(pathtomaps)) { while (read_file(pathtomaps, line, linestr, 255, stextsize) && i < MAX_MAPS_AMOUNT) { - format(maptext, 31, "%s", linestr); + formatex(maptext, 31, "%s", linestr); if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { isinthislist = 0; for (p = 0; p < i; p++) { @@ -1968,7 +2062,7 @@ get_cvar_string("mapcyclefile", pathtomaps, 63); if (file_exists(pathtomaps)) { while (read_file(pathtomaps, line, linestr, 255, stextsize) && i < MAX_MAPS_AMOUNT) { - format(maptext, 31, "%s", linestr); + formatex(maptext, 31, "%s", linestr); if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { isinthislist = 0; for (p = 0; p < i; p++) @@ -1998,7 +2092,7 @@ public ban_some_maps() { //BAN MAPS FROM CONFIG FILE new banpath[64]; - format(banpath, 64, "%s/mapstoban.ini", custompath); + formatex(banpath, 63, "%s/mapstoban.ini", custompath); new i = 0; new line = 0; new stextsize = 0; @@ -2007,7 +2101,7 @@ if (file_exists(banpath)) { while (read_file(banpath, line, linestr, 255, stextsize) && i < MAX_MAPS_AMOUNT) { - format(maptext, 31, "%s", linestr); + formatex(maptext, 31, "%s", linestr); if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { banthesemaps[i++] = maptext; } @@ -2024,7 +2118,7 @@ #endif //BAN RECENT MAPS PLAYED new lastmapspath[64]; - format(lastmapspath, 64, "%s/lastmapsplayed.txt", custompath); + formatex(lastmapspath, 63, "%s/lastmapsplayed.txt", custompath); //new linestring[32]; line = stextsize = 0; new current_map[32]; @@ -2035,8 +2129,7 @@ if (file_exists(lastmapspath)) { while(read_file(lastmapspath, line, linestr, 255, stextsize) && bannedsofar <= ban_last_maps) { if ((strlen(linestr) > 0) && (is_map_valid(linestr))) { - format(lastmaps[bannedsofar++], 31, "%s", linestr); - //copy(lastmaps[bannedsofar++], 31, "%s", linestr); + formatex(lastmaps[bannedsofar++], 31, "%s", linestr); } line++; } @@ -2046,13 +2139,13 @@ public write_lastmaps() { new lastmapspath[64]; - format(lastmapspath, 64, "%s/lastmapsplayed.txt", custompath); + formatex(lastmapspath, 63, "%s/lastmapsplayed.txt", custompath); if (file_exists(lastmapspath)) { delete_file(lastmapspath); } new text[256], p; for (p = 0; p < bannedsofar; p++) { - format(text, 255, "%s", lastmaps[p]); + formatex(text, 255, "%s", lastmaps[p]); write_file(lastmapspath, text); } write_file(lastmapspath, "Generated by map_nominate plugin,"); @@ -2063,7 +2156,7 @@ public load_maps() { new choicepath[64]; - format(choicepath, 64, "%s/mapchoice.ini", custompath); + formatex(choicepath, 63, "%s/mapchoice.ini", custompath); new line = 0; new stextsize = 0, isinlist, unable = 0, i; new linestr[256]; @@ -2072,7 +2165,7 @@ get_mapname(current_map, 31); if (file_exists(choicepath)) { while (read_file(choicepath, line, linestr, 255, stextsize) && (num_nmapsfill < MAX_MAPS_AMOUNT)) { - format(maptext, 31, "%s", linestr); + formatex(maptext, 31, "%s", linestr); if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { isinlist = 0; if (isbanned(maptext) || islastmaps(maptext)) { @@ -2111,7 +2204,7 @@ public load_defaultmaps() { new standardpath[64]; - format(standardpath, 64, "%s/standardmaps.ini", custompath); + formatex(standardpath, 63, "%s/standardmaps.ini", custompath); new i = 0; new line = 0; new stextsize = 0; @@ -2122,7 +2215,7 @@ usestandard = standardtotal = 0; } else { while(read_file(standardpath, line, linestr, 255, stextsize) && i < 40) { - format(maptext, 31, "%s", linestr); + formatex(maptext, 31, "%s", linestr); if (is_map_valid(maptext)) { standard[i++] = maptext; } @@ -2196,7 +2289,7 @@ } switch(text[0]) { case 'r': { - format(percent, 4, "%s", text[2]); + formatex(percent, 4, "%s", text[2]); numpercent = float(str_to_num(percent)) / 100.0; if (numpercent >= 0.03 && numpercent <= 1.0) { rtvpercent = numpercent; @@ -2217,7 +2310,7 @@ } case 'f': { if (text[1] == 'r') { - format(strwait2, 2, "%s", text[2]); + formatex(strwait2, 2, "%s", text[2]); waittime = str_to_num(strwait2); if (waittime >= 2 && waittime <= 20) { frequency = waittime; @@ -2227,7 +2320,7 @@ } } case 'b': { - format(strban, 3, "%s", text[2]); + formatex(strban, 3, "%s", text[2]); banamount = str_to_num(strban); if (banamount >= 0 && banamount <= 100) { if ((banamount == 0 && text[2] == '0') || banamount > 0) { @@ -2237,7 +2330,7 @@ } case 'm': { if (atstart) { - format(strnum, 2, "%s", text[2]); + formatex(strnum, 2, "%s", text[2]); mapsnum = str_to_num(strnum); if (mapsnum >= 2 && mapsnum <= 8) { maps_to_select = mapssave = mapsnum; @@ -2245,34 +2338,34 @@ } } case 'p': { - format(strplay, 2, "%s", text[2]); + formatex(strplay, 2, "%s", text[2]); nplayers = str_to_num(strplay); if (nplayers > 0 && nplayers <= 32) { minimum = nplayers; } } case 'u': { - format(strurl, 63, "%s", text[2]); + formatex(strurl, 63, "%s", text[2]); if ((containi(strurl, "www") != -1 || containi(strurl, "http") != -1) && !equali(strurl, "http")) { mapsurl = strurl; } } case 'w': { - format(strwait, 2, "%s", text[2]); + formatex(strwait, 2, "%s", text[2]); waittime = str_to_num(strwait); if (waittime >= 5 && waittime <= 30) { minimumwait = waittime; } } case 'x': { - format(strnum2, 2, "%s", text[2]); + formatex(strnum2, 2, "%s", text[2]); mapsnum = str_to_num(strnum2); if (mapsnum >= 1 && mapsnum <= 3) { maxnom = mapsnum; } } case 'y': { - format(strnum2, 2, "%s", text[2]); + formatex(strnum2, 2, "%s", text[2]); mapsnum = str_to_num(strnum2); if (mapsnum >= 0 && mapsnum <= mapssave) { maxcustnom = mapsnum; @@ -2613,35 +2706,35 @@ public gen_maphelphtml() { new path[64], text[128]; - format(path, 63, "%s/map_manage_help.htm", custompath); + formatex(path, 63, "%s/map_manage_help.htm", custompath); if (file_exists(path)) { delete_file(path); } - format(text, 127, "%L", LANG_SERVER, "DMAP_HELP"); + formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP"); write_file(path, text); - format(text, 127, "%L", LANG_SERVER, "DMAP_HELP2"); + formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP2"); write_file(path, text); - format(text, 127, "%L", LANG_SERVER, "DMAP_HELP3"); + formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP3"); write_file(path, text); - format(text, 127, "%L", LANG_SERVER, "DMAP_HELP4"); + formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP4"); write_file(path, text); - format(text, 127, "%L", LANG_SERVER, "DMAP_HELP5"); + formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP5"); write_file(path, text); - format(text, 127, "%L", LANG_SERVER, "DMAP_HELP6"); + formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP6"); write_file(path, text); - format(text, 127, "%L", LANG_SERVER, "DMAP_HELP7"); + formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP7"); write_file(path, text); - format(text, 127, "%L", LANG_SERVER, "DMAP_HELP8"); + formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP8"); write_file(path, text); } public showmotdhelp(id) { new header[80]; new myversion[32]; - new helpfile[60]; - format(helpfile, 60, "%s/map_manage_help.htm", custompath); + new helpfile[64]; + formatex(helpfile, 63, "%s/map_manage_help.htm", custompath); get_cvar_string("Deags_Map_Manage", myversion, 31); - format(header, 79, "%L", LANG_PLAYER, "DMAP_HELP9", myversion); + formatex(header, 79, "%L", LANG_PLAYER, "DMAP_HELP9", myversion); if (!file_exists(helpfile)) { gen_maphelphtml(); } @@ -2730,7 +2823,7 @@ change_custom_path() { new temp[64]; - format(temp, 63, "%s/dmap", custompath); + formatex(temp, 63, "%s/dmap", custompath); if (dir_exists(temp)) { copy(custompath, 48, temp); } @@ -2739,31 +2832,31 @@ savesettings(myid) { new settings[64]; - format(settings, 64, "%s/mapvault.dat", custompath); + formatex(settings, 63, "%s/mapvault.dat", custompath); if (file_exists(settings)) { delete_file(settings); } new text[32], text2[128], percent, success = 1, usedany = 0; - format(text2, 127, ";To use comments simply use ;"); + formatex(text2, 127, ";To use comments simply use ;"); if (!write_file(settings,text2)) { success = 0; } - format(text2, 127, ";Do not modify this variables, this is used by the Nomination_style_voting plugin to save settings"); + formatex(text2, 127, ";Do not modify this variables, this is used by the Nomination_style_voting plugin to save settings"); if (!write_file(settings, text2)) { success = 0; } - format(text2, 127, ";If you delete this file, defaults will be restored."); + formatex(text2, 127, ";If you delete this file, defaults will be restored."); if (!write_file(settings, text2)) { success = 0; } - format(text2, 127, ";If you make an invalid setting, that specific setting will restore to the default"); + formatex(text2, 127, ";If you make an invalid setting, that specific setting will restore to the default"); if (!write_file(settings, text2)) { success = 0; } if (!enabled) { - format(text, 31, "d"); //d for disabled + formatex(text, 31, "d"); //d for disabled usedany = 1; if (!write_file(settings, text)) { success = 0; @@ -2771,9 +2864,9 @@ } if (quiet != 0) { if (quiet == 1) { - format(text, 31, "q1"); //d for disabled + formatex(text, 31, "q1"); //d for disabled } else { - format(text, 31, "q2"); //d for disabled + formatex(text, 31, "q2"); //d for disabled } usedany = 1; if (!write_file(settings, text)) { @@ -2781,13 +2874,13 @@ } } if (!dofreeze || !(cstrike_running() == 1)) { - format(text, 31, "f"); + formatex(text, 31, "f"); if (!write_file(settings, text)) { success = 0; } } if (cycle) { - format(text, 31, "c"); //c for Cycle mode=on + formatex(text, 31, "c"); //c for Cycle mode=on usedany = 1; if (!write_file(settings, text)) { success = 0; @@ -2795,63 +2888,63 @@ } percent = floatround(rtvpercent * 100.0); if (percent >= 3 && percent <= 100) { - format(text, 31, "r %d", percent); + formatex(text, 31, "r %d", percent); usedany = 1; if (!write_file(settings, text)) { success = 0; } } if (ban_last_maps >= 0 && ban_last_maps <= 100) { - format(text, 31, "b %d", ban_last_maps); + formatex(text, 31, "b %d", ban_last_maps); usedany = 1; if (!write_file(settings, text)) { success = 0; } } if (mapssave >= 2 && mapssave <= 8) { - format(text, 31, "m %d", mapssave); + formatex(text, 31, "m %d", mapssave); usedany = 1; if (!write_file(settings, text)) { success = 0; } } if (maxnom >= 0 && maxnom <= 3) { - format(text, 31, "x %d", maxnom); + formatex(text, 31, "x %d", maxnom); usedany = 1; if (!write_file(settings, text)) { success = 0; } } if (maxcustnom >= 0 && maxcustnom <= mapssave) { - format(text, 31, "y %d", maxcustnom); + formatex(text, 31, "y %d", maxcustnom); usedany = 1; if (!write_file(settings, text)) { success = 0; } } if (minimum > 0 && minimum <= 32) { - format(text, 31, "p %d", minimum); + formatex(text, 31, "p %d", minimum); usedany = 1; if (!write_file(settings, text)) { success = 0; } } if (minimumwait >= 5 && minimumwait <= 30) { - format(text, 31, "w %d", minimumwait); + formatex(text, 31, "w %d", minimumwait); usedany = 1; if (!write_file(settings, text)) { success = 0; } } if (frequency >= 2 && frequency <= 20) { - format(text, 31, "fr %d", frequency); + formatex(text, 31, "fr %d", frequency); usedany = 1; if (!write_file(settings, text)) { success = 0; } } if (containi(mapsurl, "www") != -1 || containi(mapsurl, "http") != -1) { - format(text2, 75, "u %s", mapsurl); + formatex(text2, 75, "u %s", mapsurl); usedany = 1; if (!write_file(settings, text2)) { success = 0; @@ -2983,6 +3076,7 @@ register_concmd("dmap_nominations", "dmapmaxnominations", ADMIN_SUPER_DMAP, "Set maximum number of nominations for each person"); register_concmd("dmap_maxcustom", "dmapmaxcustom", ADMIN_SUPER_DMAP, "Set maximum number of custom nominations that may be made"); register_concmd("dmap_cancelvote", "dmapcancelvote", ADMIN_DMAP, "Cancels the rocked vote"); + register_concmd("dmap_nominate", "dmapnominate", ADMIN_DMAP, "Force nomination of a map by an admin"); register_logevent("event_RoundStart", 2, "0=World triggered", "1=Round_Start"); register_logevent("event_RoundEnd", 2, "0=World triggered", "1=Round_End"); @@ -3036,7 +3130,7 @@ set_task(1.0, "timer", 0, "curtime", 0, "b", 1); maps_to_select = mapssave = 5; new temparray[64]; - format(temparray, 64, "%s/mapvault.dat", custompath); + formatex(temparray, 63, "%s/mapvault.dat", custompath); if (!loadsettings(temparray)) { set_defaults(-1); }