50 |
#include <amxmisc> |
#include <amxmisc> |
51 |
|
|
52 |
new const PLUGIN[] = "DeagsMapManager"; |
new const PLUGIN[] = "DeagsMapManager"; |
53 |
new const VERSION[] = "3.21"; |
new const VERSION[] = "3.21SVN"; |
54 |
new const AUTHOR[] = "Deags/AMXX Community"; |
new const AUTHOR[] = "Deags/AMXX Community"; |
55 |
|
|
56 |
// Comment out the following line to disable the dedicated log file |
// Comment out the following line to disable the dedicated log file |
60 |
#define ADMIN_DMAP ADMIN_LEVEL_A |
#define ADMIN_DMAP ADMIN_LEVEL_A |
61 |
#define ADMIN_SUPER_DMAP ADMIN_LEVEL_F |
#define ADMIN_SUPER_DMAP ADMIN_LEVEL_F |
62 |
|
|
63 |
|
#define DMAP_VOTE_TIME 20 // Total time (in seconds) from vote start to checking votes |
64 |
|
|
65 |
|
#define DMAP_TASKID_VTR 10000 // Vote Time Remaining |
66 |
|
// non-DEFINE ids currently used: |
67 |
|
// 123400, 123450, 123452, 127600(+id), 127600(+idreal),333333, 444444, 454500, |
68 |
|
// 454510, 459100, 459200, 765100, 986100, 986200, 987111, 987300, 987456 |
69 |
|
|
70 |
new maps_to_select, isbuytime = 0, isbetween = 0; |
new maps_to_select, isbuytime = 0, isbetween = 0; |
71 |
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 ban_last_maps = 0, quiet = 0; //quiet=0 (words and sounds) quiet=1 (words only, no sound) quiet=2 (no sound, no words) |
72 |
new Float:rtvpercent, Float:thespeed, Float:oldtimelimit; |
new Float:rtvpercent, Float:thespeed, Float:oldtimelimit; |
91 |
new nmapsfill[MAX_MAPS_AMOUNT][32]; |
new nmapsfill[MAX_MAPS_AMOUNT][32]; |
92 |
new num_nmapsfill; //this is number of maps in users admin.cfg file that are valid |
new num_nmapsfill; //this is number of maps in users admin.cfg file that are valid |
93 |
new bool:is_cstrike; |
new bool:is_cstrike; |
94 |
new nnextmaps[10], nvotes[12], nmapstoch, before_num_nmapsfill = 0, bool:mselected = false; |
new nnextmaps[10]; |
95 |
|
new nvotes[12]; // Holds the number of votes for each map |
96 |
|
new nmapstoch, before_num_nmapsfill = 0, bool:mselected = false; |
97 |
#if defined DEDICATED_LOG_ENABLED |
#if defined DEDICATED_LOG_ENABLED |
98 |
new logfilename[256]; |
new logfilename[256]; |
99 |
#endif |
#endif |
102 |
new whonmaps_num[MAX_MAPS_AMOUNT]; |
new whonmaps_num[MAX_MAPS_AMOUNT]; |
103 |
new curtime = 0, staytime = 0, curplayers = 0, currounds = 0; |
new curtime = 0, staytime = 0, curplayers = 0, currounds = 0; |
104 |
new dmap_strict, nominations_allowed, emptymap, idletime, emptymap_allowed, weapon_delay; |
new dmap_strict, nominations_allowed, emptymap, idletime, emptymap_allowed, weapon_delay; |
105 |
|
new g_TotalVotes; // Running total used to calculate percentages |
106 |
|
new bool:g_AlreadyVoted[33]; // Keep track of who voted in current round |
107 |
|
new g_VoteTimeRemaining; // Used to set duration of display of vote menu |
108 |
|
|
109 |
forward public hudtext16(textblock[], colr, colg, colb, posx, posy, screen, time, id); |
forward public hudtext16(textblock[], colr, colg, colb, posx, posy, screen, time, id); |
110 |
forward bool:isbanned(map[]); |
forward bool:isbanned(map[]); |
216 |
} |
} |
217 |
currentplayers--; |
currentplayers--; |
218 |
activeplayers--; |
activeplayers--; |
219 |
|
g_AlreadyVoted[id] = false; |
220 |
if (rocked[id]) { |
if (rocked[id]) { |
221 |
rocked[id] = 0; |
rocked[id] = 0; |
222 |
rocks--; |
rocks--; |
627 |
if (quiet != 2) { |
if (quiet != 2) { |
628 |
new whenChange[40]; |
new whenChange[40]; |
629 |
if (get_cvar_float("enforce_timelimit") == 1.0 && is_cstrike) { |
if (get_cvar_float("enforce_timelimit") == 1.0 && is_cstrike) { |
630 |
format(whenChange, 39, "%L", LANG_PLAYER, "DMAP_IN_SECONDS", timeleft); |
formatex(whenChange, 39, "%L", LANG_PLAYER, "DMAP_IN_SECONDS", timeleft); |
631 |
} else { |
} else { |
632 |
format(whenChange, 39, "%L", LANG_PLAYER, "DMAP_SHORTLY"); |
formatex(whenChange, 39, "%L", LANG_PLAYER, "DMAP_SHORTLY"); |
633 |
} |
} |
634 |
set_hudmessage(222, 70,0, -1.0, 0.36, 0, 4.0, 10.0, 2.0, 2.0, 4); |
set_hudmessage(222, 70,0, -1.0, 0.36, 0, 4.0, 10.0, 2.0, 2.0, 4); |
635 |
if (timeleft <= 0 || timeleft > 300) { |
if (timeleft <= 0 || timeleft > 300) { |
773 |
client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_CHOSE_MAP", name, nmaps[nnextmaps[key]]); |
client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_CHOSE_MAP", name, nmaps[nnextmaps[key]]); |
774 |
} |
} |
775 |
} |
} |
776 |
nvotes[key] = nvotes[key] + 1; |
nvotes[key] += 1; |
777 |
|
g_TotalVotes += 1; |
778 |
|
g_AlreadyVoted[id] = true; |
779 |
|
show_vote_menu(false); |
780 |
|
|
781 |
return PLUGIN_HANDLED; |
return PLUGIN_HANDLED; |
782 |
} |
} |
783 |
|
|
818 |
return PLUGIN_HANDLED; |
return PLUGIN_HANDLED; |
819 |
} |
} |
820 |
|
|
821 |
|
public dmapnominate(id, level, cid) { |
822 |
|
if (!cmd_access(id, level, cid, 1)) { |
823 |
|
return PLUGIN_HANDLED; |
824 |
|
} |
825 |
|
// |
826 |
|
// TODO: Add some code.. |
827 |
|
// |
828 |
|
return PLUGIN_HANDLED; |
829 |
|
} |
830 |
|
|
831 |
public levelchange() { |
public levelchange() { |
832 |
if (istimeset2 == 1) { //Allow automatic map change to take place. |
if (istimeset2 == 1) { //Allow automatic map change to take place. |
833 |
set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") - 2.0); |
set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") - 2.0); |
1021 |
|
|
1022 |
new string[256], string2[256], string3[512]; |
new string[256], string2[256], string3[512]; |
1023 |
if (nmaps_num < 1) { |
if (nmaps_num < 1) { |
1024 |
format(string3, 511, "%L", LANG_PLAYER, "DMAP_NO_MAPS_NOMINATED"); |
formatex(string3, 511, "%L", LANG_PLAYER, "DMAP_NO_MAPS_NOMINATED"); |
1025 |
} else { |
} else { |
1026 |
new n = 0, foundone = 0; |
new n = 0, foundone = 0; |
1027 |
format(string, 255, "%L", LANG_PLAYER, "DMAP_NOMINATIONS"); |
formatex(string, 255, "%L", LANG_PLAYER, "DMAP_NOMINATIONS"); |
1028 |
while (n < 3 && n < nmaps_num) { |
while (n < 3 && n < nmaps_num) { |
1029 |
format(string, 255, "%s %s", string, nmaps[n++]); |
formatex(string, 255, "%s %s", string, nmaps[n++]); |
1030 |
} |
} |
1031 |
while (n < 6 && n < nmaps_num) { |
while (n < 6 && n < nmaps_num) { |
1032 |
foundone = 1; |
foundone = 1; |
1033 |
format(string2, 255, "%s %s", string2, nmaps[n++]); |
format(string2, 255, "%s %s", string2, nmaps[n++]); |
1034 |
} |
} |
1035 |
if (foundone) { |
if (foundone) { |
1036 |
format(string3, 511, "%s^n%s", string, string2); |
formatex(string3, 511, "%s^n%s", string, string2); |
1037 |
} else { |
} else { |
1038 |
format(string3, 511, "%s", string); |
formatex(string3, 511, "%s", string); |
1039 |
} |
} |
1040 |
} |
} |
1041 |
hudtext16(string3, random_num(0, 222), random_num(0, 111), random_num(111, 222), -1000, 50, random_num(1, 4), 10, 0); |
hudtext16(string3, random_num(0, 222), random_num(0, 111), random_num(111, 222), -1000, 50, random_num(1, 4), 10, 0); |
1047 |
new a = 0, string3[512], string1[128], temp[256]; |
new a = 0, string3[512], string1[128], temp[256]; |
1048 |
if (a < nmaps_num) { |
if (a < nmaps_num) { |
1049 |
//show_hudmessage(id, "The following maps have been nominated for the next map vote:"); |
//show_hudmessage(id, "The following maps have been nominated for the next map vote:"); |
1050 |
format(temp, 255, "%L", LANG_PLAYER, "DMAP_NOMINATED_MAPS"); |
formatex(temp, 255, "%L", LANG_PLAYER, "DMAP_NOMINATED_MAPS"); |
1051 |
add(string3, 511, temp); |
add(string3, 511, temp); |
1052 |
} |
} |
1053 |
while (a < nmaps_num) { |
while (a < nmaps_num) { |
1055 |
get_user_name(whonmaps_num[a], name1, 32); |
get_user_name(whonmaps_num[a], name1, 32); |
1056 |
//set_hudmessage(255, 0, 0, 0.12, 0.3 + 0.08 * float(a), 0, 15.0, 15.04, 1.5, 3.75, 2 + a); |
//set_hudmessage(255, 0, 0, 0.12, 0.3 + 0.08 * float(a), 0, 15.0, 15.04, 1.5, 3.75, 2 + a); |
1057 |
//show_hudmessage(id, "%s by: %s", nmaps[a], name1); |
//show_hudmessage(id, "%s by: %s", nmaps[a], name1); |
1058 |
format(string1, 128, "%L", LANG_PLAYER, "DMAP_MAP_BY", nmaps[a], name1); |
formatex(string1, 128, "%L", LANG_PLAYER, "DMAP_MAP_BY", nmaps[a], name1); |
1059 |
add(string3, 511, string1, 100); |
add(string3, 511, string1, 100); |
1060 |
a++; |
a++; |
1061 |
} |
} |
1092 |
if (total > 0) { |
if (total > 0) { |
1093 |
//show_hudmessage(0, "The following maps are available to nominate:^n%s", string); |
//show_hudmessage(0, "The following maps are available to nominate:^n%s", string); |
1094 |
new temp[256]; |
new temp[256]; |
1095 |
format(temp, 255, "%L", LANG_PLAYER, "DMAP_AVAILABLE_MAPS"); |
formatex(temp, 255, "%L", LANG_PLAYER, "DMAP_AVAILABLE_MAPS"); |
1096 |
add(string3, 511, temp, 100); |
add(string3, 511, temp, 100); |
1097 |
add(string3, 511, string, 100); |
add(string3, 511, string, 100); |
1098 |
add(string3, 511, "^n"); |
add(string3, 511, "^n"); |
1226 |
} |
} |
1227 |
|
|
1228 |
public startthevote() { |
public startthevote() { |
1229 |
new mp_winlimit = get_cvar_num("mp_winlimit"), j; |
new j; |
1230 |
if (cycle) { |
if (cycle) { |
1231 |
inprogress = 0; |
inprogress = 0; |
1232 |
mselected = false; |
mselected = false; |
1419 |
} |
} |
1420 |
} |
} |
1421 |
|
|
1422 |
|
show_vote_menu(true); |
1423 |
|
return PLUGIN_HANDLED; |
1424 |
|
} |
1425 |
|
|
1426 |
|
show_vote_menu(bool:bFirstTime) { |
1427 |
|
|
1428 |
new menu[512], a, mkeys = (1 << maps_to_select + 1); |
new menu[512], a, mkeys = (1 << maps_to_select + 1); |
1429 |
new Float:steptime = get_cvar_float("amx_extendmap_step"); |
new Float:steptime = get_cvar_float("amx_extendmap_step"); |
1430 |
new extendint = floatround(steptime); |
new extendint = floatround(steptime); |
1431 |
|
|
|
//new pos = copy(menu, 511, cstrike_running ? "\yAMX Choose nextmap:\w^n^n" : "AMX Choose nextmap:^n^n"); |
|
|
//ERROR LIES BELOW cstrike_running |
|
1432 |
new pos; |
new pos; |
1433 |
|
|
1434 |
|
new mp_winlimit = get_cvar_num("mp_winlimit"); |
1435 |
|
if (bFirstTime == true) { |
1436 |
|
g_TotalVotes = 0; |
1437 |
|
for (a = 0; a <= 32; a++) { |
1438 |
|
g_AlreadyVoted[a] = false; |
1439 |
|
} |
1440 |
|
} |
1441 |
|
|
1442 |
if (cstrike_running() == 1) { |
if (cstrike_running() == 1) { |
1443 |
pos = format(menu, 511, "%L", LANG_PLAYER, "DMAP_CS_MENU_TITLE"); |
pos = formatex(menu, 511, "%L", LANG_PLAYER, "DMAP_CS_MENU_TITLE"); |
1444 |
} else { |
} else { |
1445 |
pos = format(menu, 511, "%L", LANG_PLAYER, "DMAP_MENU_TITLE"); |
pos = formatex(menu, 511, "%L", LANG_PLAYER, "DMAP_MENU_TITLE"); |
1446 |
} |
} |
1447 |
|
|
1448 |
new dmax = (nmaps_num > maps_to_select) ? maps_to_select : nmaps_num; |
new dmax = (nmaps_num > maps_to_select) ? maps_to_select : nmaps_num; |
1449 |
|
|
1450 |
|
new tagpath[64], sMenuOption[64]; // If size of sMenuOption is changed, change maxlength in append_vote_percent as well |
1451 |
|
formatex(tagpath, 63, "%s/dmaptags.ini", custompath); |
1452 |
|
|
1453 |
for (nmapstoch = 0; nmapstoch < dmax; ++nmapstoch) { |
for (nmapstoch = 0; nmapstoch < dmax; ++nmapstoch) { |
1454 |
a = random_num(0, nmaps_num - 1); |
if (bFirstTime == true) { |
1455 |
|
a = random_num(0, nmaps_num - 1); // Randomize order of maps in vote |
1456 |
while (isinmenu(a)) { |
while (isinmenu(a)) { |
1457 |
if (++a >= nmaps_num) { |
if (++a >= nmaps_num) { |
1458 |
a = 0; |
a = 0; |
1459 |
} |
} |
1460 |
} |
} |
1461 |
nnextmaps[nmapstoch] = a; |
nnextmaps[nmapstoch] = a; |
1462 |
|
nvotes[nmapstoch] = 0; // Reset votes for each map |
1463 |
|
} |
1464 |
|
|
1465 |
new tagpath[64], sMenuOption[64]; |
if (iscustommap(nmaps[nnextmaps[nmapstoch]]) && usestandard) { |
|
format(tagpath, 64, "%s/dmaptags.ini", custompath); |
|
|
|
|
|
if (iscustommap(nmaps[a]) && usestandard) { |
|
1466 |
if (cstrike_running() == 1) { |
if (cstrike_running() == 1) { |
1467 |
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]]); |
1468 |
} else { |
} else { |
1469 |
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]]); |
1470 |
} |
} |
1471 |
} else { // Don't show (Custom) |
} else { // Don't show (Custom) |
1472 |
formatex(sMenuOption, 64, "%d. %s", nmapstoch + 1, nmaps[a]); |
formatex(sMenuOption, 63, "%d. %s", nmapstoch + 1, nmaps[nnextmaps[nmapstoch]]); |
1473 |
} |
} |
1474 |
|
|
1475 |
if (file_exists(tagpath)) { // If the tag file is there, check for the extra tag |
if (file_exists(tagpath)) { // If the tag file is there, check for the extra tag |
1476 |
new iLine, sFullLine[64], sTagMap[32], sTagText[32], txtLen; |
new iLine, sFullLine[64], sTagMap[32], sTagText[32], txtLen; |
1477 |
|
|
1478 |
while (read_file(tagpath, iLine, sFullLine, 64, txtLen)) { |
while (read_file(tagpath, iLine, sFullLine, 63, txtLen)) { |
1479 |
if (sFullLine[0] == ';') { |
if (sFullLine[0] == ';') { |
1480 |
iLine++; |
iLine++; |
1481 |
continue; // Ignore comments |
continue; // Ignore comments |
1482 |
} |
} |
1483 |
|
|
1484 |
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 |
1485 |
|
|
1486 |
if (equali(nmaps[a], sTagMap)) { |
if (equali(nmaps[nnextmaps[nmapstoch]], sTagMap)) { |
1487 |
format(sMenuOption, 64, "%s [%s]", sMenuOption, sTagText); |
format(sMenuOption, 63, "%s [%s]", sMenuOption, sTagText); |
1488 |
break; // Quit reading the file |
break; // Quit reading the file |
1489 |
} |
} |
1490 |
iLine++; |
iLine++; |
1491 |
} |
} |
1492 |
} |
} |
1493 |
|
|
1494 |
strcat(sMenuOption, "^n", 64); |
append_vote_percent(sMenuOption, nmapstoch, true); |
1495 |
pos += formatex(menu[pos], 511, sMenuOption); |
pos += formatex(menu[pos], 511, sMenuOption); |
1496 |
|
|
1497 |
mkeys |= (1 << nmapstoch); |
mkeys |= (1 << nmapstoch); |
|
nvotes[nmapstoch] = 0; |
|
1498 |
} |
} |
1499 |
|
|
1500 |
menu[pos++] = '^n'; |
menu[pos++] = '^n'; |
1501 |
|
if (bFirstTime == true) { |
1502 |
nvotes[maps_to_select] = 0; |
nvotes[maps_to_select] = 0; |
1503 |
nvotes[maps_to_select + 1] = 0; |
nvotes[maps_to_select + 1] = 0; |
1504 |
|
} |
1505 |
new mapname[32]; |
new mapname[32]; |
1506 |
get_mapname(mapname, 31); |
get_mapname(mapname, 31); |
1507 |
if (!mp_winlimit && get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max")) { |
if (!mp_winlimit && get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max")) { |
1508 |
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); |
1509 |
|
append_vote_percent(sMenuOption, maps_to_select, true); |
1510 |
|
pos += formatex(menu[pos], 511, sMenuOption); |
1511 |
|
|
1512 |
mkeys |= (1 << maps_to_select); |
mkeys |= (1 << maps_to_select); |
1513 |
} |
} |
1514 |
|
|
1515 |
format(menu[pos], 511, "%L", LANG_PLAYER, "DMAP_MENU_NONE", maps_to_select + 2); |
formatex(sMenuOption, 63, "%L", LANG_PLAYER, "DMAP_MENU_NONE", maps_to_select + 2); |
1516 |
show_menu(0, mkeys, menu, 19); |
append_vote_percent(sMenuOption, maps_to_select + 1); |
1517 |
set_task(20.0, "check_votes"); //set_task(15.0, "check_votes") |
formatex(menu[pos], 511, sMenuOption); |
1518 |
|
|
1519 |
|
if (bFirstTime == true) { |
1520 |
|
g_VoteTimeRemaining = DMAP_VOTE_TIME; |
1521 |
|
set_task(float(g_VoteTimeRemaining), "check_votes"); |
1522 |
|
show_menu(0, mkeys, menu, --g_VoteTimeRemaining); |
1523 |
|
set_task(1.0, "update_vote_time_remaining", DMAP_TASKID_VTR, "", 0, "a", g_VoteTimeRemaining); |
1524 |
if (is_cstrike) { |
if (is_cstrike) { |
1525 |
client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_TIME_TO_CHOOSE"); |
client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_TIME_TO_CHOOSE"); |
1526 |
} |
} |
1530 |
#if defined DEDICATED_LOG_ENABLED |
#if defined DEDICATED_LOG_ENABLED |
1531 |
log_to_file(logfilename, "Vote: Voting for the nextmap started"); |
log_to_file(logfilename, "Vote: Voting for the nextmap started"); |
1532 |
#endif |
#endif |
1533 |
|
} else { |
1534 |
|
new players[32], iNum, id; |
1535 |
|
get_players(players, iNum, "ch"); |
1536 |
|
for (new iPlayer = 0; iPlayer < iNum; iPlayer++) { |
1537 |
|
id = players[iPlayer]; |
1538 |
|
if (g_AlreadyVoted[id] == false) { |
1539 |
|
show_menu(players[iPlayer], mkeys, menu, g_VoteTimeRemaining); |
1540 |
|
} |
1541 |
|
} |
1542 |
|
|
1543 |
|
} |
1544 |
|
return PLUGIN_HANDLED; |
1545 |
|
} |
1546 |
|
|
1547 |
|
stock percent(iIs, iOf) { |
1548 |
|
return (iOf != 0) ? floatround(floatmul(float(iIs) / float(iOf), 100.0)) : 0; |
1549 |
|
} |
1550 |
|
|
1551 |
|
append_vote_percent(sMenuOption[], iChoice, bool:bNewLine = false) { |
1552 |
|
|
1553 |
|
new iPercent = percent(nvotes[iChoice], g_TotalVotes); |
1554 |
|
new sPercent[16]; |
1555 |
|
if (iPercent > 0) { // Don't show 0% |
1556 |
|
if (cstrike_running() == 1) { |
1557 |
|
formatex(sPercent, 15, " \d(%d%s)\w", iPercent, "%%"); |
1558 |
|
} else { |
1559 |
|
formatex(sPercent, 15, " (%d%s)", iPercent, "%%"); |
1560 |
|
} |
1561 |
|
strcat(sMenuOption, sPercent, 63); |
1562 |
|
} |
1563 |
|
|
1564 |
|
if (bNewLine == true) { // Do this even if vote is 0% |
1565 |
|
strcat(sMenuOption, "^n", 63); |
1566 |
|
} |
1567 |
|
|
1568 |
|
return PLUGIN_HANDLED; |
1569 |
|
} |
1570 |
|
|
1571 |
|
public update_vote_time_remaining() { |
1572 |
|
if (--g_VoteTimeRemaining <= 0) { |
1573 |
|
remove_task(DMAP_TASKID_VTR); |
1574 |
|
} |
1575 |
return PLUGIN_HANDLED; |
return PLUGIN_HANDLED; |
1576 |
} |
} |
1577 |
|
|
1578 |
public handle_andchange(id, map2[]) { |
public handle_andchange(id, map2[]) { |
1579 |
new tester[128]; |
new tester[32]; |
1580 |
if (is_map_valid(map2) == 1) { |
if (is_map_valid(map2) == 1) { |
1581 |
handle_nominate(id, map2); |
handle_nominate(id, map2); |
1582 |
} else { |
} else { |
1583 |
format(tester, 31, "cs_%s", map2); |
formatex(tester, 31, "cs_%s", map2); |
1584 |
if (is_map_valid(tester) == 1) { |
if (is_map_valid(tester) == 1) { |
1585 |
handle_nominate(id, tester); |
handle_nominate(id, tester); |
1586 |
} else { |
} else { |
1587 |
format(tester, 31, "de_%s", map2); |
formatex(tester, 31, "de_%s", map2); |
1588 |
if (is_map_valid(tester) == 1) { |
if (is_map_valid(tester) == 1) { |
1589 |
handle_nominate(id, tester); |
handle_nominate(id, tester); |
1590 |
} else { |
} else { |
1591 |
format(tester, 31, "as_%s", map2); |
formatex(tester, 31, "as_%s", map2); |
1592 |
if (is_map_valid(tester) == 1) { |
if (is_map_valid(tester) == 1) { |
1593 |
handle_nominate(id, tester); |
handle_nominate(id, tester); |
1594 |
} else { |
} else { |
1595 |
format(tester, 31, "dod_%s", map2); |
formatex(tester, 31, "dod_%s", map2); |
1596 |
if (is_map_valid(tester) == 1) { |
if (is_map_valid(tester) == 1) { |
1597 |
handle_nominate(id, tester); |
handle_nominate(id, tester); |
1598 |
} else { |
} else { |
1599 |
format(tester, 31, "fy_%s", map2); |
formatex(tester, 31, "fy_%s", map2); |
1600 |
if (is_map_valid(tester) == 1) { |
if (is_map_valid(tester) == 1) { |
1601 |
handle_nominate(id, tester); |
handle_nominate(id, tester); |
1602 |
} else { |
} else { |
1612 |
public HandleSay(id) { |
public HandleSay(id) { |
1613 |
|
|
1614 |
new chat[256]; |
new chat[256]; |
1615 |
read_args(chat, 256); |
read_args(chat, 255); |
1616 |
new saymap[256]; |
new saymap[256]; |
1617 |
saymap = chat; |
saymap = chat; |
1618 |
remove_quotes(saymap); |
remove_quotes(saymap); |
1619 |
new saymap2[28]; |
new saymap2[29]; |
1620 |
read_args(saymap2,28); |
read_args(saymap2,28); |
1621 |
remove_quotes(saymap2); |
remove_quotes(saymap2); |
1622 |
new chat2[32]; |
new chat2[32]; |
1623 |
format(chat2, 31, "cs_%s", saymap2); |
|
1624 |
if (containi(chat, "<") != -1 || containi(chat, "?") != -1 || containi(chat, ">") != -1 || containi(chat, "*") != -1 || containi(chat, "&") != -1 || containi(chat, ".") != -1) { |
if (containi(chat, "<") != -1 || containi(chat, "?") != -1 || containi(chat, ">") != -1 || containi(chat, "*") != -1 || containi(chat, "&") != -1 || containi(chat, ".") != -1) { |
1625 |
return PLUGIN_CONTINUE; |
return PLUGIN_CONTINUE; |
1626 |
} |
} |
1654 |
if (is_map_valid(saymap) == 1) { |
if (is_map_valid(saymap) == 1) { |
1655 |
handle_nominate(id, saymap); |
handle_nominate(id, saymap); |
1656 |
} else { |
} else { |
1657 |
format(chat2, 31, "cs_%s", saymap2); |
formatex(chat2, 31, "cs_%s", saymap2); |
1658 |
if (is_map_valid(chat2) == 1) { |
if (is_map_valid(chat2) == 1) { |
1659 |
handle_nominate(id, chat2); |
handle_nominate(id, chat2); |
1660 |
} else { |
} else { |
1661 |
format(chat2, 31, "de_%s", saymap2); |
formatex(chat2, 31, "de_%s", saymap2); |
1662 |
if (is_map_valid(chat2) == 1) { |
if (is_map_valid(chat2) == 1) { |
1663 |
handle_nominate(id, chat2); |
handle_nominate(id, chat2); |
1664 |
} else { |
} else { |
1665 |
format(chat2, 31, "as_%s", saymap2); |
formatex(chat2, 31, "as_%s", saymap2); |
1666 |
if (is_map_valid(chat2) == 1) { |
if (is_map_valid(chat2) == 1) { |
1667 |
handle_nominate(id, chat2); |
handle_nominate(id, chat2); |
1668 |
} else { |
} else { |
1669 |
format(chat2, 31, "dod_%s", saymap2); |
formatex(chat2, 31, "dod_%s", saymap2); |
1670 |
if (is_map_valid(chat2) == 1) { |
if (is_map_valid(chat2) == 1) { |
1671 |
handle_nominate(id, chat2); |
handle_nominate(id, chat2); |
1672 |
} else { |
} else { |
1673 |
format(chat2, 31, "fy_%s", saymap2); |
formatex(chat2, 31, "fy_%s", saymap2); |
1674 |
if (is_map_valid(chat2) == 1) { |
if (is_map_valid(chat2) == 1) { |
1675 |
handle_nominate(id, chat2); |
handle_nominate(id, chat2); |
1676 |
} |
} |
1940 |
get_cvar_string("amx_nextmap", smap, 31); |
get_cvar_string("amx_nextmap", smap, 31); |
1941 |
if (file_exists(pathtomaps)) { |
if (file_exists(pathtomaps)) { |
1942 |
while (read_file(pathtomaps, line, linestr, 255, stextsize) && !done) { |
while (read_file(pathtomaps, line, linestr, 255, stextsize) && !done) { |
1943 |
format(maptext, 31, "%s", linestr); |
formatex(maptext, 31, "%s", linestr); |
1944 |
if (is_map_valid(maptext) && !is_map_valid(maptext[1]) && equali(maptext, current_map)) { |
if (is_map_valid(maptext) && !is_map_valid(maptext[1]) && equali(maptext, current_map)) { |
1945 |
done = found_a_match = 1; |
done = found_a_match = 1; |
1946 |
line++; |
line++; |
1947 |
if (read_file(pathtomaps, line, linestr, 255, stextsize)) { |
if (read_file(pathtomaps, line, linestr, 255, stextsize)) { |
1948 |
format(maptext, 31, "%s", linestr); |
formatex(maptext, 31, "%s", linestr); |
1949 |
if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { |
if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { |
1950 |
////////////////////////////////////////// |
////////////////////////////////////////// |
1951 |
if (equali(smap, "")) { |
if (equali(smap, "")) { |
1966 |
if (!found_a_match) { |
if (!found_a_match) { |
1967 |
line = 0; |
line = 0; |
1968 |
while (read_file(pathtomaps, line, linestr, 255, stextsize) && !found_a_match && line < 1024) { |
while (read_file(pathtomaps, line, linestr, 255, stextsize) && !found_a_match && line < 1024) { |
1969 |
format(maptext, 31, "%s", linestr); |
formatex(maptext, 31, "%s", linestr); |
1970 |
if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { |
if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { |
1971 |
if (equali(smap, "")) { |
if (equali(smap, "")) { |
1972 |
register_cvar("amx_nextmap", "", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY); |
register_cvar("amx_nextmap", "", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY); |
1985 |
new tries = 0; |
new tries = 0; |
1986 |
|
|
1987 |
while ((read_file(pathtomaps, line, linestr, 255, stextsize) || !found_a_match) && (tries < 1024 && !found_a_match)) { |
while ((read_file(pathtomaps, line, linestr, 255, stextsize) || !found_a_match) && (tries < 1024 && !found_a_match)) { |
1988 |
format(maptext, 31, "%s", linestr); |
formatex(maptext, 31, "%s", linestr); |
1989 |
if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { |
if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { |
1990 |
if (equali(smap, "")) { |
if (equali(smap, "")) { |
1991 |
register_cvar("amx_nextmap", "", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY); |
register_cvar("amx_nextmap", "", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY); |
2001 |
} |
} |
2002 |
|
|
2003 |
line = 0; |
line = 0; |
2004 |
format(pathtomaps, 64, "%s/allmaps.txt", custompath); |
formatex(pathtomaps, 63, "%s/allmaps.txt", custompath); |
2005 |
if (!file_exists(pathtomaps)) { |
if (!file_exists(pathtomaps)) { |
2006 |
new mapsadded = 0; |
new mapsadded = 0; |
2007 |
while ((line = read_dir("maps", line, linestr, 255, stextsize)) != 0) { |
while ((line = read_dir("maps", line, linestr, 255, stextsize)) != 0) { |
2032 |
|
|
2033 |
if (file_exists(pathtomaps)) { |
if (file_exists(pathtomaps)) { |
2034 |
while (read_file(pathtomaps, line, linestr, 255, stextsize) && i < MAX_MAPS_AMOUNT) { |
while (read_file(pathtomaps, line, linestr, 255, stextsize) && i < MAX_MAPS_AMOUNT) { |
2035 |
format(maptext, 31, "%s", linestr); |
formatex(maptext, 31, "%s", linestr); |
2036 |
if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { |
if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { |
2037 |
isinthislist = 0; |
isinthislist = 0; |
2038 |
for (p = 0; p < i; p++) { |
for (p = 0; p < i; p++) { |
2062 |
get_cvar_string("mapcyclefile", pathtomaps, 63); |
get_cvar_string("mapcyclefile", pathtomaps, 63); |
2063 |
if (file_exists(pathtomaps)) { |
if (file_exists(pathtomaps)) { |
2064 |
while (read_file(pathtomaps, line, linestr, 255, stextsize) && i < MAX_MAPS_AMOUNT) { |
while (read_file(pathtomaps, line, linestr, 255, stextsize) && i < MAX_MAPS_AMOUNT) { |
2065 |
format(maptext, 31, "%s", linestr); |
formatex(maptext, 31, "%s", linestr); |
2066 |
if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { |
if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { |
2067 |
isinthislist = 0; |
isinthislist = 0; |
2068 |
for (p = 0; p < i; p++) |
for (p = 0; p < i; p++) |
2092 |
public ban_some_maps() { |
public ban_some_maps() { |
2093 |
//BAN MAPS FROM CONFIG FILE |
//BAN MAPS FROM CONFIG FILE |
2094 |
new banpath[64]; |
new banpath[64]; |
2095 |
format(banpath, 64, "%s/mapstoban.ini", custompath); |
formatex(banpath, 63, "%s/mapstoban.ini", custompath); |
2096 |
new i = 0; |
new i = 0; |
2097 |
new line = 0; |
new line = 0; |
2098 |
new stextsize = 0; |
new stextsize = 0; |
2101 |
|
|
2102 |
if (file_exists(banpath)) { |
if (file_exists(banpath)) { |
2103 |
while (read_file(banpath, line, linestr, 255, stextsize) && i < MAX_MAPS_AMOUNT) { |
while (read_file(banpath, line, linestr, 255, stextsize) && i < MAX_MAPS_AMOUNT) { |
2104 |
format(maptext, 31, "%s", linestr); |
formatex(maptext, 31, "%s", linestr); |
2105 |
if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { |
if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { |
2106 |
banthesemaps[i++] = maptext; |
banthesemaps[i++] = maptext; |
2107 |
} |
} |
2118 |
#endif |
#endif |
2119 |
//BAN RECENT MAPS PLAYED |
//BAN RECENT MAPS PLAYED |
2120 |
new lastmapspath[64]; |
new lastmapspath[64]; |
2121 |
format(lastmapspath, 64, "%s/lastmapsplayed.txt", custompath); |
formatex(lastmapspath, 63, "%s/lastmapsplayed.txt", custompath); |
2122 |
//new linestring[32]; |
//new linestring[32]; |
2123 |
line = stextsize = 0; |
line = stextsize = 0; |
2124 |
new current_map[32]; |
new current_map[32]; |
2129 |
if (file_exists(lastmapspath)) { |
if (file_exists(lastmapspath)) { |
2130 |
while(read_file(lastmapspath, line, linestr, 255, stextsize) && bannedsofar <= ban_last_maps) { |
while(read_file(lastmapspath, line, linestr, 255, stextsize) && bannedsofar <= ban_last_maps) { |
2131 |
if ((strlen(linestr) > 0) && (is_map_valid(linestr))) { |
if ((strlen(linestr) > 0) && (is_map_valid(linestr))) { |
2132 |
format(lastmaps[bannedsofar++], 31, "%s", linestr); |
formatex(lastmaps[bannedsofar++], 31, "%s", linestr); |
|
//copy(lastmaps[bannedsofar++], 31, "%s", linestr); |
|
2133 |
} |
} |
2134 |
line++; |
line++; |
2135 |
} |
} |
2139 |
|
|
2140 |
public write_lastmaps() { |
public write_lastmaps() { |
2141 |
new lastmapspath[64]; |
new lastmapspath[64]; |
2142 |
format(lastmapspath, 64, "%s/lastmapsplayed.txt", custompath); |
formatex(lastmapspath, 63, "%s/lastmapsplayed.txt", custompath); |
2143 |
if (file_exists(lastmapspath)) { |
if (file_exists(lastmapspath)) { |
2144 |
delete_file(lastmapspath); |
delete_file(lastmapspath); |
2145 |
} |
} |
2146 |
new text[256], p; |
new text[256], p; |
2147 |
for (p = 0; p < bannedsofar; p++) { |
for (p = 0; p < bannedsofar; p++) { |
2148 |
format(text, 255, "%s", lastmaps[p]); |
formatex(text, 255, "%s", lastmaps[p]); |
2149 |
write_file(lastmapspath, text); |
write_file(lastmapspath, text); |
2150 |
} |
} |
2151 |
write_file(lastmapspath, "Generated by map_nominate plugin,"); |
write_file(lastmapspath, "Generated by map_nominate plugin,"); |
2156 |
|
|
2157 |
public load_maps() { |
public load_maps() { |
2158 |
new choicepath[64]; |
new choicepath[64]; |
2159 |
format(choicepath, 64, "%s/mapchoice.ini", custompath); |
formatex(choicepath, 63, "%s/mapchoice.ini", custompath); |
2160 |
new line = 0; |
new line = 0; |
2161 |
new stextsize = 0, isinlist, unable = 0, i; |
new stextsize = 0, isinlist, unable = 0, i; |
2162 |
new linestr[256]; |
new linestr[256]; |
2165 |
get_mapname(current_map, 31); |
get_mapname(current_map, 31); |
2166 |
if (file_exists(choicepath)) { |
if (file_exists(choicepath)) { |
2167 |
while (read_file(choicepath, line, linestr, 255, stextsize) && (num_nmapsfill < MAX_MAPS_AMOUNT)) { |
while (read_file(choicepath, line, linestr, 255, stextsize) && (num_nmapsfill < MAX_MAPS_AMOUNT)) { |
2168 |
format(maptext, 31, "%s", linestr); |
formatex(maptext, 31, "%s", linestr); |
2169 |
if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { |
if (is_map_valid(maptext) && !is_map_valid(maptext[1])) { |
2170 |
isinlist = 0; |
isinlist = 0; |
2171 |
if (isbanned(maptext) || islastmaps(maptext)) { |
if (isbanned(maptext) || islastmaps(maptext)) { |
2204 |
|
|
2205 |
public load_defaultmaps() { |
public load_defaultmaps() { |
2206 |
new standardpath[64]; |
new standardpath[64]; |
2207 |
format(standardpath, 64, "%s/standardmaps.ini", custompath); |
formatex(standardpath, 63, "%s/standardmaps.ini", custompath); |
2208 |
new i = 0; |
new i = 0; |
2209 |
new line = 0; |
new line = 0; |
2210 |
new stextsize = 0; |
new stextsize = 0; |
2215 |
usestandard = standardtotal = 0; |
usestandard = standardtotal = 0; |
2216 |
} else { |
} else { |
2217 |
while(read_file(standardpath, line, linestr, 255, stextsize) && i < 40) { |
while(read_file(standardpath, line, linestr, 255, stextsize) && i < 40) { |
2218 |
format(maptext, 31, "%s", linestr); |
formatex(maptext, 31, "%s", linestr); |
2219 |
if (is_map_valid(maptext)) { |
if (is_map_valid(maptext)) { |
2220 |
standard[i++] = maptext; |
standard[i++] = maptext; |
2221 |
} |
} |
2289 |
} |
} |
2290 |
switch(text[0]) { |
switch(text[0]) { |
2291 |
case 'r': { |
case 'r': { |
2292 |
format(percent, 4, "%s", text[2]); |
formatex(percent, 4, "%s", text[2]); |
2293 |
numpercent = float(str_to_num(percent)) / 100.0; |
numpercent = float(str_to_num(percent)) / 100.0; |
2294 |
if (numpercent >= 0.03 && numpercent <= 1.0) { |
if (numpercent >= 0.03 && numpercent <= 1.0) { |
2295 |
rtvpercent = numpercent; |
rtvpercent = numpercent; |
2310 |
} |
} |
2311 |
case 'f': { |
case 'f': { |
2312 |
if (text[1] == 'r') { |
if (text[1] == 'r') { |
2313 |
format(strwait2, 2, "%s", text[2]); |
formatex(strwait2, 2, "%s", text[2]); |
2314 |
waittime = str_to_num(strwait2); |
waittime = str_to_num(strwait2); |
2315 |
if (waittime >= 2 && waittime <= 20) { |
if (waittime >= 2 && waittime <= 20) { |
2316 |
frequency = waittime; |
frequency = waittime; |
2320 |
} |
} |
2321 |
} |
} |
2322 |
case 'b': { |
case 'b': { |
2323 |
format(strban, 3, "%s", text[2]); |
formatex(strban, 3, "%s", text[2]); |
2324 |
banamount = str_to_num(strban); |
banamount = str_to_num(strban); |
2325 |
if (banamount >= 0 && banamount <= 100) { |
if (banamount >= 0 && banamount <= 100) { |
2326 |
if ((banamount == 0 && text[2] == '0') || banamount > 0) { |
if ((banamount == 0 && text[2] == '0') || banamount > 0) { |
2330 |
} |
} |
2331 |
case 'm': { |
case 'm': { |
2332 |
if (atstart) { |
if (atstart) { |
2333 |
format(strnum, 2, "%s", text[2]); |
formatex(strnum, 2, "%s", text[2]); |
2334 |
mapsnum = str_to_num(strnum); |
mapsnum = str_to_num(strnum); |
2335 |
if (mapsnum >= 2 && mapsnum <= 8) { |
if (mapsnum >= 2 && mapsnum <= 8) { |
2336 |
maps_to_select = mapssave = mapsnum; |
maps_to_select = mapssave = mapsnum; |
2338 |
} |
} |
2339 |
} |
} |
2340 |
case 'p': { |
case 'p': { |
2341 |
format(strplay, 2, "%s", text[2]); |
formatex(strplay, 2, "%s", text[2]); |
2342 |
nplayers = str_to_num(strplay); |
nplayers = str_to_num(strplay); |
2343 |
if (nplayers > 0 && nplayers <= 32) { |
if (nplayers > 0 && nplayers <= 32) { |
2344 |
minimum = nplayers; |
minimum = nplayers; |
2345 |
} |
} |
2346 |
} |
} |
2347 |
case 'u': { |
case 'u': { |
2348 |
format(strurl, 63, "%s", text[2]); |
formatex(strurl, 63, "%s", text[2]); |
2349 |
if ((containi(strurl, "www") != -1 || containi(strurl, "http") != -1) && !equali(strurl, "http")) { |
if ((containi(strurl, "www") != -1 || containi(strurl, "http") != -1) && !equali(strurl, "http")) { |
2350 |
mapsurl = strurl; |
mapsurl = strurl; |
2351 |
} |
} |
2352 |
} |
} |
2353 |
case 'w': { |
case 'w': { |
2354 |
format(strwait, 2, "%s", text[2]); |
formatex(strwait, 2, "%s", text[2]); |
2355 |
waittime = str_to_num(strwait); |
waittime = str_to_num(strwait); |
2356 |
if (waittime >= 5 && waittime <= 30) { |
if (waittime >= 5 && waittime <= 30) { |
2357 |
minimumwait = waittime; |
minimumwait = waittime; |
2358 |
} |
} |
2359 |
} |
} |
2360 |
case 'x': { |
case 'x': { |
2361 |
format(strnum2, 2, "%s", text[2]); |
formatex(strnum2, 2, "%s", text[2]); |
2362 |
mapsnum = str_to_num(strnum2); |
mapsnum = str_to_num(strnum2); |
2363 |
if (mapsnum >= 1 && mapsnum <= 3) { |
if (mapsnum >= 1 && mapsnum <= 3) { |
2364 |
maxnom = mapsnum; |
maxnom = mapsnum; |
2365 |
} |
} |
2366 |
} |
} |
2367 |
case 'y': { |
case 'y': { |
2368 |
format(strnum2, 2, "%s", text[2]); |
formatex(strnum2, 2, "%s", text[2]); |
2369 |
mapsnum = str_to_num(strnum2); |
mapsnum = str_to_num(strnum2); |
2370 |
if (mapsnum >= 0 && mapsnum <= mapssave) { |
if (mapsnum >= 0 && mapsnum <= mapssave) { |
2371 |
maxcustnom = mapsnum; |
maxcustnom = mapsnum; |
2706 |
|
|
2707 |
public gen_maphelphtml() { |
public gen_maphelphtml() { |
2708 |
new path[64], text[128]; |
new path[64], text[128]; |
2709 |
format(path, 63, "%s/map_manage_help.htm", custompath); |
formatex(path, 63, "%s/map_manage_help.htm", custompath); |
2710 |
if (file_exists(path)) { |
if (file_exists(path)) { |
2711 |
delete_file(path); |
delete_file(path); |
2712 |
} |
} |
2713 |
format(text, 127, "%L", LANG_SERVER, "DMAP_HELP"); |
formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP"); |
2714 |
write_file(path, text); |
write_file(path, text); |
2715 |
format(text, 127, "%L", LANG_SERVER, "DMAP_HELP2"); |
formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP2"); |
2716 |
write_file(path, text); |
write_file(path, text); |
2717 |
format(text, 127, "%L", LANG_SERVER, "DMAP_HELP3"); |
formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP3"); |
2718 |
write_file(path, text); |
write_file(path, text); |
2719 |
format(text, 127, "%L", LANG_SERVER, "DMAP_HELP4"); |
formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP4"); |
2720 |
write_file(path, text); |
write_file(path, text); |
2721 |
format(text, 127, "%L", LANG_SERVER, "DMAP_HELP5"); |
formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP5"); |
2722 |
write_file(path, text); |
write_file(path, text); |
2723 |
format(text, 127, "%L", LANG_SERVER, "DMAP_HELP6"); |
formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP6"); |
2724 |
write_file(path, text); |
write_file(path, text); |
2725 |
format(text, 127, "%L", LANG_SERVER, "DMAP_HELP7"); |
formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP7"); |
2726 |
write_file(path, text); |
write_file(path, text); |
2727 |
format(text, 127, "%L", LANG_SERVER, "DMAP_HELP8"); |
formatex(text, 127, "%L", LANG_SERVER, "DMAP_HELP8"); |
2728 |
write_file(path, text); |
write_file(path, text); |
2729 |
} |
} |
2730 |
|
|
2731 |
public showmotdhelp(id) { |
public showmotdhelp(id) { |
2732 |
new header[80]; |
new header[80]; |
2733 |
new myversion[32]; |
new myversion[32]; |
2734 |
new helpfile[60]; |
new helpfile[64]; |
2735 |
format(helpfile, 60, "%s/map_manage_help.htm", custompath); |
formatex(helpfile, 63, "%s/map_manage_help.htm", custompath); |
2736 |
get_cvar_string("Deags_Map_Manage", myversion, 31); |
get_cvar_string("Deags_Map_Manage", myversion, 31); |
2737 |
format(header, 79, "%L", LANG_PLAYER, "DMAP_HELP9", myversion); |
formatex(header, 79, "%L", LANG_PLAYER, "DMAP_HELP9", myversion); |
2738 |
if (!file_exists(helpfile)) { |
if (!file_exists(helpfile)) { |
2739 |
gen_maphelphtml(); |
gen_maphelphtml(); |
2740 |
} |
} |
2823 |
|
|
2824 |
change_custom_path() { |
change_custom_path() { |
2825 |
new temp[64]; |
new temp[64]; |
2826 |
format(temp, 63, "%s/dmap", custompath); |
formatex(temp, 63, "%s/dmap", custompath); |
2827 |
if (dir_exists(temp)) { |
if (dir_exists(temp)) { |
2828 |
copy(custompath, 48, temp); |
copy(custompath, 48, temp); |
2829 |
} |
} |
2832 |
savesettings(myid) { |
savesettings(myid) { |
2833 |
|
|
2834 |
new settings[64]; |
new settings[64]; |
2835 |
format(settings, 64, "%s/mapvault.dat", custompath); |
formatex(settings, 63, "%s/mapvault.dat", custompath); |
2836 |
|
|
2837 |
if (file_exists(settings)) { |
if (file_exists(settings)) { |
2838 |
delete_file(settings); |
delete_file(settings); |
2839 |
} |
} |
2840 |
new text[32], text2[128], percent, success = 1, usedany = 0; |
new text[32], text2[128], percent, success = 1, usedany = 0; |
2841 |
format(text2, 127, ";To use comments simply use ;"); |
formatex(text2, 127, ";To use comments simply use ;"); |
2842 |
if (!write_file(settings,text2)) { |
if (!write_file(settings,text2)) { |
2843 |
success = 0; |
success = 0; |
2844 |
} |
} |
2845 |
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"); |
2846 |
|
|
2847 |
if (!write_file(settings, text2)) { |
if (!write_file(settings, text2)) { |
2848 |
success = 0; |
success = 0; |
2849 |
} |
} |
2850 |
format(text2, 127, ";If you delete this file, defaults will be restored."); |
formatex(text2, 127, ";If you delete this file, defaults will be restored."); |
2851 |
if (!write_file(settings, text2)) { |
if (!write_file(settings, text2)) { |
2852 |
success = 0; |
success = 0; |
2853 |
} |
} |
2854 |
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"); |
2855 |
if (!write_file(settings, text2)) { |
if (!write_file(settings, text2)) { |
2856 |
success = 0; |
success = 0; |
2857 |
} |
} |
2858 |
if (!enabled) { |
if (!enabled) { |
2859 |
format(text, 31, "d"); //d for disabled |
formatex(text, 31, "d"); //d for disabled |
2860 |
usedany = 1; |
usedany = 1; |
2861 |
if (!write_file(settings, text)) { |
if (!write_file(settings, text)) { |
2862 |
success = 0; |
success = 0; |
2864 |
} |
} |
2865 |
if (quiet != 0) { |
if (quiet != 0) { |
2866 |
if (quiet == 1) { |
if (quiet == 1) { |
2867 |
format(text, 31, "q1"); //d for disabled |
formatex(text, 31, "q1"); //d for disabled |
2868 |
} else { |
} else { |
2869 |
format(text, 31, "q2"); //d for disabled |
formatex(text, 31, "q2"); //d for disabled |
2870 |
} |
} |
2871 |
usedany = 1; |
usedany = 1; |
2872 |
if (!write_file(settings, text)) { |
if (!write_file(settings, text)) { |
2874 |
} |
} |
2875 |
} |
} |
2876 |
if (!dofreeze || !(cstrike_running() == 1)) { |
if (!dofreeze || !(cstrike_running() == 1)) { |
2877 |
format(text, 31, "f"); |
formatex(text, 31, "f"); |
2878 |
if (!write_file(settings, text)) { |
if (!write_file(settings, text)) { |
2879 |
success = 0; |
success = 0; |
2880 |
} |
} |
2881 |
} |
} |
2882 |
if (cycle) { |
if (cycle) { |
2883 |
format(text, 31, "c"); //c for Cycle mode=on |
formatex(text, 31, "c"); //c for Cycle mode=on |
2884 |
usedany = 1; |
usedany = 1; |
2885 |
if (!write_file(settings, text)) { |
if (!write_file(settings, text)) { |
2886 |
success = 0; |
success = 0; |
2888 |
} |
} |
2889 |
percent = floatround(rtvpercent * 100.0); |
percent = floatround(rtvpercent * 100.0); |
2890 |
if (percent >= 3 && percent <= 100) { |
if (percent >= 3 && percent <= 100) { |
2891 |
format(text, 31, "r %d", percent); |
formatex(text, 31, "r %d", percent); |
2892 |
usedany = 1; |
usedany = 1; |
2893 |
if (!write_file(settings, text)) { |
if (!write_file(settings, text)) { |
2894 |
success = 0; |
success = 0; |
2895 |
} |
} |
2896 |
} |
} |
2897 |
if (ban_last_maps >= 0 && ban_last_maps <= 100) { |
if (ban_last_maps >= 0 && ban_last_maps <= 100) { |
2898 |
format(text, 31, "b %d", ban_last_maps); |
formatex(text, 31, "b %d", ban_last_maps); |
2899 |
usedany = 1; |
usedany = 1; |
2900 |
if (!write_file(settings, text)) { |
if (!write_file(settings, text)) { |
2901 |
success = 0; |
success = 0; |
2902 |
} |
} |
2903 |
} |
} |
2904 |
if (mapssave >= 2 && mapssave <= 8) { |
if (mapssave >= 2 && mapssave <= 8) { |
2905 |
format(text, 31, "m %d", mapssave); |
formatex(text, 31, "m %d", mapssave); |
2906 |
usedany = 1; |
usedany = 1; |
2907 |
if (!write_file(settings, text)) { |
if (!write_file(settings, text)) { |
2908 |
success = 0; |
success = 0; |
2909 |
} |
} |
2910 |
} |
} |
2911 |
if (maxnom >= 0 && maxnom <= 3) { |
if (maxnom >= 0 && maxnom <= 3) { |
2912 |
format(text, 31, "x %d", maxnom); |
formatex(text, 31, "x %d", maxnom); |
2913 |
usedany = 1; |
usedany = 1; |
2914 |
if (!write_file(settings, text)) { |
if (!write_file(settings, text)) { |
2915 |
success = 0; |
success = 0; |
2916 |
} |
} |
2917 |
} |
} |
2918 |
if (maxcustnom >= 0 && maxcustnom <= mapssave) { |
if (maxcustnom >= 0 && maxcustnom <= mapssave) { |
2919 |
format(text, 31, "y %d", maxcustnom); |
formatex(text, 31, "y %d", maxcustnom); |
2920 |
usedany = 1; |
usedany = 1; |
2921 |
if (!write_file(settings, text)) { |
if (!write_file(settings, text)) { |
2922 |
success = 0; |
success = 0; |
2923 |
} |
} |
2924 |
} |
} |
2925 |
if (minimum > 0 && minimum <= 32) { |
if (minimum > 0 && minimum <= 32) { |
2926 |
format(text, 31, "p %d", minimum); |
formatex(text, 31, "p %d", minimum); |
2927 |
usedany = 1; |
usedany = 1; |
2928 |
if (!write_file(settings, text)) { |
if (!write_file(settings, text)) { |
2929 |
success = 0; |
success = 0; |
2930 |
} |
} |
2931 |
} |
} |
2932 |
if (minimumwait >= 5 && minimumwait <= 30) { |
if (minimumwait >= 5 && minimumwait <= 30) { |
2933 |
format(text, 31, "w %d", minimumwait); |
formatex(text, 31, "w %d", minimumwait); |
2934 |
usedany = 1; |
usedany = 1; |
2935 |
if (!write_file(settings, text)) { |
if (!write_file(settings, text)) { |
2936 |
success = 0; |
success = 0; |
2937 |
} |
} |
2938 |
} |
} |
2939 |
if (frequency >= 2 && frequency <= 20) { |
if (frequency >= 2 && frequency <= 20) { |
2940 |
format(text, 31, "fr %d", frequency); |
formatex(text, 31, "fr %d", frequency); |
2941 |
usedany = 1; |
usedany = 1; |
2942 |
if (!write_file(settings, text)) { |
if (!write_file(settings, text)) { |
2943 |
success = 0; |
success = 0; |
2944 |
} |
} |
2945 |
} |
} |
2946 |
if (containi(mapsurl, "www") != -1 || containi(mapsurl, "http") != -1) { |
if (containi(mapsurl, "www") != -1 || containi(mapsurl, "http") != -1) { |
2947 |
format(text2, 75, "u %s", mapsurl); |
formatex(text2, 75, "u %s", mapsurl); |
2948 |
usedany = 1; |
usedany = 1; |
2949 |
if (!write_file(settings, text2)) { |
if (!write_file(settings, text2)) { |
2950 |
success = 0; |
success = 0; |
3076 |
register_concmd("dmap_nominations", "dmapmaxnominations", ADMIN_SUPER_DMAP, "Set maximum number of nominations for each person"); |
register_concmd("dmap_nominations", "dmapmaxnominations", ADMIN_SUPER_DMAP, "Set maximum number of nominations for each person"); |
3077 |
register_concmd("dmap_maxcustom", "dmapmaxcustom", ADMIN_SUPER_DMAP, "Set maximum number of custom nominations that may be made"); |
register_concmd("dmap_maxcustom", "dmapmaxcustom", ADMIN_SUPER_DMAP, "Set maximum number of custom nominations that may be made"); |
3078 |
register_concmd("dmap_cancelvote", "dmapcancelvote", ADMIN_DMAP, "Cancels the rocked vote"); |
register_concmd("dmap_cancelvote", "dmapcancelvote", ADMIN_DMAP, "Cancels the rocked vote"); |
3079 |
|
register_concmd("dmap_nominate", "dmapnominate", ADMIN_DMAP, "Force nomination of a map by an admin"); |
3080 |
|
|
3081 |
register_logevent("event_RoundStart", 2, "0=World triggered", "1=Round_Start"); |
register_logevent("event_RoundStart", 2, "0=World triggered", "1=Round_Start"); |
3082 |
register_logevent("event_RoundEnd", 2, "0=World triggered", "1=Round_End"); |
register_logevent("event_RoundEnd", 2, "0=World triggered", "1=Round_End"); |
3130 |
set_task(1.0, "timer", 0, "curtime", 0, "b", 1); |
set_task(1.0, "timer", 0, "curtime", 0, "b", 1); |
3131 |
maps_to_select = mapssave = 5; |
maps_to_select = mapssave = 5; |
3132 |
new temparray[64]; |
new temparray[64]; |
3133 |
format(temparray, 64, "%s/mapvault.dat", custompath); |
formatex(temparray, 63, "%s/mapvault.dat", custompath); |
3134 |
if (!loadsettings(temparray)) { |
if (!loadsettings(temparray)) { |
3135 |
set_defaults(-1); |
set_defaults(-1); |
3136 |
} |
} |