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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 29 by cstrike, Thu Dec 11 21:59:28 2008 UTC revision 33 by cstrike, Tue Dec 30 01:00:33 2008 UTC
# Line 90  Line 90 
90  new nbeforefill;  new nbeforefill;
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:bIsCstrike;
94  new nnextmaps[10];  new nnextmaps[10];
95  new nvotes[12];         // Holds the number of votes for each map  new nvotes[12];         // Holds the number of votes for each map
96  new nmapstoch, before_num_nmapsfill = 0, bool:mselected = false;  new nmapstoch, before_num_nmapsfill = 0, bool:mselected = false;
# Line 101  Line 101 
101  new Nominated[MAX_MAPS_AMOUNT];         //?  new Nominated[MAX_MAPS_AMOUNT];         //?
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;  
105    new pDmapStrict;                // Pointer to dmap_strict
106    new pEmptyMap;                  // Pointer to amx_emptymap
107    new pEmptymapAllowed;           // Pointer to emptymap_allowed
108    new pEnforceTimelimit;          // Pointer to enforce_timelimit
109    new pExtendmapMax;              // Pointer to amx_extendmap_max
110    new pExtendmapStep;             // Pointer to amx_extendmap_step
111    new pIdleTime;                  // Pointer to amx_idletime"
112    new pNominationsAllowed;        // Pointer to nominations_allowed
113    new pShowActivity;              // Pointer to amx_show_activity
114    new pWeaponDelay;               // Pointer to weapon_delay
115    
116  new g_TotalVotes;               // Running total used to calculate percentages  new g_TotalVotes;               // Running total used to calculate percentages
117  new bool:g_AlreadyVoted[33];    // Keep track of who voted in current round  new bool:g_AlreadyVoted[33];    // Keep track of who voted in current round
118  new g_VoteTimeRemaining;        // Used to set duration of display of vote menu  new g_VoteTimeRemaining;        // Used to set duration of display of vote menu
# Line 111  Line 122 
122  forward bool:iscustommap(map[]);  forward bool:iscustommap(map[]);
123  forward bool:islastmaps(map[]);  forward bool:islastmaps(map[]);
124  forward bool:isnominated(map[]);  forward bool:isnominated(map[]);
125  forward public handle_nominate(id, map[]);  forward public handle_nominate(id, map[], bool:bForce);
126  forward available_maps();  forward available_maps();
127  forward public getready();  forward public getready();
128  forward public timetovote();  forward public timetovote();
# Line 263  Line 274 
274          } else {          } else {
275                  new i, noncounted, players = get_playersnum();                  new i, noncounted, players = get_playersnum();
276                  for (i = 1; i <= get_maxplayers(); i++) {                  for (i = 1; i <= get_maxplayers(); i++) {
277                          if ((get_user_time(i, 1) >= (get_pcvar_num(idletime) * 216000)) || is_user_bot(i) || is_user_hltv(i)) {                          if ((get_user_time(i, 1) >= (get_pcvar_num(pIdleTime) * 216000)) || is_user_bot(i) || is_user_hltv(i)) {
278                                  noncounted++;                                  noncounted++;
279                          }                          }
280                  }                  }
# Line 283  Line 294 
294    
295          new map[51], curmap[51];          new map[51], curmap[51];
296          get_mapname(curmap,50);          get_mapname(curmap,50);
297          get_pcvar_string(emptymap, map, 31);          get_pcvar_string(pEmptyMap, map, 31);
298    
299          if (get_pcvar_num(emptymap_allowed) == 1 && strlen(map) > 0) {          if (get_pcvar_num(pEmptymapAllowed) == 1 && strlen(map) > 0) {
300                  server_cmd("changelevel %s", map);                  server_cmd("changelevel %s", map);
301          }          }
302  }  }
# Line 363  Line 374 
374          new smap[32];          new smap[32];
375          get_cvar_string("amx_nextmap", smap, 31);          get_cvar_string("amx_nextmap", smap, 31);
376          if (minutesleft >= 2 && !mselected)          if (minutesleft >= 2 && !mselected)
377          if (get_pcvar_num(nominations_allowed) == 1) {          if (get_pcvar_num(pNominationsAllowed) == 1) {
378                  client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_SAY_NOMINATIONS",                  client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_SAY_NOMINATIONS",
379                    (minutesleft == 3 || minutesleft == 2) ? timeleft - 100 : minutesleft - 2, (minutesleft == 3 || minutesleft == 2) ? "sec." : "min.");                    (minutesleft == 3 || minutesleft == 2) ? timeleft - 100 : minutesleft - 2, (minutesleft == 3 || minutesleft == 2) ? "sec." : "min.");
380          } else {          } else {
# Line 559  Line 570 
570                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
571          }          }
572          if (!mselected) {          if (!mselected) {
573                  switch(get_cvar_num("amx_show_activity")) {                  switch(get_pcvar_num(pShowActivity)) {
574                          case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_VOTE_ROCKED_BY_ADMIN", kName);                          case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_VOTE_ROCKED_BY_ADMIN", kName);
575                          case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_RTV_USED_BY_ADMIN");                          case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_RTV_USED_BY_ADMIN");
576                  }                  }
577          } else {          } else {
578                  switch(get_cvar_num("amx_show_activity")) {                  switch(get_pcvar_num(pShowActivity)) {
579                          case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_REVOTE_BY_ADMIN", kName);                          case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_REVOTE_BY_ADMIN", kName);
580                          case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_REVOTE");                          case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_REVOTE");
581                  }                  }
# Line 597  Line 608 
608          if (nvotes[maps_to_select] > nvotes[b]) {          if (nvotes[maps_to_select] > nvotes[b]) {
609                  new mapname[32];                  new mapname[32];
610                  get_mapname(mapname, 31);                  get_mapname(mapname, 31);
611                  new Float:steptime = get_cvar_float("amx_extendmap_step");                  new Float:steptime = get_pcvar_float(pExtendmapStep);
612                  set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime);                  set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime);
613                  //oldtimelimit = get_cvar_float("mp_timelimit");                  //oldtimelimit = get_cvar_float("mp_timelimit");
614                  istimeset = 1;                  istimeset = 1;
# Line 630  Line 641 
641                                  show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_MAP_WINS", nmaps[nnextmaps[b]], nvotes[b], timeleft);                                  show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_MAP_WINS", nmaps[nnextmaps[b]], nvotes[b], timeleft);
642                          } else {                          } else {
643                                  set_hudmessage(0, 152, 255, -1.0, 0.22, 0, 4.0, 7.0, 2.1, 1.5, 4);                                  set_hudmessage(0, 152, 255, -1.0, 0.22, 0, 4.0, 7.0, 2.1, 1.5, 4);
644                                  if (get_cvar_float("enforce_timelimit") == 1.0 && is_cstrike) {                                  if (get_pcvar_float(pEnforceTimelimit) == 1.0 && bIsCstrike) {
645                                          show_hudmessage(0, "%L %L", LANG_PLAYER, "DMAP_MAP_WINS2", nmaps[nnextmaps[b]], nvotes[b], LANG_PLAYER, "DMAP_IN_SECONDS", timeleft);                                          show_hudmessage(0, "%L %L", LANG_PLAYER, "DMAP_MAP_WINS2", nmaps[nnextmaps[b]], nvotes[b], LANG_PLAYER, "DMAP_IN_SECONDS", timeleft);
646                                  } else {                                  } else {
647                                          show_hudmessage(0, "%L %L", LANG_PLAYER, "DMAP_MAP_WINS2", nmaps[nnextmaps[b]], nvotes[b], LANG_PLAYER, "DMAP_SHORTLY");                                          show_hudmessage(0, "%L %L", LANG_PLAYER, "DMAP_MAP_WINS2", nmaps[nnextmaps[b]], nvotes[b], LANG_PLAYER, "DMAP_SHORTLY");
# Line 720  Line 731 
731  }  }
732    
733  public RoundMode() {  public RoundMode() {
734          if (get_cvar_float("mp_timelimit") > 0.1 && get_cvar_num("enforce_timelimit")) {          if (get_cvar_float("mp_timelimit") > 0.1 && get_pcvar_num(pEnforceTimelimit)) {
735                  remove_task(333333);                  remove_task(333333);
736                  remove_task(454500);                  remove_task(454500);
737                  new timeleft = get_timeleft();                  new timeleft = get_timeleft();
# Line 733  Line 744 
744                  if (waited == 0) {                  if (waited == 0) {
745                          set_task(1.0, "show_timer");                          set_task(1.0, "show_timer");
746                  }                  }
747                  if (isbetween || isbuytime || (waited + addthiswait) > 190 || (!is_cstrike && (waited + addthiswait) >= 30) || activeplayers < 2) {     //Time to switch maps!!!!!!!!                  if (isbetween || isbuytime || (waited + addthiswait) > 190 || (!bIsCstrike && (waited + addthiswait) >= 30) || activeplayers < 2) {     //Time to switch maps!!!!!!!!
748                          remove_task(333333);                          remove_task(333333);
749                          remove_task(454500);                          remove_task(454500);
750                          if (isbetween) {                          if (isbetween) {
# Line 747  Line 758 
758                          if ((waited + addthiswait) <= 190 && get_timeleft() >= 0 && get_timeleft() <= 15) {                          if ((waited + addthiswait) <= 190 && get_timeleft() >= 0 && get_timeleft() <= 15) {
759                                  istimeset2 = 1;                                  istimeset2 = 1;
760                                  set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + 2.0);                                  set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + 2.0);
761                                  if (is_cstrike) {                                  if (bIsCstrike) {
762                                          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_FINISHING_CUR_ROUND");                                          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_FINISHING_CUR_ROUND");
763                                  }                                  }
764                          }                          }
# Line 813  Line 824 
824  }  }
825    
826  public dmapnominate(id, level, cid) {  public dmapnominate(id, level, cid) {
827          if (!cmd_access(id, level, cid, 1)) {          if (!cmd_access(id, level, cid, 2)) {
828                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
829          }          }
830          //  
831          //      TODO: Add some code..          new sArg1[32];
832          //          read_argv(1, sArg1, 31);
833    
834            handle_andchange(id, sArg1, true);      // Force nomination
835    
836          return PLUGIN_HANDLED;          return PLUGIN_HANDLED;
837  }  }
838    
# Line 1037  Line 1051 
1051  }  }
1052    
1053  public listnominations(id) {  public listnominations(id) {
1054          if (get_pcvar_num(nominations_allowed) == 1) {          if (get_pcvar_num(pNominationsAllowed) == 1) {
1055                  new a = 0, string3[512], string1[96], name1[33];                  new a = 0, string3[512], string1[96], name1[33];
1056                  if (a < nmaps_num) {                  if (a < nmaps_num) {
1057                          //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:");
# Line 1235  Line 1249 
1249          mselected = true;          mselected = true;
1250          inprogress = 1;          inprogress = 1;
1251          counttovote = 0;          counttovote = 0;
1252          if ((isbuytime || isbetween) && get_timeleft() && get_timeleft() > 54 && get_pcvar_num(weapon_delay)) {          if ((isbuytime || isbetween) && get_timeleft() && get_timeleft() > 54 && get_pcvar_num(pWeaponDelay)) {
1253                  client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_VOTING_DELAYED");                  client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_VOTING_DELAYED");
1254                  if (isbetween) {                  if (isbetween) {
1255                          set_task(15.0, "getready", 459100);                          set_task(15.0, "getready", 459100);
# Line 1251  Line 1265 
1265          remove_task(459100);          remove_task(459100);
1266    
1267          if (quiet != 2) {          if (quiet != 2) {
1268                  if (is_cstrike) {                  if (bIsCstrike) {
1269                          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_POSSIBLE_NOMINATIONS", nmaps_num, maps_to_select);                          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_POSSIBLE_NOMINATIONS", nmaps_num, maps_to_select);
1270                  }                  }
1271          }          }
# Line 1418  Line 1432 
1432  show_vote_menu(bool:bFirstTime) {  show_vote_menu(bool:bFirstTime) {
1433    
1434          new menu[512], a, mkeys = (1 << maps_to_select + 1);          new menu[512], a, mkeys = (1 << maps_to_select + 1);
1435          new Float:steptime = get_cvar_float("amx_extendmap_step");          new Float:steptime = get_pcvar_float(pExtendmapStep);
1436          new extendint = floatround(steptime);          new extendint = floatround(steptime);
1437    
1438          new pos;          new pos;
# Line 1431  Line 1445 
1445                  }                  }
1446          }          }
1447    
1448          if (cstrike_running() == 1) {          if (bIsCstrike) {
1449                  pos = formatex(menu, 511, "%L", LANG_SERVER, "DMAP_CS_MENU_TITLE");                  pos = formatex(menu, 511, "%L", LANG_SERVER, "DMAP_CS_MENU_TITLE");
1450          } else {          } else {
1451                  pos = formatex(menu, 511, "%L", LANG_SERVER, "DMAP_MENU_TITLE");                  pos = formatex(menu, 511, "%L", LANG_SERVER, "DMAP_MENU_TITLE");
# Line 1455  Line 1469 
1469                  }                  }
1470    
1471                  if (iscustommap(nmaps[nnextmaps[nmapstoch]]) && usestandard) {                  if (iscustommap(nmaps[nnextmaps[nmapstoch]]) && usestandard) {
1472                          if (cstrike_running() == 1) {                          if (bIsCstrike) {
1473                                  formatex(sMenuOption, 63, "%L", LANG_SERVER, "DMAP_CS_MENU_CUSTOM", nmapstoch + 1, nmaps[nnextmaps[nmapstoch]]);                                  formatex(sMenuOption, 63, "%L", LANG_SERVER, "DMAP_CS_MENU_CUSTOM", nmapstoch + 1, nmaps[nnextmaps[nmapstoch]]);
1474                          } else {                          } else {
1475                                  formatex(sMenuOption, 63, "%L", LANG_SERVER, "DMAP_MENU_CUSTOM", nmapstoch + 1, nmaps[nnextmaps[nmapstoch]]);                                  formatex(sMenuOption, 63, "%L", LANG_SERVER, "DMAP_MENU_CUSTOM", nmapstoch + 1, nmaps[nnextmaps[nmapstoch]]);
# Line 1496  Line 1510 
1510          }          }
1511          new mapname[32];          new mapname[32];
1512          get_mapname(mapname, 31);          get_mapname(mapname, 31);
1513          if (!mp_winlimit && get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max")) {          if (!mp_winlimit && get_cvar_float("mp_timelimit") < get_pcvar_float(pExtendmapMax)) {
1514                  formatex(sMenuOption, 63, "%L", LANG_SERVER, "DMAP_MENU_EXTEND", maps_to_select + 1, mapname, extendint);                  formatex(sMenuOption, 63, "%L", LANG_SERVER, "DMAP_MENU_EXTEND", maps_to_select + 1, mapname, extendint);
1515                  append_vote_percent(sMenuOption, maps_to_select, true);                  append_vote_percent(sMenuOption, maps_to_select, true);
1516                  pos += formatex(menu[pos], 511, sMenuOption);                  pos += formatex(menu[pos], 511, sMenuOption);
# Line 1513  Line 1527 
1527                  set_task(float(g_VoteTimeRemaining), "check_votes");                  set_task(float(g_VoteTimeRemaining), "check_votes");
1528                  show_menu(0, mkeys, menu, --g_VoteTimeRemaining);                  show_menu(0, mkeys, menu, --g_VoteTimeRemaining);
1529                  set_task(1.0, "update_vote_time_remaining", DMAP_TASKID_VTR, "", 0, "a", g_VoteTimeRemaining);                  set_task(1.0, "update_vote_time_remaining", DMAP_TASKID_VTR, "", 0, "a", g_VoteTimeRemaining);
1530                  if (is_cstrike) {                  if (bIsCstrike) {
1531                          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_TIME_TO_CHOOSE");                          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_TIME_TO_CHOOSE");
1532                  }                  }
1533                  if (quiet == 0) {                  if (quiet == 0) {
# Line 1545  Line 1559 
1559          new iPercent = percent(nvotes[iChoice], g_TotalVotes);          new iPercent = percent(nvotes[iChoice], g_TotalVotes);
1560          new sPercent[16];          new sPercent[16];
1561          if (iPercent > 0) {     // Don't show 0%          if (iPercent > 0) {     // Don't show 0%
1562                  if (cstrike_running() == 1) {                  if (bIsCstrike) {
1563                          formatex(sPercent, 15, " \d(%d%s)\w", iPercent, "%%");                          formatex(sPercent, 15, " \d(%d%s)\w", iPercent, "%%");
1564                  } else {                  } else {
1565                          formatex(sPercent, 15, " (%d%s)", iPercent, "%%");                          formatex(sPercent, 15, " (%d%s)", iPercent, "%%");
# Line 1567  Line 1581 
1581          return PLUGIN_HANDLED;          return PLUGIN_HANDLED;
1582  }  }
1583    
1584  public handle_andchange(id, map2[]) {  handle_andchange(id, map2[], bool:bForce = false) {
1585          new tester[32];          new tester[32];
1586          if (is_map_valid(map2) == 1) {          if (is_map_valid(map2) == 1) {
1587                  handle_nominate(id, map2);                  handle_nominate(id, map2, bForce);
1588          } else {          } else {
1589                  formatex(tester, 31, "cs_%s", map2);                  formatex(tester, 31, "cs_%s", map2);
1590                  if (is_map_valid(tester) == 1) {                  if (is_map_valid(tester) == 1) {
1591                          handle_nominate(id, tester);                          handle_nominate(id, tester, bForce);
1592                  } else {                  } else {
1593                          formatex(tester, 31, "de_%s", map2);                          formatex(tester, 31, "de_%s", map2);
1594                          if (is_map_valid(tester) == 1) {                          if (is_map_valid(tester) == 1) {
1595                                  handle_nominate(id, tester);                                  handle_nominate(id, tester, bForce);
1596                          } else {                          } else {
1597                                  formatex(tester, 31, "as_%s", map2);                                  formatex(tester, 31, "as_%s", map2);
1598                                  if (is_map_valid(tester) == 1) {                                  if (is_map_valid(tester) == 1) {
1599                                          handle_nominate(id, tester);                                          handle_nominate(id, tester, bForce);
1600                                  } else {                                  } else {
1601                                          formatex(tester, 31, "dod_%s", map2);                                          formatex(tester, 31, "dod_%s", map2);
1602                                          if (is_map_valid(tester) == 1) {                                          if (is_map_valid(tester) == 1) {
1603                                                  handle_nominate(id, tester);                                                  handle_nominate(id, tester, bForce);
1604                                          } else {                                          } else {
1605                                                  formatex(tester, 31, "fy_%s", map2);                                                  formatex(tester, 31, "fy_%s", map2);
1606                                                  if (is_map_valid(tester) == 1) {                                                  if (is_map_valid(tester) == 1) {
1607                                                          handle_nominate(id, tester);                                                          handle_nominate(id, tester, bForce);
1608                                                  } else {                                                  } else {                                // Send invalid map. handle_nominate() handles the error.
1609                                                          handle_nominate(id, map2);                                                          handle_nominate(id, map2, bForce);
1610                                                  }                                                  }
1611                                          }                                          }
1612                                  }                                  }
# Line 1617  Line 1631 
1631                  return PLUGIN_CONTINUE;                  return PLUGIN_CONTINUE;
1632          }          }
1633          if (containi(chat, "nominations") != -1) {          if (containi(chat, "nominations") != -1) {
1634                  if (get_pcvar_num(nominations_allowed) == 0) {                  if (get_pcvar_num(pNominationsAllowed) == 0) {
1635                          client_print(id, print_chat, "%L", id, "DMAP_NOMINATIONS_DISABLED");                          client_print(id, print_chat, "%L", id, "DMAP_NOMINATIONS_DISABLED");
1636                          return PLUGIN_HANDLED;                          return PLUGIN_HANDLED;
1637                  }                  }
# Line 1632  Line 1646 
1646                  }                  }
1647          } else {          } else {
1648                  if (containi(chat, "nominate ") == 1) {                  if (containi(chat, "nominate ") == 1) {
1649                          new mycommand[32];                          new mycommand[41];
1650                          read_args(mycommand, 32);                          read_args(mycommand, 40);
1651                          remove_quotes(mycommand);                          remove_quotes(mycommand);
1652                          handle_andchange(id, mycommand[9]);                          handle_andchange(id, mycommand[9]);
1653                  } else {                  } else {
1654                          if (containi(chat, "vote ") == 1) {                          if (containi(chat, "vote ") == 1) {
1655                                  new mycommand[32];                                  new mycommand[37];
1656                                  read_args(mycommand, 32);                                  read_args(mycommand, 36);
1657                                  remove_quotes(mycommand);                                  remove_quotes(mycommand);
1658                                  handle_andchange(id, mycommand[5]);                                  handle_andchange(id, mycommand[5]);
1659                          } else {                          } else {
1660                                  if (is_map_valid(saymap) == 1) {                                  if (is_map_valid(saymap) == 1) {
1661                                          handle_nominate(id, saymap);                                          handle_nominate(id, saymap, false);
1662                                  } else {                                  } else {
1663                                          formatex(chat2, 31, "cs_%s", saymap2);                                          formatex(chat2, 31, "cs_%s", saymap2);
1664                                          if (is_map_valid(chat2) == 1) {                                          if (is_map_valid(chat2) == 1) {
1665                                                  handle_nominate(id, chat2);                                                  handle_nominate(id, chat2, false);
1666                                          } else {                                          } else {
1667                                                  formatex(chat2, 31, "de_%s", saymap2);                                                  formatex(chat2, 31, "de_%s", saymap2);
1668                                                  if (is_map_valid(chat2) == 1) {                                                  if (is_map_valid(chat2) == 1) {
1669                                                          handle_nominate(id, chat2);                                                          handle_nominate(id, chat2, false);
1670                                                  } else {                                                  } else {
1671                                                          formatex(chat2, 31, "as_%s", saymap2);                                                          formatex(chat2, 31, "as_%s", saymap2);
1672                                                          if (is_map_valid(chat2) == 1) {                                                          if (is_map_valid(chat2) == 1) {
1673                                                                  handle_nominate(id, chat2);                                                                  handle_nominate(id, chat2, false);
1674                                                          } else {                                                          } else {
1675                                                                  formatex(chat2, 31, "dod_%s", saymap2);                                                                  formatex(chat2, 31, "dod_%s", saymap2);
1676                                                                  if (is_map_valid(chat2) == 1) {                                                                  if (is_map_valid(chat2) == 1) {
1677                                                                          handle_nominate(id, chat2);                                                                          handle_nominate(id, chat2, false);
1678                                                                  } else {                                                                  } else {
1679                                                                          formatex(chat2, 31, "fy_%s", saymap2);                                                                          formatex(chat2, 31, "fy_%s", saymap2);
1680                                                                          if (is_map_valid(chat2) == 1) {                                                                          if (is_map_valid(chat2) == 1) {
1681                                                                                  handle_nominate(id, chat2);                                                                                  handle_nominate(id, chat2, false);
1682                                                                          }                                                                          }
1683                                                                  }                                                                  }
1684                                                          }                                                          }
# Line 1688  Line 1702 
1702          }          }
1703  }  }
1704    
1705  public handle_nominate(id, map[]) {  public handle_nominate(id, map[], bool:bForce) {
1706          if (get_pcvar_num(nominations_allowed) == 0) {          if ((get_pcvar_num(pNominationsAllowed) == 0) && (bForce == false)) {
1707                  client_print(id, print_chat, "%L", id, "DMAP_NOMINATIONS_DISABLED");                  client_print(id, print_chat, "%L", id, "DMAP_NOMINATIONS_DISABLED");
1708                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1709          }          }
# Line 1717  Line 1731 
1731                  client_print(id, print_chat, "%L", id, "DMAP_MAP_NOTFOUND", map);                  client_print(id, print_chat, "%L", id, "DMAP_MAP_NOTFOUND", map);
1732                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1733          }          }
1734          if (isbanned(map)) {          if (isbanned(map) && (bForce == false)) {
1735                  client_print(id, print_chat, "%L", id, "DMAP_MAPVOTE_NOT_AVAILABLE");                  client_print(id, print_chat, "%L", id, "DMAP_MAPVOTE_NOT_AVAILABLE");
1736                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1737          }          }
1738          if (islastmaps(map) && !equali(map, current_map)) {          if (islastmaps(map) && !equali(map, current_map) && (bForce == false)) {
1739                  client_print(id, print_chat, "%L", id, "DMAP_CANT_NOMINATE_LASTMAP", ban_last_maps);                  client_print(id, print_chat, "%L", id, "DMAP_CANT_NOMINATE_LASTMAP", ban_last_maps);
1740                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1741          }          }
# Line 1730  Line 1744 
1744                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1745          }          }
1746          //Insert Strict Style code here, for pcvar dmap_strict 1          //Insert Strict Style code here, for pcvar dmap_strict 1
1747          if (get_pcvar_num(dmap_strict)) {          if (get_pcvar_num(pDmapStrict) && (bForce == false)) {
1748                  new isinthelist = 0;                  new isinthelist = 0;
1749                  for (new a = 0; a < totalmaps; a++) {                  for (new a = 0; a < totalmaps; a++) {
1750                          if (equali(map, listofmaps[a]))                          if (equali(map, listofmaps[a]))
# Line 1753  Line 1767 
1767                          if (equali(map, nmaps[i])) {                          if (equali(map, nmaps[i])) {
1768    
1769                                  new name[32];                                  new name[32];
1770                                  get_user_name(whonmaps_num[i], name, 32);                                  get_user_name(whonmaps_num[i], name, 31);
1771                                  if (quiet == 2) {                                  if (quiet == 2) {
1772                                          client_print(id, print_chat, "%L", id, "DMAP_ALREADY_NOMINATED", map, name);                                          client_print(id, print_chat, "%L", id, "DMAP_ALREADY_NOMINATED", map, name);
1773                                  } else {                                  } else {
# Line 1835  Line 1849 
1849          for (i = 0; i < nmaps_num; i++) {          for (i = 0; i < nmaps_num; i++) {
1850                  if (equali(map, nmaps[i])) {                  if (equali(map, nmaps[i])) {
1851                          new name[32];                          new name[32];
1852                          get_user_name(whonmaps_num[i], name, 32);                          get_user_name(whonmaps_num[i], name, 31);
1853    
1854                          client_print(id, print_chat, "%L", id, "DMAP_ALREADY_NOMINATED", map, name);                          client_print(id, print_chat, "%L", id, "DMAP_ALREADY_NOMINATED", map, name);
1855    
# Line 1851  Line 1865 
1865          }          }
1866    
1867          new name[32];          new name[32];
1868          get_user_name(id, name, 21);          get_user_name(id, name, 31);
1869          if (isreplacement == 1) {       //They are replacing their old map          if (isreplacement == 1) {       //They are replacing their old map
1870                  if (quiet == 2) {                  if (quiet == 2) {
1871                          client_print(id, print_chat, "%L", id, "DMAP_REPLACE_PREVIOUS_NOMINATION", nmaps[nmaps_num]);                          client_print(id, print_chat, "%L", id, "DMAP_REPLACE_PREVIOUS_NOMINATION", nmaps[nmaps_num]);
# Line 1883  Line 1897 
1897          } else {          } else {
1898                  nmaps_num = tempnmaps + 1;                  nmaps_num = tempnmaps + 1;
1899          }          }
1900            if ((bForce == true) && (get_pcvar_num(pShowActivity) > 0)) {
1901                    switch(get_pcvar_num(pShowActivity)) {
1902                            case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_ADMIN_NOMINATED_MAP1", map);
1903                            case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_ADMIN_NOMINATED_MAP2", name, map);
1904                    }
1905            } else {
1906          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_NOMINATED_MAP", name, map);          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_NOMINATED_MAP", name, map);
1907            }
1908    
1909          return PLUGIN_HANDLED;          return PLUGIN_HANDLED;
1910  }  }
# Line 2017  Line 2038 
2038                  line = 0;                  line = 0;
2039          }          }
2040    
2041          if (get_pcvar_float(dmap_strict) == 1.0) {          if (get_pcvar_float(pDmapStrict) == 1.0) {
2042                  get_cvar_string("mapcyclefile", pathtomaps, 63);                  get_cvar_string("mapcyclefile", pathtomaps, 63);
2043                  //pathtomaps = "mapcycle.txt";                  //pathtomaps = "mapcycle.txt";
2044          }          }
# Line 2378  Line 2399 
2399          minimumwait = 10;          minimumwait = 10;
2400          mapssave = maxcustnom = 5;          mapssave = maxcustnom = 5;
2401          mapsurl = "";          mapsurl = "";
2402          dofreeze = cstrike_running() == 1;          dofreeze = bIsCstrike;
2403    
2404          if (myid < 0) {          if (myid < 0) {
2405                  savesettings(-1);                  savesettings(-1);
# Line 2570  Line 2591 
2591                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
2592          }          }
2593    
2594          if (!cstrike_running()) {          if (!bIsCstrike) {
2595                  console_print(id, "Freeze is always off on non-Counter Strike Servers");                  console_print(id, "Freeze is always off on non-Counter Strike Servers");
2596                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
2597          }          }
# Line 2775  Line 2796 
2796    
2797                  console_print(id, "Players may nominate up to %d **Custom** maps each for the vote (dmap_maxcustom)", maxcustnom);                  console_print(id, "Players may nominate up to %d **Custom** maps each for the vote (dmap_maxcustom)", maxcustnom);
2798    
2799                  if (get_cvar_num("enforce_timelimit")) {                  if (get_pcvar_num(pEnforceTimelimit)) {
2800                          console_print(id, "^"Timeleft^" will be followed to change the maps, not allowing players to finish the round");                          console_print(id, "^"Timeleft^" will be followed to change the maps, not allowing players to finish the round");
2801                          console_print(id, "To change this, ask your server admin to set the cvar ^"enforce_timelimit^" to 0");                          console_print(id, "To change this, ask your server admin to set the cvar ^"enforce_timelimit^" to 0");
2802                  }                  }
# Line 2807  Line 2828 
2828          console_print(id, "------------------------------------------------------------------------------------------------");          console_print(id, "------------------------------------------------------------------------------------------------");
2829          console_print(id, "Commands     : dmap_status; dmap_cyclemode; dmap_votemode; dmap_quietmode <OFF|NOSOUND|SILENT>; ");          console_print(id, "Commands     : dmap_status; dmap_cyclemode; dmap_votemode; dmap_quietmode <OFF|NOSOUND|SILENT>; ");
2830          console_print(id, "Commands     : dmap_banlastmaps <n>; dmap_default ; dmap_mapsurl <url>; dmap_mapsnum <n>; dmap_maxcustom <n>;");          console_print(id, "Commands     : dmap_banlastmaps <n>; dmap_default ; dmap_mapsurl <url>; dmap_mapsnum <n>; dmap_maxcustom <n>;");
2831          console_print(id, "Commands     : dmap_rtvtoggle; dmap_rtvpercent <n>; dmap_rtvplayers <n>; dmap_rtvwait <n>");          console_print(id, "Commands: dmap_rtvtoggle; dmap_rtvpercent <n>; dmap_rtvplayers <n>; dmap_rtvwait <n>;");
2832          console_print(id, "Commands     : dmap_rockthevote; dmap_freeze; dmap_nominations <n>; dmap_messages <n(minutes)>");          console_print(id, "Commands: dmap_rockthevote; dmap_freeze; dmap_nominations <n>; dmap_messages <n(minutes)>;");
2833          console_print(id, "Cvars:         dmap_strict <0|1>, enforce_timelimit <0|1>; amx_extendmap_max <n>; amx_extendmap_step <n>");          console_print(id, "Cvars:    amx_emptymap <map>; amx_idletime <n>; amx_staytime <n>; dmap_strict <0|1>;");
2834            console_print(id, "Cvars:    emptymap_allowed <0|1>; enforce_timelimit <0|1>; amx_extendmap_max <n>; amx_extendmap_step <n>;");
2835            console_print(id, "Cvars:    nominations_allowed <0|1>; weapon_delay <0|1>");
2836          console_print(id, "-------------------------   use command dmap_help for more information   -----------------------");          console_print(id, "-------------------------   use command dmap_help for more information   -----------------------");
2837  }  }
2838    
# Line 2865  Line 2888 
2888                          success = 0;                          success = 0;
2889                  }                  }
2890          }          }
2891          if (!dofreeze || !(cstrike_running() == 1)) {          if (!dofreeze || !bIsCstrike) {
2892                  formatex(text, 31, "f");                  formatex(text, 31, "f");
2893                  if (!write_file(settings, text)) {                  if (!write_file(settings, text)) {
2894                          success = 0;                          success = 0;
# Line 3052  Line 3075 
3075          register_concmd("dmap_votemode", "dmapvotemode", ADMIN_SUPER_DMAP, "Enables Voting (This is default mode)");          register_concmd("dmap_votemode", "dmapvotemode", ADMIN_SUPER_DMAP, "Enables Voting (This is default mode)");
3076          register_concmd("dmap_cyclemode", "dmapcyclemode", ADMIN_SUPER_DMAP, "Disables Voting (To restore voting use dmap_votemode)");          register_concmd("dmap_cyclemode", "dmapcyclemode", ADMIN_SUPER_DMAP, "Disables Voting (To restore voting use dmap_votemode)");
3077          register_concmd("dmap_banlastmaps", "dmapbanlastmaps", ADMIN_SUPER_DMAP, "Bans the last <n> maps played from being voted (0-99)");          register_concmd("dmap_banlastmaps", "dmapbanlastmaps", ADMIN_SUPER_DMAP, "Bans the last <n> maps played from being voted (0-99)");
3078          register_concmd("dmap_quietmode", "dmapquiet", ADMIN_SUPER_DMAP, "Usage: <OFF|nosound|silent>");          register_concmd("dmap_quietmode", "dmapquiet", ADMIN_SUPER_DMAP, "Usage: <OFF|NOSOUND|SILENT>");
3079          register_concmd("dmap_freeze", "changefreeze", ADMIN_SUPER_DMAP, "Toggles Freeze/Drop at end of round ON|off");          register_concmd("dmap_freeze", "changefreeze", ADMIN_SUPER_DMAP, "Toggles Freeze/Drop at end of round ON|off");
3080          register_concmd("dmap_messages", "dmapmessages", ADMIN_SUPER_DMAP, "Sets the time interval in minutes between messages");          register_concmd("dmap_messages", "dmapmessages", ADMIN_SUPER_DMAP, "Sets the time interval in minutes between messages");
3081          register_concmd("dmap_rtvtoggle", "dmaprtvtoggle", ADMIN_SUPER_DMAP, "Toggles on|off Ability of players to use rockthevote");          register_concmd("dmap_rtvtoggle", "dmaprtvtoggle", ADMIN_SUPER_DMAP, "Toggles on|off Ability of players to use rockthevote");
# Line 3068  Line 3091 
3091          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");
3092          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");
3093          register_concmd("dmap_cancelvote", "dmapcancelvote", ADMIN_DMAP, "Cancels the rocked vote");          register_concmd("dmap_cancelvote", "dmapcancelvote", ADMIN_DMAP, "Cancels the rocked vote");
3094          register_concmd("dmap_nominate", "dmapnominate", ADMIN_DMAP, "Force nomination of a map by an admin");          register_concmd("dmap_nominate", "dmapnominate", ADMIN_DMAP, "<mapname> - Force nomination of a map by an admin");
3095    
3096          register_logevent("event_RoundStart", 2, "0=World triggered", "1=Round_Start");          register_logevent("event_RoundStart", 2, "0=World triggered", "1=Round_Start");
3097          register_logevent("event_RoundEnd", 2, "0=World triggered", "1=Round_End");          register_logevent("event_RoundEnd", 2, "0=World triggered", "1=Round_End");
# Line 3077  Line 3100 
3100  #if defined DEDICATED_LOG_ENABLED  #if defined DEDICATED_LOG_ENABLED
3101          get_time("dmaplog%m%d.log", logfilename, 255);          get_time("dmaplog%m%d.log", logfilename, 255);
3102  #endif  #endif
         dmap_strict = register_cvar("dmap_strict", "0");  
         nominations_allowed = register_cvar("nominations_allowed", "1");  
3103    
3104          register_cvar("enforce_timelimit", "0");          pDmapStrict = register_cvar("dmap_strict", "0");
3105          register_cvar("amx_extendmap_max", "90");          pEmptyMap = register_cvar("amx_emptymap", "de_dust2");
3106          register_cvar("amx_extendmap_step", "15");          pEmptymapAllowed = register_cvar("emptymap_allowed", "0");
3107          register_cvar("amx_staytime", "300");          pEnforceTimelimit = register_cvar("enforce_timelimit", "0");
3108            pExtendmapMax = register_cvar("amx_extendmap_max", "90");
3109          emptymap = register_cvar("amx_emptymap", "de_dust2");          pExtendmapStep = register_cvar("amx_extendmap_step", "15");
3110          idletime = register_cvar("amx_idletime", "5");          pIdleTime = register_cvar("amx_idletime", "5");
3111          emptymap_allowed = register_cvar("emptymap_allowed", "0");          pNominationsAllowed = register_cvar("nominations_allowed", "1");
3112          weapon_delay = register_cvar("weapon_delay", "1");          pShowActivity = register_cvar("amx_show_activity", "2");
3113            register_cvar("amx_staytime", "300");                   // No pointer; only used once
3114            pWeaponDelay = register_cvar("weapon_delay", "1");
3115    
3116          staytime = get_cvar_num("amx_staytime");          staytime = get_cvar_num("amx_staytime");
3117    
3118          is_cstrike = (cstrike_running() == 1);          bIsCstrike = (cstrike_running() == 1);
3119          nmaps_num = num_nmapsfill = 0;          nmaps_num = num_nmapsfill = 0;
3120    
3121          if (cstrike_running() == 1) {          if (bIsCstrike) {
3122                  register_cvar("Deags_Map_Manage", VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY);                  register_cvar("Deags_Map_Manage", VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY);
3123                  register_event("TeamScore", "team_score", "a");                  register_event("TeamScore", "team_score", "a");
3124          } else {          } else {

Legend:
Removed from v.29  
changed lines
  Added in v.33

Contact webmaster
ViewVC Help
Powered by ViewVC RSS 2.0 feed