/[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 45 by cstrike, Wed Feb 18 03:55:22 2009 UTC revision 51 by cstrike, Mon Jul 20 18:08:21 2009 UTC
# Line 50  Line 50 
50  #include <amxmisc>  #include <amxmisc>
51    
52  new const PLUGIN[]  = "DeagsMapManager";  new const PLUGIN[]  = "DeagsMapManager";
53  new const VERSION[] = "3.23";  new const VERSION[] = "3.23SVN";
54  new const AUTHOR[]  = "Deags/AMXX Community";  new const AUTHOR[]  = "Deags/AMXX Community";
55    #define DMAP_EXPECTED_DV 510
56    
57  // Comment out the following line to disable the dedicated log file  // Comment out the following line to disable the dedicated log file
58  #define DEDICATED_LOG_ENABLED  #define DEDICATED_LOG_ENABLED
# Line 64  Line 65 
65    
66  #define DMAP_VOTE_TIME 20               // Total time (in seconds) from vote start to checking votes  #define DMAP_VOTE_TIME 20               // Total time (in seconds) from vote start to checking votes
67    
68  #define DMAP_TASKID_VTR 10000           // Vote Time Remaining  // Task IDs
69  // non-DEFINE ids currently used:  #define DMAP_TASKID_TIMER               1010    //
70  // 123400, 123450, 123452, 127600(+id), 127600(+idreal),333333, 444444, 454500,  #define DMAP_TASKID_VTR                 1020    // Vote Time Remaining
71  // 454510, 459100, 459200, 765100, 986100, 986200, 987111, 987300, 987456  #define DMAP_TASKID_CONFLICT            1020    // Conflicting plugin/dictionary version message
72    #define DMAP_TASKID_TIME_DISPLAY        1030    // Show time left and next map
73    #define DMAP_TASKID_MSG_THREE           1040    // Show status or result of vote
74    #define DMAP_TASKID_ROCK_IT_NOW         1050    //
75    #define DMAP_TASKID_GET_READY           1060    //
76    #define DMAP_TASKID_ROUND_MODE          1070    //
77    #define DMAP_TASKID_TIME_DIS            1080    //
78    #define DMAP_TASKID_DELAYED_CHANGE      1090    //
79    #define DMAP_TASKID_COUNTDOWN           1100    //
80    #define DMAP_TASKID_FREEZE              1110    //
81    #define DMAP_TASKID_MSG_NOMINATED       1120    //
82    #define DMAP_TASKID_MSG_MAPS            1130    //
83    #define DMAP_TASKID_TIME_TO_VOTE        1140    //
84    #define DMAP_TASKID_ASK_FOR_NEXT        1150    //
85    #define DMAP_TASKID_LOOP_MESSAGES       1160    //
86    #define DMAP_TASKID_END_OF_ROUND        1170    //
87    // Task IDs below here are spaced 100 apart to allow for a range of IDs
88    #define DMAP_TASKID_MORE_LIST_MAPS      2000    // Timer to allow for delay in listing large number of maps
89    
90    
91  new maps_to_select, isbuytime = 0, isbetween = 0;  new maps_to_select, isbuytime = 0, isbetween = 0;
92  new ban_last_maps = 0, quiet = 0;       //quiet=0 (words and sounds) quiet=1 (words only, no sound) quiet=2 (no sound, no words)  new ban_last_maps = 0, quiet = 0;       //quiet=0 (words and sounds) quiet=1 (words only, no sound) quiet=2 (no sound, no words)
# Line 152  Line 171 
171          new partialtime = timeleft % 370;          new partialtime = timeleft % 370;
172          new maintime = timeleft % 600;          new maintime = timeleft % 600;
173          if ((maintime > 122 && maintime < 128) && timeleft > 114) {          if ((maintime > 122 && maintime < 128) && timeleft > 114) {
174                  set_task(1.0, "timedisplay", 454510, "", 0, "a", 5);                  set_task(1.0, "timedisplay", DMAP_TASKID_TIME_DISPLAY, "", 0, "a", 5);
175          }          }
176          if ((partialtime > 320 && partialtime < 326) && !cycle) {          if ((partialtime > 320 && partialtime < 326) && !cycle) {
177                  set_task(3.0, "messagethree", 987300);  //, "", 0, "a", 4)                  set_task(3.0, "messagethree", DMAP_TASKID_MSG_THREE);   //, "", 0, "a", 4)
178                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
179          }          }
180          return PLUGIN_HANDLED;          return PLUGIN_HANDLED;
# Line 166  Line 185 
185          new seconds = timeleft % 60;          new seconds = timeleft % 60;
186          new minutes = floatround((timeleft - seconds) / 60.0);          new minutes = floatround((timeleft - seconds) / 60.0);
187          if (timeleft < 1) {          if (timeleft < 1) {
188                  remove_task(454510);                  remove_task(DMAP_TASKID_TIME_DISPLAY);
189                  remove_task(454500);                  remove_task(DMAP_TASKID_TIME_DIS);
190                  remove_task(123452);                  remove_task(DMAP_TASKID_END_OF_ROUND);
                 remove_task(123499);  
191                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
192          }          }
193          if (timeleft > 140) {          if (timeleft > 140) {
194                  remove_task(454500);                  remove_task(DMAP_TASKID_TIME_DIS);
195          }          }
196          if (timeleft > 30) {          if (timeleft > 30) {
197                  set_hudmessage(255, 255, 220, 0.02, 0.2, 0, 1.0, 1.04, 0.0, 0.05, 3);                  set_hudmessage(255, 255, 220, 0.02, 0.2, 0, 1.0, 1.04, 0.0, 0.05, 3);
# Line 222  Line 240 
240  }  }
241    
242  public client_disconnect(id) {  public client_disconnect(id) {
243          remove_task(987600 + id);          remove_task(DMAP_TASKID_MORE_LIST_MAPS + id);
         remove_task(127600 + id);  
244          if (is_user_bot(id)) {          if (is_user_bot(id)) {
245                  return PLUGIN_CONTINUE;                  return PLUGIN_CONTINUE;
246          }          }
# Line 323  Line 340 
340                          console_print(id, "   %s", listofmaps[m]);                          console_print(id, "   %s", listofmaps[m]);
341                  }                  }
342          if (50 * (iteration + 1) < totalmaps) {          if (50 * (iteration + 1) < totalmaps) {
343                  new kIdfake[32];                  new kIdfake[6];
344                  num_to_str((id + 50 * (iteration + 1)), kIdfake, 31);                  num_to_str((id + 50 * (iteration + 1)), kIdfake, 5);
345                  client_print(id, print_console, "%L", id, "DMAP_LISTMAPS_MORE");                  client_print(id, print_console, "%L", id, "DMAP_LISTMAPS_MORE");
346                  set_task(4.0, "more_list_maps", 127600 + id, kIdfake, 6);                  set_task(4.0, "more_list_maps", DMAP_TASKID_MORE_LIST_MAPS + id, kIdfake, 6);
347          }          }
348          return PLUGIN_CONTINUE;          return PLUGIN_CONTINUE;
349  }  }
# Line 361  Line 378 
378                  new kIdfake[32];                  new kIdfake[32];
379                  num_to_str((idreal + 50 * (iteration + 1)), kIdfake, 31);                  num_to_str((idreal + 50 * (iteration + 1)), kIdfake, 31);
380                  client_print(idreal, print_console, "%L", idreal, "DMAP_LISTMAPS_MORE");                  client_print(idreal, print_console, "%L", idreal, "DMAP_LISTMAPS_MORE");
381                  set_task(2.0, "more_list_maps", 127600 + idreal, kIdfake, 6);                  set_task(2.0, "more_list_maps", DMAP_TASKID_MORE_LIST_MAPS + idreal, kIdfake, 6);
382          } else {        //Base case has been reached          } else {        //Base case has been reached
383                  client_print(idreal, print_console, "%L", idreal, "DMAP_LISTMAPS_FINISHED", totalmaps);                  client_print(idreal, print_console, "%L", idreal, "DMAP_LISTMAPS_FINISHED", totalmaps);
384          }          }
# Line 408  Line 425 
425                          hasbeenrocked = 1;                          hasbeenrocked = 1;
426                          inprogress = 1;                          inprogress = 1;
427                          mselected = false;                          mselected = false;
428                          set_task(10.0, "rock_it_now", 765100);                          set_task(10.0, "rock_it_now", DMAP_TASKID_ROCK_IT_NOW);
429                  }                  }
430          }          }
431  }  }
# Line 480  Line 497 
497                  hasbeenrocked = 1;                  hasbeenrocked = 1;
498                  inprogress = 1;                  inprogress = 1;
499                  mselected = false;                  mselected = false;
500                  set_task(15.0, "rock_it_now", 765100);                  set_task(15.0, "rock_it_now", DMAP_TASKID_ROCK_IT_NOW);
501          } else {          } else {
502                  client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_RTV_NEEDED", ((needed-rocks) > (minimum-needed)) ? (needed-rocks) : (minimum-rocks));                  client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_RTV_NEEDED", ((needed-rocks) > (minimum-needed)) ? (needed-rocks) : (minimum-rocks));
503          }          }
# Line 496  Line 513 
513          new Float:minutesplayed = currentlimit-minutesleft;          new Float:minutesplayed = currentlimit-minutesleft;
514          new Float:timelimit;          new Float:timelimit;
515          counttovote = 0;          counttovote = 0;
516          remove_task(459200);          remove_task(DMAP_TASKID_TIME_TO_VOTE);
517          remove_task(459100);          remove_task(DMAP_TASKID_GET_READY);
518          timelimit = float(floatround(minutesplayed + 1.5));          timelimit = float(floatround(minutesplayed + 1.5));
519          if (timelimit > 0.4) {          if (timelimit > 0.4) {
520                  oldtimelimit = get_cvar_float("mp_timelimit");                  oldtimelimit = get_cvar_float("mp_timelimit");
# Line 535  Line 552 
552          if (quiet == 0) {          if (quiet == 0) {
553                  client_cmd(0, "spk ^"get red(e80) ninety(s45) to check(e20) use _comma(e10) bay(s18) mass(e42) cap(s50)^"");                  client_cmd(0, "spk ^"get red(e80) ninety(s45) to check(e20) use _comma(e10) bay(s18) mass(e42) cap(s50)^"");
554          }          }
555          set_task(3.5, "getready", 459100);          set_task(3.5, "getready", DMAP_TASKID_GET_READY);
556          set_task(10.0, "startthevote");          set_task(10.0, "startthevote");
557          remove_task(454500);          remove_task(DMAP_TASKID_TIME_DIS);
558          remove_task(123452);          remove_task(DMAP_TASKID_END_OF_ROUND);
559          rocks = 0;          rocks = 0;
560          new inum, players[32], i;          new inum, players[32], i;
561          get_players(players, inum, "c");          get_players(players, inum, "c");
# Line 582  Line 599 
599                          case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_REVOTE");                          case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_REVOTE");
600                  }                  }
601          }          }
602          remove_task(123450);          remove_task(DMAP_TASKID_FREEZE);
603          remove_task(123400);          remove_task(DMAP_TASKID_COUNTDOWN);
604          remove_task(123452);          remove_task(DMAP_TASKID_END_OF_ROUND);
         remove_task(123499);  
