/[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 54 by cstrike, Wed Mar 17 16:35:49 2010 UTC revision 55 by cstrike, Tue Nov 8 04:24:24 2011 UTC
# Line 1  Line 1 
1  /********************************************************************************  /********************************************************************************
2  *  AMX Mod X script.  *  AMX Mod X script.
3  *  *
4  *   Deagles Map Manager (deagsmapmanager.sma)  *   Deagles' Map Manager (deagsmapmanager.sma)
5  *   Copyright (C) 2006-2007 Deages/AMXX Community  *   Copyright (C) 2006-2011 Deagles/AMXX Community
6  *   (c) Copyright for original Mapchooser by OLO  *   Copyright (C) 2002-2005 Deagles
7    *   Original Mapchooser: Copyright (C) OLO
8  *  *
9  *   This program is free software; you can redistribute it and/or  *   This program is free software; you can redistribute it and/or
10  *   modify it under the terms of the GNU General Public License  *   modify it under the terms of the GNU General Public License
# Line 31  Line 32 
32  *  *
33  *********************************************************************************  *********************************************************************************
34  *  *
35  *   Deagles Map Manager v3.23  *   Deagles' Map Manager v3.23
36  *   Last Update: 2009-02-16  *   Last Update: 2009-02-16
37  *  *
38  *   by Deagles/AMXX Community & Posting/Supporting by bmann_420  *   by Deagles/AMXX Community & Posting/Supporting by bmann_420
# Line 40  Line 41 
41  *  *
42  *   Changelog is in the .txt file  *   Changelog is in the .txt file
43  *  *
44    *   The name of this plugin had several variations in the past:
45    *   - "Deagles NextMap Management"
46    *   - "Deagles Next Map Management"
47    *   - "Deagles Map Management"
48    *   - "Deagles' Map Management"
49    *   - "DeagsMapManager"
50    *   - "Nomination_style_voting"
51    *   - "Deags_map_manage"
52  *  *
53  *********************************************************************************  *********************************************************************************
54  */  */
# Line 66  Line 75 
75  #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
76    
77  // Task IDs  // Task IDs
78  #define DMAP_TASKID_TIMER               1010    //  #define DMAP_TASKID_TIMER               1000    //
79  #define DMAP_TASKID_VTR                 1020    // Vote Time Remaining  #define DMAP_TASKID_VTR                 1010    // Vote Time Remaining
80  #define DMAP_TASKID_CONFLICT            1020    // Conflicting plugin/dictionary version message  #define DMAP_TASKID_CONFLICT            1020    // Conflicting plugin/dictionary version message
81  #define DMAP_TASKID_TIME_DISPLAY        1030    // Show time left and next map  #define DMAP_TASKID_TIME_DISPLAY        1030    // Show time left and next map
82  #define DMAP_TASKID_MSG_THREE           1040    // Show status or result of vote  #define DMAP_TASKID_MSG_THREE           1040    // Show status or result of vote
# Line 91  Line 100 
100  new maps_to_select, isbuytime = 0, isbetween = 0;  new maps_to_select, isbuytime = 0, isbetween = 0;
101  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)
102  new Float:rtvpercent, Float:thespeed, Float:oldtimelimit;  new Float:rtvpercent, Float:thespeed, Float:oldtimelimit;
103  new minimum = 1, minimumwait = 10, enabled = 1, cycle = 0, dofreeze = 1, maxnom = 3, maxcustnom = 5, frequency = 3, oldwinlimit = 0, addthiswait = 0;  new minimum = 1, minimumwait = 10, enabled = 1, cycle = 0, dofreeze = 0, maxnom = 3, maxcustnom = 5, frequency = 3, oldwinlimit = 0, addthiswait = 0;
104  new mapsurl[64], amt_custom = 0;  new mapsurl[64], amt_custom = 0;
105  new isend = 0, isspeedset = 0, istimeset = 0, iswinlimitset = 0, istimeset2 = 0, mapssave = 0, atstart;  new isend = 0, isspeedset = 0, istimeset = 0, iswinlimitset = 0, istimeset2 = 0, mapssave = 0, atstart;
106  new usestandard = 1, currentplayers = 0, activeplayers = 0, counttovote = 0, countnum = 0;  new usestandard = 1, currentplayers = 0, activeplayers = 0, counttovote = 0, countnum = 0;
# Line 414  Line 423 
423          new Float:minutesleft = float(timeleft) / 60.0;          new Float:minutesleft = float(timeleft) / 60.0;
424          new Float:currentlimit = get_cvar_float("mp_timelimit");          new Float:currentlimit = get_cvar_float("mp_timelimit");
425          new Float:minutesplayed = currentlimit - minutesleft;          new Float:minutesplayed = currentlimit - minutesleft;
426          new wait;  
427          wait = minimumwait;          if ((minutesplayed + 0.5) >= (float(minimumwait))) {
         if ((minutesplayed + 0.5) >= (float(wait))) {  
428                  if (rocks >= needed && rocks >= minimum) {                  if (rocks >= needed && rocks >= minimum) {
429                          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_RTV_STARTING", rocks);                          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_RTV_STARTING", rocks);
430                          set_hudmessage(222, 70, 0, -1.0, 0.3, 1, 10.0, 10.0, 2.0, 4.0, 4);                          set_hudmessage(222, 70, 0, -1.0, 0.3, 1, 10.0, 10.0, 2.0, 4.0, 4);
# Line 438  Line 446 
446          new Float:minutesleft = float(timeleft) / 60.0;          new Float:minutesleft = float(timeleft) / 60.0;
447          new Float:currentlimit = get_cvar_float("mp_timelimit");          new Float:currentlimit = get_cvar_float("mp_timelimit");
448          new Float:minutesplayed = currentlimit - minutesleft;          new Float:minutesplayed = currentlimit - minutesleft;
449          new wait;  
         wait = minimumwait;  
450          if (cycle) {          if (cycle) {
451                  client_print(id, print_chat, "%L", id, "DMAP_VOTING_DISABLED");                  client_print(id, print_chat, "%L", id, "DMAP_VOTING_DISABLED");
452                  return PLUGIN_CONTINUE;                  return PLUGIN_CONTINUE;
# Line 470  Line 477 
477                  }                  }
478                  return PLUGIN_CONTINUE;                  return PLUGIN_CONTINUE;
479          }          }
480          if ((minutesplayed + 0.5) < (float(wait))) {          if ((minutesplayed + 0.5) < (float(minimumwait))) {
481                  if (float(wait) - 0.5 - minutesplayed > 0.0) {                  if (float(minimumwait) - 0.5 - minutesplayed > 0.0) {
482                          client_print(id, print_chat, "%L", id, "DMAP_RTV_WAIT",                          client_print(id, print_chat, "%L", id, "DMAP_RTV_WAIT",
483                            kName, (floatround(float(wait) + 0.5-minutesplayed) > 0) ? (floatround(float(wait) + 0.5 - minutesplayed)) : (1));                            kName, (floatround(float(minimumwait) + 0.5-minutesplayed) > 0) ? (floatround(float(minimumwait) + 0.5 - minutesplayed)) : (1));
484                  } else {                  } else {
485                          client_print(id, print_chat, "%L", id, "DMAP_RTV_1MIN");                          client_print(id, print_chat, "%L", id, "DMAP_RTV_1MIN");
486                  }                  }
# Line 504  Line 511 
511  }  }
512    
513  public rock_it_now() {  public rock_it_now() {
         new temprocked = hasbeenrocked;  
514          hasbeenrocked = 1;          hasbeenrocked = 1;
515          new timeleft = get_timeleft();          new timeleft = get_timeleft();
516          new Float:minutesleft=float(timeleft) / 60.0;          new Float:minutesleft=float(timeleft) / 60.0;
# Line 515  Line 521 
521          remove_task(DMAP_TASKID_TIME_TO_VOTE);          remove_task(DMAP_TASKID_TIME_TO_VOTE);
522          remove_task(DMAP_TASKID_GET_READY);          remove_task(DMAP_TASKID_GET_READY);
523          timelimit = float(floatround(minutesplayed + 1.5));          timelimit = float(floatround(minutesplayed + 1.5));
524          if (timelimit > 0.4) {  
525                  oldtimelimit = get_cvar_float("mp_timelimit");                  oldtimelimit = get_cvar_float("mp_timelimit");
526                  istimeset = 1;                  istimeset = 1;
527                  set_cvar_float("mp_timelimit", timelimit);                  set_cvar_float("mp_timelimit", timelimit);
# Line 525  Line 531 
531  #if defined DEDICATED_LOG_ENABLED  #if defined DEDICATED_LOG_ENABLED
532                  log_to_file(logfilename, "Time limit changed to %d to enable vote to occur now", floatround(get_cvar_float("mp_timelimit")));                  log_to_file(logfilename, "Time limit changed to %d to enable vote to occur now", floatround(get_cvar_float("mp_timelimit")));
533  #endif  #endif
534          } else {  
                 console_print(0, "%L", LANG_PLAYER, "DMAP_TIMELIMIT_NOTCHANGED");  
 #if defined DEDICATED_LOG_ENABLED  
                 log_to_file(logfilename, "Will not set a timelimit of %d, vote is not rocked, seconds left on map:%d", floatround(timelimit), timeleft);  
 #endif  
                 new inum, players[32], i;  
                 get_players(players, inum, "c");  
                 for (i = 0; i < inum; ++i) {  
                         rocked[i] = 0;  
                 }  
                 rocks = 0;  
                 hasbeenrocked = temprocked;  
                 return PLUGIN_HANDLED;  
         }  
535          timeleft = get_timeleft();          timeleft = get_timeleft();
536          inprogress = 1;          inprogress = 1;
537          mselected = false;          mselected = false;
# Line 684  Line 677 
677          isend = 1;          isend = 1;
678          //WE ARE near END OF MAP; time to invoke Round mode ALgorithm          //WE ARE near END OF MAP; time to invoke Round mode ALgorithm
679          //set_task(2.0, "endofround", DMAP_TASKID_END_OF_ROUND, "", 0, "b");          //set_task(2.0, "endofround", DMAP_TASKID_END_OF_ROUND, "", 0, "b");
680          new waituntilready = timeleft - 60;          new waituntilready = timeleft;
681          if (waituntilready > 30) {          if (waituntilready > 60) {
682                  waituntilready = 30;                  waituntilready = 60;
683          }          }
684          if (waituntilready <= 0 || get_cvar_num("mp_winlimit")) {          if (waituntilready <= 0 || get_cvar_num("mp_winlimit")) {
685                  addthiswait = 4;                  addthiswait = 4;
# Line 1498  Line 1491 
1491    
1492                                  strbreak(sFullLine, sTagMap, 31, sTagText, 31); // Split the map name and tag apart                                  strbreak(sFullLine, sTagMap, 31, sTagText, 31); // Split the map name and tag apart
1493    
1494                                    // TODO: Wildcard (regex) matching
1495                                    // I pulled this code for the v3.24 release.
1496                                    // Sorry! Expect it to return in the future.
1497    
1498                                  if (equali(nmaps[nnextmaps[nmapstoch]], sTagMap)) {                                  if (equali(nmaps[nnextmaps[nmapstoch]], sTagMap)) {
1499                                          format(sMenuOption, 63, "%s [%s]", sMenuOption, sTagText);                                          format(sMenuOption, 63, "%s [%s]", sMenuOption, sTagText);
1500                                          break;  // Quit reading the file                                          break;  // Quit reading the file
# Line 2142  Line 2139 
2139          //BAN RECENT MAPS PLAYED          //BAN RECENT MAPS PLAYED
2140          new lastmapspath[64];          new lastmapspath[64];
2141          formatex(lastmapspath, 63, "%s/lastmapsplayed.txt", custompath);          formatex(lastmapspath, 63, "%s/lastmapsplayed.txt", custompath);
         //new linestring[32];  
2142          line = stextsize = 0;          line = stextsize = 0;
2143          new current_map[32];          new current_map[32];
2144          get_mapname(current_map, 31);          get_mapname(current_map, 31);
# Line 2376  Line 2372 
2372                          case 'w': {                          case 'w': {
2373                                  formatex(strwait, 2, "%s", text[2]);                                  formatex(strwait, 2, "%s", text[2]);
2374                                  waittime = str_to_num(strwait);                                  waittime = str_to_num(strwait);
2375                                  if (waittime >= 5 && waittime <= 30) {                                  if (waittime >= 0 && waittime <= 60) {
2376                                          minimumwait = waittime;                                          minimumwait = waittime;
2377                                  }                                  }
2378                          }                          }
# Line 2481  Line 2477 
2477          new arg[32];          new arg[32];
2478          read_argv(1, arg, 3);          read_argv(1, arg, 3);
2479          new wait = str_to_num(arg);          new wait = str_to_num(arg);
2480          if (wait >= 5 && wait <= 30) {          if (wait >= 0 && wait <= 60) {
2481                  minimumwait = wait;                  minimumwait = wait;
2482                  savesettings(id);                  savesettings(id);
2483                  showsettings(id);                  showsettings(id);
2484          } else {          } else {
2485                  console_print(id, "You must specify a value between 5 and 30 for dmap_rtvwait");                  console_print(id, "You must specify a value between 0 and 60 for dmap_rtvwait");
2486                  console_print(id, "This sets how long must pass from the start of map before players may rockthevote");                  console_print(id, "This sets how long must pass from the start of map before players may rockthevote");
2487          }          }
2488          return PLUGIN_HANDLED;          return PLUGIN_HANDLED;
# Line 2761  Line 2757 
2757          if (!(get_user_flags(id) & ADMIN_MAP)) {          if (!(get_user_flags(id) & ADMIN_MAP)) {
2758                  new myversion[32];                  new myversion[32];
2759                  get_cvar_string("Deags_Map_Manage", myversion, 31);                  get_cvar_string("Deags_Map_Manage", myversion, 31);
2760                  console_print(id, "*****This server uses the plugin Deagles Map Manager %s *****", myversion);                  console_print(id, "*****This server uses the plugin Deagles' Map Manager %s *****", myversion);
2761                  console_print(id, "");                  console_print(id, "");
2762                  if (cycle) {                  if (cycle) {
2763                          console_print(id, "===================  The plugin is set to cycle mode.  No vote will take place   =================");                          console_print(id, "===================  The plugin is set to cycle mode.  No vote will take place   =================");
# Line 2841  Line 2837 
2837  showsettings(id) {  showsettings(id) {
2838    
2839          console_print(id, "-----------------------------------------------------------------------------------------------");          console_print(id, "-----------------------------------------------------------------------------------------------");
2840          console_print(id, "                 Status of Deagles Map Manager Version %s", VERSION);          console_print(id, "                 Status of Deagles' Map Manager Version %s", VERSION);
2841    
2842          if (cycle) {          if (cycle) {
2843                  console_print(id, "===================  Mode is Cycle Mode NO vote will take place   =================");                  console_print(id, "===================  Mode is Cycle Mode NO vote will take place   =================");
# Line 2893  Line 2889 
2889          if (!usestandard) {          if (!usestandard) {
2890                  console_print(id, "Custom will not be shown by any maps, since file standardmaps.ini is not on the server");                  console_print(id, "Custom will not be shown by any maps, since file standardmaps.ini is not on the server");
2891          } else {          } else {
2892                  console_print(id, "The words custom will be shown by Custom maps");                  console_print(id, "The word ^"Custom^" will be shown by custom maps");
2893          }          }
2894          if (containi(mapsurl, "www") != -1 || containi(mapsurl, "http") != -1) {          if (containi(mapsurl, "www") != -1 || containi(mapsurl, "http") != -1) {
2895                  console_print(id, "URL to download Custom maps is %s (dmap_mapsurl)", mapsurl);                  console_print(id, "URL to download Custom maps is %s (dmap_mapsurl)", mapsurl);
# Line 2932  Line 2928 
2928          if (!write_file(settings,text2)) {          if (!write_file(settings,text2)) {
2929                  success = 0;                  success = 0;
2930          }          }
2931          formatex(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 these variables; they are used by the Deagles' Map Manager plugin to save settings");
2932    
2933          if (!write_file(settings, text2)) {          if (!write_file(settings, text2)) {
2934                  success = 0;                  success = 0;
# Line 2954  Line 2950 
2950          }          }
2951          if (quiet != 0) {          if (quiet != 0) {
2952                  if (quiet == 1) {                  if (quiet == 1) {
2953                          formatex(text, 31, "q1");       //d for disabled                          formatex(text, 31, "q1");       //q1 for NOSOUND
2954                  } else {                  } else {
2955                          formatex(text, 31, "q2");       //d for disabled                          formatex(text, 31, "q2");       //q2 for SILENT
2956                  }                  }
2957                  usedany = 1;                  usedany = 1;
2958                  if (!write_file(settings, text)) {                  if (!write_file(settings, text)) {
# Line 3019  Line 3015 
3015                          success = 0;                          success = 0;
3016                  }                  }
3017          }          }
3018          if (minimumwait >= 5 && minimumwait <= 30) {          if (minimumwait >= 0 && minimumwait <= 60) {
3019                  formatex(text, 31, "w %d", minimumwait);                  formatex(text, 31, "w %d", minimumwait);
3020                  usedany = 1;                  usedany = 1;
3021                  if (!write_file(settings, text)) {                  if (!write_file(settings, text)) {
# Line 3257  Line 3253 
3253          register_concmd("amx_rtv", "admin_rockit", ADMIN_DMAP, "Allows admins to force a vote");          register_concmd("amx_rtv", "admin_rockit", ADMIN_DMAP, "Allows admins to force a vote");
3254          register_concmd("dmap_rtvpercent", "dmaprtvpercent", ADMIN_SUPER_DMAP, "Set the percent (3-100) of players for a rtv");          register_concmd("dmap_rtvpercent", "dmaprtvpercent", ADMIN_SUPER_DMAP, "Set the percent (3-100) of players for a rtv");
3255          register_concmd("dmap_rtvplayers", "dmaprtvplayers", ADMIN_SUPER_DMAP, "Sets the minimum number of players needed to rockthevote");          register_concmd("dmap_rtvplayers", "dmaprtvplayers", ADMIN_SUPER_DMAP, "Sets the minimum number of players needed to rockthevote");
3256          register_concmd("dmap_rtvwait", "dmaprtvwait", ADMIN_SUPER_DMAP, "Sets the minimum time before rockthevote can occur (5-30)");          register_concmd("dmap_rtvwait", "dmaprtvwait", ADMIN_SUPER_DMAP, "Sets the minimum time before rockthevote can occur (0-60)");
3257          register_concmd("dmap_default", "dmapdefaults", ADMIN_SUPER_DMAP, "Will restore settings to default");          register_concmd("dmap_default", "dmapdefaults", ADMIN_SUPER_DMAP, "Will restore settings to default");
3258          register_concmd("dmap_mapsurl", "dmapmapsurl", ADMIN_SUPER_DMAP, "Specify what website to get custom maps from");          register_concmd("dmap_mapsurl", "dmapmapsurl", ADMIN_SUPER_DMAP, "Specify what website to get custom maps from");
3259          register_concmd("dmap_mapsnum", "dmapmapsnum", ADMIN_SUPER_DMAP, "Set number of maps in vote (will not take effect until next map");          register_concmd("dmap_mapsnum", "dmapmapsnum", ADMIN_SUPER_DMAP, "Set number of maps in vote (will not take effect until next map");
# Line 3292  Line 3288 
3288          bIsCstrike = (cstrike_running() == 1);          bIsCstrike = (cstrike_running() == 1);
3289          nmaps_num = num_nmapsfill = 0;          nmaps_num = num_nmapsfill = 0;
3290    
3291            register_cvar("Deags_Map_Manage", VERSION, FCVAR_SERVER|FCVAR_SPONLY);
3292          if (bIsCstrike) {          if (bIsCstrike) {
                 register_cvar("Deags_Map_Manage", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY);  
3293                  register_event("TeamScore", "team_score", "a");                  register_event("TeamScore", "team_score", "a");
3294          } else {                  dofreeze = 1;
                 dofreeze = 0;  
                 register_cvar("Deags_Map_Manage", VERSION);  
3295          }          }
3296          rtvpercent = 0.6;          rtvpercent = 0.6;
3297          ban_last_maps = 4;          ban_last_maps = 4;
         minimumwait = 10;  
3298          atstart = enabled = minimum = 1;          atstart = enabled = minimum = 1;
3299          quiet = cycle = isend = 0;          quiet = cycle = isend = 0;
3300          mapsurl = "";          mapsurl = "";

Legend:
Removed from v.54  
changed lines
  Added in v.55

Contact webmaster
ViewVC Help
Powered by ViewVC RSS 2.0 feed