/[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 9 by cstrike, Thu Sep 11 22:23:56 2008 UTC revision 10 by cstrike, Thu Sep 11 23:41:11 2008 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.20";  new const VERSION[] = "3.20-MOD";
54  new const AUTHOR[]  = "Deags/AMXX Community";  new const AUTHOR[]  = "Deags/AMXX Community";
55    
56  // Comment out the following line to disable the dedicated log file  // Comment out the following line to disable the dedicated log file
# Line 278  Line 278 
278  }  }
279    
280  public list_maps(id) {  public list_maps(id) {
281          new m, idreal = id, iteration = 0;          new m, iteration = 0;
282          client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_LISTMAPS", totalmaps);          client_print(id, print_chat, "%L", id, "DMAP_LISTMAPS", totalmaps);
283          if (totalmaps - (50 * iteration) >= 50) {          if (totalmaps - (50 * iteration) >= 50) {
284                  console_print(idreal, "%L", LANG_PLAYER, "DMAP_LISTMAPS_MAPS", iteration * 50 + 1, iteration * 50 + 50);                  console_print(id, "%L", id, "DMAP_LISTMAPS_MAPS", iteration * 50 + 1, iteration * 50 + 50);
285          } else {          } else {
286                  console_print(idreal, "%L", LANG_PLAYER, "DMAP_LISTMAPS_MAPS", iteration * 50 + 1, iteration * 50 + (totalmaps - iteration * 50));                  console_print(id, "%L", id, "DMAP_LISTMAPS_MAPS", iteration * 50 + 1, iteration * 50 + (totalmaps - iteration * 50));
287          }          }
288    
289          for (m = 50 * iteration; (m < totalmaps && m < 50 * (iteration + 1)); m += 3)          for (m = 50 * iteration; (m < totalmaps && m < 50 * (iteration + 1)); m += 3)
# Line 299  Line 299 
299          if (50 * (iteration + 1) < totalmaps) {          if (50 * (iteration + 1) < totalmaps) {
300                  new kIdfake[32];                  new kIdfake[32];
301                  num_to_str((id + 50 * (iteration + 1)), kIdfake, 31);                  num_to_str((id + 50 * (iteration + 1)), kIdfake, 31);
302                  client_print(idreal, print_console, "%L", LANG_PLAYER, "DMAP_LISTMAPS_MORE");                  client_print(id, print_console, "%L", id, "DMAP_LISTMAPS_MORE");
303                  set_task(4.0, "more_list_maps", 127600 + id, kIdfake, 6);                  set_task(4.0, "more_list_maps", 127600 + id, kIdfake, 6);
304          }          }
305          return PLUGIN_CONTINUE;          return PLUGIN_CONTINUE;
306  }  }
307    
308  public more_list_maps(idfakestr[]) {  public more_list_maps(idfakestr[]) {
309          new idfake = str_to_num(idfakestr);          new idreal = str_to_num(idfakestr);
310          new m, idreal = idfake, iteration = 0;          new m, iteration = 0;
311          while (idreal >= 50) {          while (idreal >= 50) {
312                  idreal -= 50;                  idreal -= 50;
313                  iteration++;                  iteration++;
314          }       //Now idreal is the real id of client          }       //Now idreal is the real id of client
315    
316          if (totalmaps - (50 * iteration) >= 50) {          if (totalmaps - (50 * iteration) >= 50) {
317                  console_print(idreal, "%L", LANG_PLAYER, "DMAP_LISTMAPS_MAPS", iteration * 50 + 1, iteration * 50 + 50);                  console_print(idreal, "%L", idreal, "DMAP_LISTMAPS_MAPS", iteration * 50 + 1, iteration * 50 + 50);
318          } else {          } else {
319                  console_print(idreal, "%L", LANG_PLAYER, "DMAP_LISTMAPS_MAPS", iteration * 50 + 1, iteration * 50 + (totalmaps - iteration * 50));                  console_print(idreal, "%L", idreal, "DMAP_LISTMAPS_MAPS", iteration * 50 + 1, iteration * 50 + (totalmaps - iteration * 50));
320          }          }
321    
322          for (m = 50 * iteration; (m < totalmaps && m < 50 * (iteration + 1)); m += 3) {          for (m = 50 * iteration; (m < totalmaps && m < 50 * (iteration + 1)); m += 3) {
# Line 334  Line 334 
334          if (50 * (iteration + 1) < totalmaps) {          if (50 * (iteration + 1) < totalmaps) {
335                  new kIdfake[32];                  new kIdfake[32];
336                  num_to_str((idreal + 50 * (iteration + 1)), kIdfake, 31);                  num_to_str((idreal + 50 * (iteration + 1)), kIdfake, 31);
337                  client_print(idreal, print_console, "%L", LANG_PLAYER, "DMAP_LISTMAPS_MORE");                  client_print(idreal, print_console, "%L", idreal, "DMAP_LISTMAPS_MORE");
338                  set_task(2.0, "more_list_maps", 127600 + idreal, kIdfake, 6);                  set_task(2.0, "more_list_maps", 127600 + idreal, kIdfake, 6);
339          } else {        //Base case has been reached          } else {        //Base case has been reached
340                  client_print(idreal, print_console, "%L", LANG_PLAYER, "DMAP_LISTMAPS_FINISHED", totalmaps);                  client_print(idreal, print_console, "%L", idreal, "DMAP_LISTMAPS_FINISHED", totalmaps);
341          }          }
342  }  }
343    
# Line 399  Line 399 
399          new wait;          new wait;
400          wait = minimumwait;          wait = minimumwait;
401          if (cycle) {          if (cycle) {
402                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_VOTING_DISABLED");                  client_print(id, print_chat, "%L", id, "DMAP_VOTING_DISABLED");
403                  return PLUGIN_CONTINUE;                  return PLUGIN_CONTINUE;
404          }          }
405          if (!enabled) {          if (!enabled) {
406                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_RTV_DISABLED");                  client_print(id, print_chat, "%L", id, "DMAP_RTV_DISABLED");
407                  return PLUGIN_CONTINUE;                  return PLUGIN_CONTINUE;
408          }          }
409          if (inprogress) {          if (inprogress) {
410                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_VOTE_BEGINNING");                  client_print(id, print_chat, "%L", id, "DMAP_VOTE_BEGINNING");
411                  return PLUGIN_CONTINUE;                  return PLUGIN_CONTINUE;
412          }          }
413          if (mselected) {          if (mselected) {
414                  new smap[32];                  new smap[32];
415                  get_cvar_string("amx_nextmap", smap, 31);                  get_cvar_string("amx_nextmap", smap, 31);
416                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_VOTING_COMPLETED", smap, get_timeleft());                  client_print(id, print_chat, "%L", id, "DMAP_VOTING_COMPLETED", smap, get_timeleft());
417                  return PLUGIN_CONTINUE;                  return PLUGIN_CONTINUE;
418          }          }
419          if (hasbeenrocked) {          if (hasbeenrocked) {
420                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_MAP_ALREADY_ROCKED", kName);                  client_print(id, print_chat, "%L", id, "DMAP_MAP_ALREADY_ROCKED", kName);
421                  return PLUGIN_CONTINUE;                  return PLUGIN_CONTINUE;
422          }          }
423          if (timeleft < 120) {          if (timeleft < 120) {
424                  if (timeleft > 1) {                  if (timeleft > 1) {
425                          client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_NOT_ENOUGH_TIME");                          client_print(id, print_chat, "%L", id, "DMAP_NOT_ENOUGH_TIME");
426                  } else {                  } else {
427                          client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_NO_TIMELIMIT");                          client_print(id, print_chat, "%L", id, "DMAP_NO_TIMELIMIT");
428                  }                  }
429                  return PLUGIN_CONTINUE;                  return PLUGIN_CONTINUE;
430          }          }
431          if ((minutesplayed + 0.5) < (float(wait))) {          if ((minutesplayed + 0.5) < (float(wait))) {
432                  if (float(wait) - 0.5 - minutesplayed > 0.0) {                  if (float(wait) - 0.5 - minutesplayed > 0.0) {
433                          client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_RTV_WAIT",                          client_print(id, print_chat, "%L", id, "DMAP_RTV_WAIT",
434                            kName, (floatround(float(wait) + 0.5-minutesplayed) > 0) ? (floatround(float(wait) + 0.5 - minutesplayed)) : (1));                            kName, (floatround(float(wait) + 0.5-minutesplayed) > 0) ? (floatround(float(wait) + 0.5 - minutesplayed)) : (1));
435                  } else {                  } else {
436                          client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_RTV_1MIN");                          client_print(id, print_chat, "%L", id, "DMAP_RTV_1MIN");
437                  }                  }
438                  if ((get_user_flags(id) & ADMIN_MAP)) {                  if ((get_user_flags(id) & ADMIN_MAP)) {
439                          console_print(id, "%L", LANG_PLAYER, "DMAP_RTV_ADMIN_FORCE", kName);                          console_print(id, "%L", id, "DMAP_RTV_ADMIN_FORCE", kName);
440                  }                  }
441                  return PLUGIN_CONTINUE;                  return PLUGIN_CONTINUE;
442          }          }
# Line 444  Line 444 
444                  rocked[id] = 1;                  rocked[id] = 1;
445                  rocks++;                  rocks++;
446          } else {          } else {
447                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_ALREADY_ROCKED", kName);                  client_print(id, print_chat, "%L", id, "DMAP_ALREADY_ROCKED", kName);
448                  return PLUGIN_CONTINUE;                  return PLUGIN_CONTINUE;
449          }          }
450          if (rocks >= needed && rocks >= minimum) {          if (rocks >= needed && rocks >= minimum) {
# Line 534  Line 534 
534          get_user_name(id, kName, 31);          get_user_name(id, kName, 31);
535    
536          if (timeleft < 180.0) {          if (timeleft < 180.0) {
537                  console_print(id, "%L", LANG_PLAYER, "DMAP_NOT_ENOUGH_TIME");                  console_print(id, "%L", id, "DMAP_NOT_ENOUGH_TIME");
538                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
539          }          }
540          if (inprogress || hasbeenrocked || isend) {          if (inprogress || hasbeenrocked || isend) {
541                  console_print(id, "%L", LANG_PLAYER, "DMAP_ALREADY_VOTING");                  console_print(id, "%L", id, "DMAP_ALREADY_VOTING");
542                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
543          }          }
544          if (cycle) {          if (cycle) {
545                  console_print(id, "%L", LANG_PLAYER, "DMAP_ENABLE_VOTEMODE");                  console_print(id, "%L", id, "DMAP_ENABLE_VOTEMODE");
546                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
547          }          }
548          if (!mselected) {          if (!mselected) {
# Line 1509  Line 1509 
1509                          return PLUGIN_HANDLED;                          return PLUGIN_HANDLED;
1510                  }                  }
1511                  if (mselected) {                  if (mselected) {
1512                          client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_VOTE_IN_PROGRESS");                          client_print(id, print_chat, "%L", id, "DMAP_VOTE_IN_PROGRESS");
1513                  } else {                  } else {
1514                          if (nmaps_num == 0) {                          if (nmaps_num == 0) {
1515                                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_NO_NOMINATIONS");                                  client_print(id, print_chat, "%L", id, "DMAP_NO_NOMINATIONS");
1516                          } else {                          } else {
1517                                  listnominations(id);                                  listnominations(id);
1518                          }                          }
# Line 1587  Line 1587 
1587          new tempnmaps = nmaps_num;          new tempnmaps = nmaps_num;
1588          get_mapname(current_map, 31);          get_mapname(current_map, 31);
1589          if (maxnom == 0) {          if (maxnom == 0) {
1590                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_NOMINATIONS_DISABLED");                  client_print(id, print_chat, "%L", id, "DMAP_NOMINATIONS_DISABLED");
1591                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1592          }          }
1593          if (inprogress && mselected) {          if (inprogress && mselected) {
1594                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_VOTING_IN_PROGRESS");                  client_print(id, print_chat, "%L", id, "DMAP_VOTING_IN_PROGRESS");
1595                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1596          }          }
1597          if (mselected) {          if (mselected) {
1598                  new smap[32];                  new smap[32];
1599                  get_cvar_string("amx_nextmap", smap, 31);                  get_cvar_string("amx_nextmap", smap, 31);
1600                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_VOTING_OVER", smap);                  client_print(id, print_chat, "%L", id, "DMAP_VOTING_OVER", smap);
1601                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1602          }          }
1603          if (!is_map_valid(map) || is_map_valid(map[1])) {          if (!is_map_valid(map) || is_map_valid(map[1])) {
1604                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_MAP_NOTFOUND", map);                  client_print(id, print_chat, "%L", id, "DMAP_MAP_NOTFOUND", map);
1605                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1606          }          }
1607          if (isbanned(map)) {          if (isbanned(map)) {
1608                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_MAPVOTE_NOT_AVAILABLE");                  client_print(id, print_chat, "%L", id, "DMAP_MAPVOTE_NOT_AVAILABLE");
1609                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1610          }          }
1611          if (islastmaps(map) && !equali(map, current_map)) {          if (islastmaps(map) && !equali(map, current_map)) {
1612                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_CANT_NOMINATE_LASTMAP", ban_last_maps);                  client_print(id, print_chat, "%L", id, "DMAP_CANT_NOMINATE_LASTMAP", ban_last_maps);
1613                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1614          }          }
1615          if (equali(map, current_map)) {          if (equali(map, current_map)) {
1616                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_EXTEND_MAP", map);                  client_print(id, print_chat, "%L", id, "DMAP_EXTEND_MAP", map);
1617                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1618          }          }
1619          //Insert Strict Style code here, for pcvar dmap_strict 1          //Insert Strict Style code here, for pcvar dmap_strict 1
# Line 1624  Line 1624 
1624                                  isinthelist = 1;                                  isinthelist = 1;
1625                  }                  }
1626                  if (!isinthelist) {                  if (!isinthelist) {
1627                          client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_ALLOWED_MAPS");                          client_print(id, print_chat, "%L", id, "DMAP_ALLOWED_MAPS");
1628                          return PLUGIN_HANDLED;                          return PLUGIN_HANDLED;
1629                  }                  }
1630          }          }
1631          iscust = iscustommap(map);          iscust = iscustommap(map);
1632          if (nmaps_num >= maps_to_select || Nominated[id] >= maxnom) {   //3 (1,2,3)          if (nmaps_num >= maps_to_select || Nominated[id] >= maxnom) {   //3 (1,2,3)
1633                  if (Nominated[id] > maxnom) {   //3                  if (Nominated[id] > maxnom) {   //3
1634                          client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_MAX_MAPS_REACHED");       //Possible to reach here!                          client_print(id, print_chat, "%L", id, "DMAP_MAX_MAPS_REACHED");        //Possible to reach here!
1635                          //only if the command dmap_nominations is used to lower amount of maps that can be nominated                          //only if the command dmap_nominations is used to lower amount of maps that can be nominated
1636                          return PLUGIN_HANDLED;                          return PLUGIN_HANDLED;
1637                  }                  }
# Line 1642  Line 1642 
1642                                  new name[32];                                  new name[32];
1643                                  get_user_name(whonmaps_num[i], name, 32);                                  get_user_name(whonmaps_num[i], name, 32);
1644                                  if (quiet == 2) {                                  if (quiet == 2) {
1645                                          client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_ALREADY_NOMINATED", map, name);                                          client_print(id, print_chat, "%L", id, "DMAP_ALREADY_NOMINATED", map, name);
1646                                  } else {                                  } else {
1647                                          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_ALREADY_NOMINATED", map, name);                                          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_ALREADY_NOMINATED", map, name);
1648                                  }                                  }
# Line 1714  Line 1714 
1714                          }                          }
1715                  }                  }
1716                  if (!done) {                  if (!done) {
1717                          client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_MAX_NOMINATIONS_REACHED", nmaps_num);                          client_print(id, print_chat, "%L", id, "DMAP_MAX_NOMINATIONS_REACHED", nmaps_num);
1718                          return PLUGIN_HANDLED;                          return PLUGIN_HANDLED;
1719                  }                  }
1720          }          }
# Line 1724  Line 1724 
1724                          new name[32];                          new name[32];
1725                          get_user_name(whonmaps_num[i], name, 32);                          get_user_name(whonmaps_num[i], name, 32);
1726    
1727                          client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_ALREADY_NOMINATED", map, name);                          client_print(id, print_chat, "%L", id, "DMAP_ALREADY_NOMINATED", map, name);
1728    
1729                          nmaps_num = tempnmaps;                          nmaps_num = tempnmaps;
1730    
# Line 1733  Line 1733 
1733          }          }
1734    
1735          if (!isreplacement && iscust && full) {          if (!isreplacement && iscust && full) {
1736                  client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_MAX_CUSTOMMAPS_REACHED", maxcustnom);                  client_print(id, print_chat, "%L", id, "DMAP_MAX_CUSTOMMAPS_REACHED", maxcustnom);
1737                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
1738          }          }
1739    
# Line 1741  Line 1741 
1741          get_user_name(id, name, 21);          get_user_name(id, name, 21);
1742          if (isreplacement == 1) {       //They are replacing their old map          if (isreplacement == 1) {       //They are replacing their old map
1743                  if (quiet == 2) {                  if (quiet == 2) {
1744                          client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_REPLACE_PREVIOUS_NOMINATION", nmaps[nmaps_num]);                          client_print(id, print_chat, "%L", id, "DMAP_REPLACE_PREVIOUS_NOMINATION", nmaps[nmaps_num]);
1745                  } else {                  } else {
1746                          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_PLAYER_REPLACED_NOMINATION", name, nmaps[nmaps_num]);                          client_print(0, print_chat, "%L", LANG_PLAYER, "DMAP_PLAYER_REPLACED_NOMINATION", name, nmaps[nmaps_num]);
1747                  }                  }
# Line 1759  Line 1759 
1759    
1760          Nominated[id]++;          Nominated[id]++;
1761    
1762          console_print(id, "%L", LANG_PLAYER, "DMAP_ADD_NOMINATION", map, nmaps_num + 1);          console_print(id, "%L", id, "DMAP_ADD_NOMINATION", map, nmaps_num + 1);
1763    
1764          set_task(0.18, "calculate_custom");          set_task(0.18, "calculate_custom");
1765          copy(nmaps[nmaps_num], 31, map);          copy(nmaps[nmaps_num], 31, map);
# Line 2578  Line 2578 
2578                  return PLUGIN_HANDLED;                  return PLUGIN_HANDLED;
2579          }          }
2580          //For CS 1.6, the following MOTD will display nicely, for 1.5, It will show html tags.          //For CS 1.6, the following MOTD will display nicely, for 1.5, It will show html tags.
2581          client_print(id, print_chat, "%L", LANG_PLAYER, "DMAP_MOTD_LOADING");          client_print(id, print_chat, "%L", id, "DMAP_MOTD_LOADING");
2582          showmotdhelp(id);          showmotdhelp(id);
2583    
2584          return PLUGIN_HANDLED;          return PLUGIN_HANDLED;

Legend:
Removed from v.9  
changed lines
  Added in v.10

Contact webmaster
ViewVC Help
Powered by ViewVC RSS 2.0 feed