605          counttovote = 0;          counttovote = 0;
606          remove_task(459200);          remove_task(DMAP_TASKID_TIME_TO_VOTE);
607          remove_task(459100);          remove_task(DMAP_TASKID_GET_READY);
608  #if defined DEDICATED_LOG_ENABLED  #if defined DEDICATED_LOG_ENABLED
609          log_to_file(logfilename, "Admin: <%s> calls rockthevote with %d seconds left on map", kName, timeleft);          log_to_file(logfilename, "Admin: <%s> calls rockthevote with %d seconds left on map", kName, timeleft);
610  #endif  #endif
611          inprogress = 1;          inprogress = 1;
612          mselected = false;          mselected = false;
613          set_task(15.0, "rock_it_now", 765100);          set_task(15.0, "rock_it_now", DMAP_TASKID_ROCK_IT_NOW);
614          set_task(0.18, "calculate_custom");          set_task(0.18, "calculate_custom");
615          return PLUGIN_HANDLED;          return PLUGIN_HANDLED;
616  }  }
# Line 640  Line 656 
656                  if (quiet != 2) {                  if (quiet != 2) {
657                          if (timeleft <= 0 || timeleft > 300) {                          if (timeleft <= 0 || timeleft > 300) {
658                                  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);
659                                  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]);
660                          } else {                          } else {
661                                  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);
662                                  if (get_pcvar_float(pEnforceTimelimit) == 1.0 && bIsCstrike) {                                  if (get_pcvar_float(pEnforceTimelimit) == 1.0 && bIsCstrike) {
# Line 671  Line 687 
687          inprogress = waited = 0;          inprogress = waited = 0;
688          isend = 1;          isend = 1;
689          //WE ARE near END OF MAP; time to invoke Round mode ALgorithm          //WE ARE near END OF MAP; time to invoke Round mode ALgorithm
690          //set_task(2.0, "endofround", 123452, "", 0, "b");          //set_task(2.0, "endofround", DMAP_TASKID_END_OF_ROUND, "", 0, "b");
691          new waituntilready = timeleft - 60;          new waituntilready = timeleft - 60;
692          if (waituntilready > 30) {          if (waituntilready > 30) {
693                  waituntilready = 30;                  waituntilready = 30;
694          }          }
695          if (waituntilready <= 0 || get_cvar_num("mp_winlimit")) {          if (waituntilready <= 0 || get_cvar_num("mp_winlimit")) {
696                  addthiswait = 4;                  addthiswait = 4;
697                  set_task(4.0, "RoundMode", 333333);                  set_task(4.0, "RoundMode", DMAP_TASKID_ROUND_MODE);
698          } else {          } else {
699                  set_task(float(waituntilready), "RoundMode", 333333);                  set_task(float(waituntilready), "RoundMode", DMAP_TASKID_ROUND_MODE);
700                  addthiswait = waituntilready;                  addthiswait = waituntilready;
701          }          }
702          nmaps_num = nbeforefill;          nmaps_num = nbeforefill;
# Line 690  Line 706 
706  }  }
707    
708  public show_timer() {  public show_timer() {
709          set_task(1.0, "timedis2", 454500, "", 0, "b");          set_task(1.0, "timedis2", DMAP_TASKID_TIME_DIS, "", 0, "b");
710  }  }
711    
712  public timedis2() {  public timedis2() {
# Line 734  Line 750 
750    
751  public RoundMode() {  public RoundMode() {
752          if (get_cvar_float("mp_timelimit") > 0.1 && get_pcvar_num(pEnforceTimelimit)) {          if (get_cvar_float("mp_timelimit") > 0.1 && get_pcvar_num(pEnforceTimelimit)) {
753                  remove_task(333333);                  remove_task(DMAP_TASKID_ROUND_MODE);
754                  remove_task(454500);                  remove_task(DMAP_TASKID_TIME_DIS);
755                  new timeleft = get_timeleft();                  new timeleft = get_timeleft();
756                  if (timeleft < 200) {                  if (timeleft < 200) {
757                          set_task(float(timeleft) - 5.8, "endofround");                          set_task(float(timeleft) - 5.8, "endofround");
758                          set_task(1.0, "timedis3", 454500, "", 0, "b");                          set_task(1.0, "timedis3", DMAP_TASKID_TIME_DIS, "", 0, "b");
759                  }                  }
760                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
761          } else {          } else {
# Line 747  Line 763 
763                          set_task(1.0, "show_timer");                          set_task(1.0, "show_timer");
764                  }                  }
765                  if (isbetween || isbuytime || (waited + addthiswait) > 190 || (!bIsCstrike && (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!!!!!!!!
766                          remove_task(333333);                          remove_task(DMAP_TASKID_ROUND_MODE);
767                          remove_task(454500);                          remove_task(DMAP_TASKID_TIME_DIS);
768                          if (isbetween) {                          if (isbetween) {
769                                  set_task(3.9, "endofround");                                  set_task(3.9, "endofround");
770                          } else {                          } else {
# Line 764  Line 780 
780                                          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_FINISHING_CUR_ROUND");                                          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_FINISHING_CUR_ROUND");
781                                  }                                  }
782                          }                          }
783                          set_task(5.0, "RoundMode", 333333);                          set_task(5.0, "RoundMode", DMAP_TASKID_ROUND_MODE);
784                  }                  }
785          }          }
786          return PLUGIN_HANDLED;          return PLUGIN_HANDLED;
# Line 802  Line 818 
818          if (!cmd_access(id, level, cid, 0)) {          if (!cmd_access(id, level, cid, 0)) {
819                  return PLUGIN_HANDLED ;                  return PLUGIN_HANDLED ;
820          }          }
821          if (task_exists(765100, 1)) {          if (task_exists(DMAP_TASKID_ROCK_IT_NOW, 1)) {
822                  new authid[32], name[32];                  new authid[32], name[32];
823    
824                  get_user_authid(id, authid, 31) ;                  get_user_authid(id, authid, 31) ;
# Line 811  Line 827 
827                  log_to_file(logfilename, "ADMIN <%s> cancelled the map vote.", name);                  log_to_file(logfilename, "ADMIN <%s> cancelled the map vote.", name);
828  #endif  #endif
829                  client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_ADMIN_CANCELLED", name);                  client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_ADMIN_CANCELLED", name);
830                  remove_task(765100, 1);                  remove_task(DMAP_TASKID_ROCK_IT_NOW, 1);
831                  set_hudmessage(222, 70,0, -1.0, 0.3, 1, 10.0, 10.0, 2.0, 4.0, 8);                  set_hudmessage(222, 70,0, -1.0, 0.3, 1, 10.0, 10.0, 2.0, 4.0, 8);
832                  show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_ADMIN_CANCELLED", name);                  show_hudmessage(0, "%L", LANG_PLAYER, "DMAP_ADMIN_CANCELLED", name);
833                  hasbeenrocked = 0;                  hasbeenrocked = 0;
# Line 860  Line 876 
876                  }                  }
877          }          }
878          //If we are unable to achieve automatic level change, FORCE it.          //If we are unable to achieve automatic level change, FORCE it.
879          set_task(2.1, "DelayedChange", 444444);          set_task(2.1, "DelayedChange", DMAP_TASKID_DELAYED_CHANGE);
880  }  }
881    
882  public changeMap() {    //Default event copied from nextmap.amx, and changed around.  public changeMap() {    //Default event copied from nextmap.amx, and changed around.
883          set_cvar_float("mp_chattime", 3.0);     // make sure mp_chattime is long          set_cvar_float("mp_chattime", 3.0);     // make sure mp_chattime is long
884          remove_task(444444);          remove_task(DMAP_TASKID_DELAYED_CHANGE);
885          set_task(1.85, "DelayedChange");          set_task(1.85, "DelayedChange");
886  }  }
887    
# Line 876  Line 892 
892  }  }
893    
894  public endofround() {   //Call when ready to switch maps in (?) seconds  public endofround() {   //Call when ready to switch maps in (?) seconds
895          remove_task(123452);          remove_task(DMAP_TASKID_END_OF_ROUND);
896          remove_task(987111);          remove_task(DMAP_TASKID_LOOP_MESSAGES);
897          remove_task(333333);          remove_task(DMAP_TASKID_ROUND_MODE);
898          remove_task(454510);          remove_task(DMAP_TASKID_TIME_DISPLAY);
899          remove_task(454500);          remove_task(DMAP_TASKID_TIME_DIS);
         remove_task(123499);  
900          new smap[32];          new smap[32];
901          get_cvar_string("amx_nextmap", smap, 31);          get_cvar_string("amx_nextmap", smap, 31);
902          set_task(6.0, "levelchange");   //used to be 7.0          set_task(6.0, "levelchange");   //used to be 7.0
903          if (quiet != 2) {          if (quiet != 2) {
904                  countnum = 0;                  countnum = 0;
905                  set_task(1.0, "countdown", 123400, "", 0, "a", 6);                  set_task(1.0, "countdown", DMAP_TASKID_COUNTDOWN, "", 0, "a", 6);
906                  if (quiet != 1) {                  if (quiet != 1) {
907                          client_cmd(0, "speak ^"loading environment on to your computer^"");                          client_cmd(0, "speak ^"loading environment on to your computer^"");
908                  }                  }
# Line 912  Line 927 
927                  }                  }
928          }          }
929          if (dofreeze) {          if (dofreeze) {
930                  set_task(1.1, "stopperson", 123450, "", 0, "a", 2);                  set_task(1.1, "stopperson", DMAP_TASKID_FREEZE, "", 0, "a", 2);
931          }          }
932          return PLUGIN_HANDLED;          return PLUGIN_HANDLED;
933  }  }
# Line 951  Line 966 
966          }          }
967          //if (parttime > 310 && parttime < 326 && timeleft > 132)          //if (parttime > 310 && parttime < 326 && timeleft > 132)
968          if (parttime > (40 + addition) && parttime < (56 + addition) && timeleft > 132) {          if (parttime > (40 + addition) && parttime < (56 + addition) && timeleft > 132) {
969                  set_task(3.0, "messagenominated", 986100);      //, "", 0, "a", 4)                  set_task(3.0, "messagenominated", DMAP_TASKID_MSG_NOMINATED);   //, "", 0, "a", 4)
970          } else {          } else {
971                  //if (parttime > 155 && parttime < 171 && timeleft > 132)                  //if (parttime > 155 && parttime < 171 && timeleft > 132)
972                  if (parttime > 30 && parttime < 46 && timeleft > 132) {                  if (parttime > 30 && parttime < 46 && timeleft > 132) {
973                          set_task(10.0, "messagemaps", 986200, "", 0, "a", 1);                          set_task(10.0, "messagemaps", DMAP_TASKID_MSG_MAPS, "", 0, "a", 1);
974                  } else if (timeleft >= 117 && timeleft < 132) {                  } else if (timeleft >= 117 && timeleft < 132) {
975                          messagefifteen();                          messagefifteen();
976                  }                  }
# Line 1123  Line 1138 
1138          if (quiet == 0) {          if (quiet == 0) {
1139                  client_cmd(0, "spk ^"get red(e80) ninety(s45) to check(e20) use bay(s18) mass(e42) cap(s50)^"");                  client_cmd(0, "spk ^"get red(e80) ninety(s45) to check(e20) use bay(s18) mass(e42) cap(s50)^"");
1140          }          }
1141          set_task(8.7, "getready", 459100);          set_task(8.7, "getready", DMAP_TASKID_GET_READY);
1142          return PLUGIN_HANDLED;          return PLUGIN_HANDLED;
1143  }  }
1144    
1145  public getready() {  public getready() {
1146          if (!cycle) {          if (!cycle) {
1147                  set_task(0.93, "timetovote", 459200, "", 0, "a", 5);                  set_task(0.93, "timetovote", DMAP_TASKID_TIME_TO_VOTE, "", 0, "a", 5);
1148          }          }
1149  }  }
1150    
# Line 1139  Line 1154 
1154    
1155          if (get_timeleft() > 132 || counttovote > 5 || cycle || isbuytime) {          if (get_timeleft() > 132 || counttovote > 5 || cycle || isbuytime) {
1156                  counttovote = 0;                  counttovote = 0;
1157                  remove_task(459200);                  remove_task(DMAP_TASKID_TIME_TO_VOTE);
1158                  remove_task(459100);                  remove_task(DMAP_TASKID_GET_READY);
1159                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1160          } else {          } else {
1161                  if (counttovote > 0 && counttovote <= 5) {                  if (counttovote > 0 && counttovote <= 5) {
# Line 1187  Line 1202 
1202          }          }
1203          if (timeleft > 300) {          if (timeleft > 300) {
1204                  isend = 0;                  isend = 0;
1205                  remove_task(123452);                  remove_task(DMAP_TASKID_END_OF_ROUND);
1206          }          }
1207          new mp_winlimit = get_cvar_num("mp_winlimit");          new mp_winlimit = get_cvar_num("mp_winlimit");
1208          if (mp_winlimit) {          if (mp_winlimit) {
1209                  new s = mp_winlimit - 2;                  new s = mp_winlimit - 2;
1210                  if ((s > teamscore[0] && s > teamscore[1]) && (timeleft > 114 || timeleft < 1)) {                  if ((s > teamscore[0] && s > teamscore[1]) && (timeleft > 114 || timeleft < 1)) {
1211                          remove_task(454500);                          remove_task(DMAP_TASKID_TIME_DIS);
1212                          mselected = false;                          mselected = false;
1213                          return PLUGIN_HANDLED;                          return PLUGIN_HANDLED;
1214                  }                  }
1215          } else {          } else {
1216                  if (timeleft > 114 || timeleft < 1) {                  if (timeleft > 114 || timeleft < 1) {
1217                            remove_task(DMAP_TASKID_TIME_DIS);
1218                          if (timeleft > 135) {                          if (timeleft > 135) {
1219                                  remove_task(454510);                                  remove_task(DMAP_TASKID_TIME_DISPLAY);
                                 remove_task(454500);  
                                 remove_task(123499);  
                         } else {  
                                 remove_task(454500);  
1220                          }                          }
1221                          mselected = false;                          mselected = false;
1222                          return PLUGIN_HANDLED;                          return PLUGIN_HANDLED;
# Line 1222  Line 1234 
1234                          if (quiet != 1) {                          if (quiet != 1) {
1235                                  client_cmd(0, "spk ^"get red(e80) ninety(s45) to check(e20) use bay(s18) mass(e42) cap(s50)^"");                                  client_cmd(0, "spk ^"get red(e80) ninety(s45) to check(e20) use bay(s18) mass(e42) cap(s50)^"");
1236                          }                          }
1237                          set_task(4.2, "getready", 459100);                          set_task(4.2, "getready", DMAP_TASKID_GET_READY);
1238                          set_task(10.0, "startthevote");                          set_task(10.0, "startthevote");
1239                  } else {                  } else {
1240                          set_task(1.0, "startthevote");                          set_task(1.0, "startthevote");
# Line 1238  Line 1250 
1250          if (cycle) {          if (cycle) {
1251                  inprogress = 0;                  inprogress = 0;
1252                  mselected = false;                  mselected = false;
1253                  remove_task(459200);                  remove_task(DMAP_TASKID_TIME_TO_VOTE);
1254                  remove_task(459100);                  remove_task(DMAP_TASKID_GET_READY);
1255                  new smap[32];                  new smap[32];
1256                  get_cvar_string("amx_nextmap", smap, 31);                  get_cvar_string("amx_nextmap", smap, 31);
1257                  client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_NEXTMAP2", smap);                  client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_NEXTMAP2", smap);
# Line 1254  Line 1266 
1266          if ((isbuytime || isbetween) && get_timeleft() && get_timeleft() > 54 && get_pcvar_num(pWeaponDelay)) {          if ((isbuytime || isbetween) && get_timeleft() && get_timeleft() > 54 && get_pcvar_num(pWeaponDelay)) {
1267                  client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_VOTING_DELAYED");                  client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_VOTING_DELAYED");
1268                  if (isbetween) {                  if (isbetween) {
1269                          set_task(15.0, "getready", 459100);                          set_task(15.0, "getready", DMAP_TASKID_GET_READY);
1270                          set_task(21.0, "startthevote");                          set_task(21.0, "startthevote");
1271                  } else {                  } else {
1272                          set_task(8.0, "getready", 459100);                          set_task(8.0, "getready", DMAP_TASKID_GET_READY);
1273                          set_task(14.0, "startthevote");                          set_task(14.0, "startthevote");
1274                  }                  }
1275                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1276          }       //else startthevote anyways..., regardless of buytime          }       //else startthevote anyways..., regardless of buytime
1277    
1278          remove_task(459200);          remove_task(DMAP_TASKID_TIME_TO_VOTE);
1279          remove_task(459100);          remove_task(DMAP_TASKID_GET_READY);
1280    
1281          if (quiet != 2) {          if (quiet != 2) {
1282                  if (bIsCstrike) {                  if (bIsCstrike) {
# Line 2080  Line 2092 
2092                                  formatex(maptext, 31, "%s", linestr);                                  formatex(maptext, 31, "%s", linestr);
2093                                  if (is_map_valid(maptext) && !is_map_valid(maptext[1])) {                                  if (is_map_valid(maptext) && !is_map_valid(maptext[1])) {
2094                                          isinthislist = 0;                                          isinthislist = 0;
2095                                          for (p = 0; p < i; p++)                                          for (p = 0; p < i; p++) {
2096                                                  if (equali(maptext, listofmaps[p])) {                                                  if (equali(maptext, listofmaps[p])) {
2097                                                          isinthislist = 1;                                                          isinthislist = 1;
2098                                                  }                                                  }
2099                                            }
2100                                          if (!isinthislist) {                                          if (!isinthislist) {
2101                                                  listofmaps[i++] = maptext;                                                  listofmaps[i++] = maptext;
2102                                          }                                          }
# Line 3059  Line 3072 
3072          messagenominated();          messagenominated();
3073  }  }
3074    
3075    public listmaps_override(id) {
3076            //TODO: if some cvar = 0 then return
3077            list_maps(id);
3078            return PLUGIN_HANDLED;
3079    }
3080    
3081    public check_conflict() {
3082            new sDV[8], iDV, bRepeat;
3083    
3084            //repeat error over and over..
3085            if (is_plugin_loaded("Nextmap Chooser") > -1) {
3086                    bRepeat = true;
3087                    announce_conflict("mapchooser.amxx");
3088            }
3089            if (is_plugin_loaded("NextMap") > -1) {
3090                    bRepeat = true;
3091                    announce_conflict("nextmap.amxx");
3092            }
3093            if (is_plugin_loaded("Galileo") > -1) {
3094                    bRepeat = true;
3095                    announce_conflict("galileo.amxx");
3096            }
3097            if (is_plugin_loaded("Crab'sMapManager") > -1) {
3098                    bRepeat = true;
3099                    announce_conflict("crabmapmanager.amxx");
3100            }
3101    
3102            // Using -2 for the language key seems to default to en, even with amx_mldebug set.
3103            // This is a hack, but it works.
3104            // ML_NOTFOUND will return 0 for version, so additional error handling isn't needed.
3105            formatex(sDV, 7, "%L", -2, "DV");
3106            iDV = str_to_num(sDV);
3107    
3108            // Allow for 9 newer version of dictionary file before plugin recompile is needed.
3109            if ((iDV < DMAP_EXPECTED_DV) || (iDV > (DMAP_EXPECTED_DV + 9))) {
3110                    bRepeat = true;
3111                    console_print(0, "[DMM] INVALID DICTIONARY FILE! Current version: %d. Expected version: %d to %d.", iDV, DMAP_EXPECTED_DV, DMAP_EXPECTED_DV + 9);
3112                    client_print(0, print_chat, "[DMM] INVALID DICTIONARY FILE! Current version: %d. Expected version: %d to %d.", iDV, DMAP_EXPECTED_DV, DMAP_EXPECTED_DV + 9);
3113            }
3114    
3115            if (bRepeat) {
3116                    set_task(5.0, "check_conflict", DMAP_TASKID_CONFLICT);
3117            }
3118            return PLUGIN_HANDLED;
3119    }
3120    
3121    announce_conflict(sPlugin[]) {
3122            console_print(0, "[DMM] CONFLICT DETECTED! Disable %s in plugins.ini.", sPlugin);
3123            client_print(0, print_chat, "[DMM] CONFLICT DETECTED! Disable %s in plugins.ini.", sPlugin);
3124    }
3125    
3126    public ff_status(id) {
3127            client_print(id, print_chat, "%L: %L", LANG_PLAYER, "DMAP_FRIEND_FIRE", LANG_PLAYER, get_cvar_num("mp_friendlyfire") ? "ON" : "OFF");
3128            return PLUGIN_CONTINUE;
3129    }
3130    
3131    
3132  public plugin_init() {  public plugin_init() {
3133    
3134          register_plugin(PLUGIN, VERSION, AUTHOR);          register_plugin(PLUGIN, VERSION, AUTHOR);
# Line 3068  Line 3138 
3138          get_configsdir(custompath, 49);          get_configsdir(custompath, 49);
3139          change_custom_path();          change_custom_path();
3140    
3141            check_conflict();       // Check for problems immediately
3142    
3143          register_clcmd("say", "HandleSay", 0, "Say: vote mapname, nominate mapname, or just mapname to nominate a map, say: nominations");          register_clcmd("say", "HandleSay", 0, "Say: vote mapname, nominate mapname, or just mapname to nominate a map, say: nominations");
3144          register_clcmd("say rockthevote", "rock_the_vote", 0, "Rocks the Vote");          register_clcmd("say rockthevote", "rock_the_vote", 0, "Rocks the Vote");
3145          register_clcmd("say rtv", "rock_the_vote", 0, "Rocks the Vote");          register_clcmd("say rtv", "rock_the_vote", 0, "Rocks the Vote");
3146            register_clcmd("say ff", "ff_status", 0, "Displays friendly fire status");
3147          register_clcmd("say listmaps", "list_maps", 0, "Lists all maps in a window and in console");          register_clcmd("say listmaps", "list_maps", 0, "Lists all maps in a window and in console");
3148          register_clcmd("say nextmap", "say_nextmap", 0, "Shows nextmap information to players");          register_clcmd("say nextmap", "say_nextmap", 0, "Shows nextmap information to players");
3149          register_concmd("dmap_help", "dmaphelp", 0, "Shows on-screen help information about Map Plugin");          register_concmd("dmap_help", "dmaphelp", 0, "Shows on-screen help information about Map Plugin");
# Line 3095  Line 3168 
3168          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");
3169          register_concmd("dmap_cancelvote", "dmapcancelvote", ADMIN_DMAP, "Cancels the rocked vote");          register_concmd("dmap_cancelvote", "dmapcancelvote", ADMIN_DMAP, "Cancels the rocked vote");
3170          register_concmd("dmap_nominate", "dmapnominate", ADMIN_DMAP, "<mapname> - Force nomination of a map by an admin");          register_concmd("dmap_nominate", "dmapnominate", ADMIN_DMAP, "<mapname> - Force nomination of a map by an admin");
3171            register_concmd("listmaps", "listmaps_override", 0, "Lists all maps in the console");
3172    
3173          register_logevent("event_RoundStart", 2, "0=World triggered", "1=Round_Start");          register_logevent("event_RoundStart", 2, "0=World triggered", "1=Round_Start");
3174          register_logevent("event_RoundEnd", 2, "0=World triggered", "1=Round_End");          register_logevent("event_RoundEnd", 2, "0=World triggered", "1=Round_End");
# Line 3139  Line 3213 
3213          //set_task(2.0, "get_listing"); //loads mapcycle / allmaps.txt          //set_task(2.0, "get_listing"); //loads mapcycle / allmaps.txt
3214          set_task(14.0, "load_defaultmaps");     //loads standardmaps.ini          set_task(14.0, "load_defaultmaps");     //loads standardmaps.ini
3215          //set_task(17.0, "load_maps");  //loads mapchoice.ini          //set_task(17.0, "load_maps");  //loads mapchoice.ini
3216          set_task(15.0, "askfornextmap", 987456, "", 0, "b");          set_task(15.0, "askfornextmap", DMAP_TASKID_ASK_FOR_NEXT, "", 0, "b");
3217          set_task(5.0, "loopmessages", 987111, "", 0, "b");          set_task(5.0, "loopmessages", DMAP_TASKID_LOOP_MESSAGES, "", 0, "b");
3218          set_task(34.0, "gen_maphelphtml");      //Writes to help file, which is read every time that dmap_help is called by ANY player          set_task(34.0, "gen_maphelphtml");      //Writes to help file, which is read every time that dmap_help is called by ANY player
3219          oldtimelimit = get_cvar_float("mp_timelimit");          oldtimelimit = get_cvar_float("mp_timelimit");
3220          get_localinfo("amx_lastmap", last_map, 31);          get_localinfo("amx_lastmap", last_map, 31);
3221          set_localinfo("amx_lastmap", "");          set_localinfo("amx_lastmap", "");
3222          set_task(1.0, "timer", 0, "curtime", 0, "b", 1);          set_task(1.0, "timer", DMAP_TASKID_TIMER, "curtime", 0, "b", 1);
3223          maps_to_select = mapssave = 5;          maps_to_select = mapssave = 5;
3224          new temparray[64];          new temparray[64];
3225          formatex(temparray, 63, "%s/mapvault.dat", custompath);          formatex(temparray, 63, "%s/mapvault.dat", custompath);

Legend:
Removed from v.45  
changed lines
  Added in v.51

Contact webmaster
ViewVC Help
Powered by ViewVC RSS 2.0 feed