AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Nextmapchooser (https://forums.alliedmods.net/showthread.php?t=64657)

Makap 12-20-2007 14:21

Nextmapchooser
 
1 Attachment(s)
Please help me to edit and compile that plugin from AMX 0.9.9 to AMX Mod X.

Code:

/* ChronoTopica Pro and Mapchooser v0.2.1
Copyleft by Johnny got his gun
Copyright by Bush's left toenail bit after he cut it off.
OLO made 99% of Mapchooser part. Sorry OLO your script is great but I needed to modify it to
release something like this. 

INSTALLATION
************
You MUST remove any and all previous versions of ChronoTopica AND OLO's mapchooser plugin.
Then just compile this, put the chronotopica_pro_and_mapchooser.amx in your amx\plugins folder
and add a line in amx\plugins\plugins.ini that says "chronotopica_pro_and_mapchooser.amx", without the
quotes.
Look also below regarding the mapchooser plugin that searches for WC3 mod (Warcraft 3) enabled maps
in war3maps.ini.

- amx_addtime 5
  adds 5 minutes to map time (so you don't have to edit mp_timelimit yourself)
  You can supply a negative value, to remove minutes.

  - amx_roundmode
  Displays round mode status. Round mode will automatically activate at a round end
    if time left is not enough for a complete new round time. Map will change instantly
  AFTER (not ever during!) the following three rounds. (Ie 3 minutes remain, but your
  round time is 4 minute, round mode will be activated and three rounds remain.)

  - amx_roundmode on
  Turns round mode on. Time limit will be set to 0:00, and default number of rounds is 20.
  When 2 rounds remain, mapchooser will ask for the next map.

  - amx_roundmode off
  Turn round mode off. Time left will be your extend map step time, normally 15 minutes.

  - amx_roundmode_default
  Set current round mode (on/off) as default.

  - amx_roundmode 15
  Set number of rounds left to 15. Change to whatever number you want. Right now limit of 100 rounds 

  - say /roundsleft
  Displays remaining number of rounds.

  - say roundsleft
  Displays remaining number of rounds.

  - amx_askfornextmap
  Start OLO's nextmapchooser plugin. It's a little changed so that if you have Warcraft 3 XP, it will
  always display at least X number of maps in the vote that are in your cstrike\war3maps.ini file.

To do:
- Check channel collision with other plugins...

  What's new in 0.2.1:
  - Minor cosmetic bug fixes
  - New is that mapchooser won't display the five last maps that has been played, including
    current map. To change this default value of five maps, change the line saying
  "#define NUMBER_OF_MAPS_TO_REMEMBER 5".

  What's new in 0.2:
  ------------------
  - amx_roundmode_default - Sets current round mode (on or off) as default
  - Fixed so that users with no access can use the commands they should not
    touch!  Didn't check access levels earlier...
  - Bug fixes
  - Changed default rounds to 20 rounds.
  - Fixed so that "say timeleft" will return number of rounds left, if round mode is enabled

        - Johnny got his gun (you can find me and any new versions in the amxmod.net forum)

MAPCHOOSER SEGMENT
******************

AMX Mod script.
*
* (c) Copyright 2002-2003, OLO
* This file is provided as is (no warranties).
********************************************************************************************
* Edited by Johnny got his gun
* Edited to let the voters know if each map in the vote list is WC3 enabled or not
* This is done by checking if the map exist in the war3maps.ini file;
* If it is, the text [WC3 enabled] will be displayed to the right of the map name.
* To use this you must have Johnny got his gun's special version of Warcraft 3 XP (2.20jghg)
* Always displays at least three WC3 enabled maps in voting. These maps need to be listed
* "mapcycle style" in war3maps.ini. Ie if you want all your maps in mapcycle to be WC3
* enabled, just copy that file and and rename it to war3maps.ini, or just edit the line
* in this file that says "war3maps.ini", change it to "mapcycle.txt".
*
* IF YOU DONT HAVE WC3 MOD
* ========================
* You can change the minimum number of WC3 enabled maps in the nextmap chooser
* by altering the line that says "#define MINIMUM_WC3_ENABLED_MAPS 2", and change the number 2.
* Don't put any number other than 0 there if you don't have a cstrike\war3maps.ini file with
* maps listed in it, mapcycle.txt-style!!! Consider yourself warned. 
*
* DON'T DISPLAY LAST 5 NUMBER OF MAPS PLAYED
* ==========================================
* You're players won't get to choose the last five maps played (including current played map).
* This default setting is set on the line "#define NUMBER_OF_MAPS_TO_REMEMBER 5". So just
* change the 5 if you want to change this setting!
*/
#define MINIMUM_WC3_ENABLED_MAPS 0
#define NUMBER_OF_MAPS_TO_REMEMBER 5
/*
********************************************************************************************
*/

/*
* Displays menu with 5 random maps to select.
* One of the options is also map extending.
* Map with most votes becomes the nextmap.
*
* Maps to selected are entered by amx_nextmapch server command:
* amx_nextmapch <mapname> ...
*
* Cvars:
* amx_extendmap_max <time in mins.> - max. time for overall extending
* amx_extendmap_step <time in mins.> - with what time the map will be extended
*
* You can specify the map list f.e. in admin.cfg like
  amx_nextmapch de_dust de_dust2 de_vegas de_storm de_nuke de_aztec
  amx_nextmapch cs_militia de_prodigy cs_office de_piranesi
  amx_nextmapch cs_italy de_cbble de_torn de_survivor cs_747 cs_assault
  amx_nextmapch de_chateau cs_backalley cs_havana cs_thunder de_vertigo
*
* NOTE: Nextmap plugin is required for proper working of this plugin.
*      Command amx_nextmapch can accept more than one map in command line.
*/

#include <amxmod>
#include <amxmisc>

#define MAX_MAPS_AMOUNT 128
#define MAPS_TO_SELECET 3

// jghg edit start
new vault_value[128]
// jghg edit stop

new nmaps[MAX_MAPS_AMOUNT][32]
new nmaps_num
new bool:cstrike_running

new nnextmaps[MAPS_TO_SELECET]
new nvotes[MAPS_TO_SELECET+2]
new nmapstoch

new logfilename[256]
new teamscore[2]
new last_map[32]

// ************************
// ChronoTopica stuff start
new bool:roundMode
new rounds

public load_pmapcycle(){
  new number
  number = get_playersnum()
  new pnm
  pnm = get_cvar_num("amx_pnm")
  new maxplayers = get_maxplayers()
  new cmd[48]
  new id
  id=0;
  new mapcycle[48]
  console_print(id,"AMX_PNM - Current Players on server: %d",number)
  get_cvar_string("mapcyclefile",mapcycle,48);
  console_print(id,"AMX_PNM - Current Mapcycle: %s",mapcycle)
  if (number>pnm)
  {
          if(pnm==maxplayers)
          {
                  format(cmd,48,"exec addons/amx/config/full.cfg", number)
          }
          else
          {
                format(cmd,48,"exec addons/amx/config/plus.cfg", number)
          }
  }
  else if(number <=pnm)
  {
        if((number==0 ) || (number == 1))
        {
                format(cmd,48,"exec addons/amx/config/empty.cfg", number)
        }
        else
        {
          format(cmd,48,"exec addons/amx/config/less.cfg", number)
        }
  }
  server_cmd(cmd)
  //format(cmd,48,"amx_chat %s",cmd)
  server_cmd(cmd)
  return PLUGIN_HANDLED
}

public amx_addtime(id,level,cid) {
  if (!cmd_access(id,level,cid,1))
      return PLUGIN_HANDLED

  if (roundMode) {
      console_print(id,"* ChronoTopica - Command not available as long as round mode is enabled.")
      return PLUGIN_CONTINUE
  }
   
  if (read_argc() != 2) {
      client_print(id,print_chat,"* ChronoTopica - Usage: amx_addtime 5 (to add 5 minutes)")
      return PLUGIN_CONTINUE
  }

  new timeToAddString[10]
  read_argv(1,timeToAddString,10)

  new Float:timeFloat = str_to_num(timeToAddString) + 0.0

  set_cvar_float("mp_timelimit",get_cvar_float("mp_timelimit") + timeFloat)

  console_print(0,"* ChronoTopica - Added %f minutes to map time",timeFloat)
  client_print(0,print_chat,"* ChronoTopica - Added %f minutes to map time",timeFloat)

  if (get_cvar_float("mp_timelimit") == 0.0) {
      timelimit001()
      return PLUGIN_HANDLED
  }
  return PLUGIN_HANDLED
}

public roundended() {
  if (roundMode) {
      rounds--
     
      if (rounds < 1) {
        set_task(0.01,"amx_roundmode",666,"off")
        timelimit001()

        return PLUGIN_HANDLED
      }
      else if (rounds == 2) {
        // Start mapchooser.amx when two rounds remain
        load_pmapcycle()
        server_cmd("amx_askfornextmap")
      }
      else if (rounds == 1) {
        client_cmd(0,"spk ^"this is the last round^"")
      }

      if (rounds > 0) {
        new roundsBuffer[2048]
        format(roundsBuffer, 2047, "Rounds remaining: %d",rounds)
        set_hudmessage(30,255,30,0.43,0.7, 0, 0.0,7.0, 0.05, 0.05, 4)
        show_hudmessage(0,roundsBuffer)
      }
  }
  else if (!roundMode) {
      new Float:minutesLeft = (get_timeleft() / 60) + (get_cvar_float("mp_freezetime") / 60) + (3 / 60)
      if (get_cvar_float("mp_timelimit") > 0.0 && get_cvar_float("mp_roundtime") > minutesLeft) {
        // Activate round mode here, set to three remaining rounds
        load_pmapcycle()
        roundmode_on(true)
        rounds = 3

        console_print(0,"* ChronoTopica - Time running out. Last three rounds coming up.")
        client_print(0,print_chat,"* ChronoTopica - Time running out. Last three rounds coming up.")
      }
  }

  return PLUGIN_HANDLED
}

public newround() {
  // Ensure we have unlimited time. plugin_init() seems to be run before any cvars is set in config files.
  if (roundMode && get_cvar_float("mp_timelimit") != 0.0)
      set_cvar_float("mp_timelimit",0.0)

  return PLUGIN_HANDLED
}

public timelimit001() {
  console_print(0,"* ChronoTopica - Ending map")
  client_print(0,print_chat,"* ChronoTopica - Ending map")

  set_cvar_float("mp_timelimit",0.01)

  return PLUGIN_HANDLED
}

public sayroundsleft(id) {
  new roundsBuffer[2048]
  if (roundMode) {
      new authid[16],name[32]
      get_user_authid(id,authid,16)
      get_user_name(id,name,32)
      client_print(id,print_chat,"%s: roundsleft",name)
       
      format(roundsBuffer, 2047, "Rounds remaining: %d",rounds)
  }
  else
      format(roundsBuffer, 2047, "Round mode is disabled.")

  set_hudmessage(30,255,30,0.43,0.7, 0, 0.0,7.0, 0.05, 0.05, 4)
  show_hudmessage(0,roundsBuffer)

  return PLUGIN_HANDLED
}

/*
public cnsay(id, level, cid) {
        new text[65]
        read_argv(1, text, 64)
        format(text, 64, "%c%s", 2, text)
        message_begin(MSG_ALL, gmsgSayText)
        write_byte(id)
        write_string(text)
        message_end()
        return PLUGIN_HANDLED
}
*/

public saytimeleft(id) {
  new authid[16],name[32]
  get_user_authid(id,authid,16)
  get_user_name(id,name,32)

  if (roundMode) {
      client_print(id,print_chat,"%s: roundsleft",name)

      new roundsBuffer[2048]
      format(roundsBuffer, 2047, "Rounds remaining: %d",rounds)
      set_hudmessage(30,255,30,0.43,0.7, 0, 0.0,7.0, 0.05, 0.05, 4)
      show_hudmessage(0,roundsBuffer)
  }
  else
      client_print(id,print_chat,"%s: timeleft",name)

  return PLUGIN_HANDLED
}

public amx_roundmode(id,level,cid) {
  if (!cmd_access(id,level,cid,1))
      return PLUGIN_HANDLED
   
  new bool:syntaxRight = false

  if (read_argc() == 1) {
      syntaxRight = true

      if (roundMode) {
        console_print(id,"* ChronoTopica - Round mode is currently enabled. Remaining rounds: %d",rounds)
        console_print(id,"* ChronoTopica - <amx_roundmode off> to disable",rounds)
      }
      else if (!roundMode){
        console_print(id,"* ChronoTopica - Round mode is currently disabled. Remaining rounds: %d",rounds)
        console_print(id,"* ChronoTopica - <amx_roundmode on> to enable",rounds)
      }
  }
  else if (read_argc() == 2) {
      new argm[11] = {0,0,0}
      read_argv(1,argm,10)

      if (argm[0] == 'o' && argm[1] == 'n') {
        syntaxRight = true
        roundmode_on(false)
      }
      else if (argm[0] == 'o' && argm[1] == 'f' && argm[2] == 'f') {
        syntaxRight = true
        roundmode_off()
      }
      else {
        new roundsFromString = str_to_num(argm)
        if (roundsFromString > 0 && roundsFromString <= 100)
        {
            syntaxRight = true
            rounds = roundsFromString
            console_print(0,"* ChronoTopica - Round mode rounds set to %d.",rounds)
            client_print(0,print_chat,"* ChronoTopica - Round mode rounds set to %d.",rounds)
        }
      }
  }

  if (!syntaxRight) {
      console_print(id,"* ChronoTopica - Use: amx_roundmode <on|off|#> where # is number of rounds.")
      console_print(id,"* ChronoTopica - Leave out arguments to display round mode state.")
  }

  return PLUGIN_HANDLED
}

public amx_roundmode_d(id,level,cid) {
  if (!cmd_access(id,level,cid,1))
      return PLUGIN_HANDLED

  if (roundMode == false) {
      ejl_vault("WRITE","RoundMode","off")
      console_print(id,"[AMX] <Round Mode OFF> is now default.")
  }
  else {
      ejl_vault("WRITE","RoundMode","on")
      console_print(id,"[AMX] <Round Mode ON> is now default.")
  }

  new authid[16],name[32]
  get_user_authid(id,authid,16)
  get_user_name(id,name,32)

  log_to_file("addons/amx/admin.log","^"%s<%d><%s><>^" amx_roundmode_default",name,get_user_userid(id),authid)

  return PLUGIN_HANDLED
}

public roundmode_on(quiet) {
  roundMode = true

  set_cvar_float("mp_timelimit",0.0)

  if (!quiet) {
      console_print(0,"* ChronoTopica - Round mode enabled. Remaining rounds: %d",rounds)
      client_print(0,print_chat,"* ChronoTopica - Round mode enabled. Remaining rounds: %d",rounds)
  }

  return PLUGIN_HANDLED
}

public roundmode_off() {
  new Float:stepTime = get_cvar_float("amx_extendmap_step")
  if (stepTime == 0.0) {
      stepTime = 15.0
  }

  roundMode = false
  console_print(0,"* ChronoTopica - Round mode disabled. Setting time to %f minutes left.",floatround(stepTime))
  client_print(0,print_chat,"* ChronoTopica - Round mode disabled. Setting time to %f minutes left.",floatround(stepTime))

  new Float:passedMinutes = get_gametime() / 60.0
  set_cvar_float("mp_timelimit",passedMinutes + stepTime)
}

// Ludwig van: Hope ya don't mind me borrowing your vault!!! Many thanks.
public ejl_vault(rw[],key[],value[]){
  new data[192]
  new stxtsize = 0
  new line = 0
  new skip = 0
  new vkey[64]
  new vvalue[128]
  new vaultwrite[192]
  if(equal(rw,"READ")){
      if(file_exists("addons/amx/ejl_vault.ini") == 1){
        copy(vault_value,128,"")
        while((line=read_file("addons/amx/ejl_vault.ini",line,data,192,stxtsize))!=0){
            parse(data,vkey,64,vvalue,128)
            if(equal(vkey,key)){
              copy(vault_value,128,vvalue)
            }
        }
      }else{
        write_file("addons/amx/ejl_vault.ini", "**** Plugins use to store values -- immune to crashes and map changes ****", 0)
      }
  }
  else if(equal(rw,"WRITE")){
      if(file_exists("addons/amx/ejl_vault.ini") == 1){     
        format(vaultwrite,192,"%s %s",key,value)
        while((line=read_file("addons/amx/ejl_vault.ini",line,data,192,stxtsize))!=0){
            parse(data,vkey,64,vvalue,128)
            if(skip == 0){
              if( (equal(data,"")) || (equal(vkey,key)) ){
                  skip = 1
                  write_file("addons/amx/ejl_vault.ini",vaultwrite,line-1)
              }
            }
            else if(equal(vkey,key)){
              write_file("addons/amx/ejl_vault.ini","",line-1)
            }
        }
        if(skip == 0){
            write_file("addons/amx/ejl_vault.ini",vaultwrite,-1)
        }
      }
  }
  return PLUGIN_CONTINUE
}

// ChronoTopica stuff end
// **********************



public check_votes() {
  new b = 0   
  for(new a = 0; a < nmapstoch; ++a)
      if (nvotes[b] < nvotes[a])
        b = a

  if (nvotes[MAPS_TO_SELECET] > nvotes[b]) {
      new mapname[32]
      get_mapname(mapname,31)
      new Float:steptime = get_cvar_float("amx_extendmap_step")
      //set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime)
      if (roundMode) {
        rounds = rounds + floatround(steptime)
        client_print(0,print_chat,"* Choosing finished. Current map will be extended with another %d rounds.",floatround(steptime))
        log_to_file(logfilename,"Vote: Voting for the nextmap finished. Current map will be extended with another %d rounds.",floatround(steptime))
      }
      else if (!roundMode) {
        /* Returns game time. */
        //native Float:get_gametime(); This one supposed to return passed seconds
        client_print(0,print_chat,"* Choosing finished. Current map will be extended.")
        new Float:gameTime = get_gametime() / 60.0
        set_cvar_float("mp_timelimit",gameTime + steptime)
      }
     
      return PLUGIN_HANDLED
  }

  if ( nvotes[b] && nvotes[MAPS_TO_SELECET+1] <= nvotes[b] )
      set_cvar_string("amx_nextmap", nmaps[nnextmaps[b]] )
  new smap[32]
  get_cvar_string("amx_nextmap",smap,31)
  client_print(0,print_chat,"* Choosing finished. The nextmap will be %s", smap )
  log_to_file(logfilename,"Vote: Voting for the nextmap finished. The nextmap will be %s", smap)
  return PLUGIN_HANDLED
}

public vote_count(id,key){
  if ( get_cvar_float("amx_vote_answers") ) {
      new name[32]
      get_user_name(id,name,31)
      if ( key == MAPS_TO_SELECET )
        client_print(0,print_chat,"* %s chose map extending", name )
      else if ( key < MAPS_TO_SELECET )
        client_print(0,print_chat,"* %s chose %s", name, nmaps[nnextmaps[key]] )
  }
  ++nvotes[key]
  return PLUGIN_HANDLED
}

bool:isinmenu(id){
  for(new a=0; a<nmapstoch; ++a)
      if (id==nnextmaps[a])
        return true
  return false
}

// JGHG EDIT START
public amx_askfornextmap(id,level,cid) {
  if (!cmd_access(id,level,cid,1))
      return PLUGIN_HANDLED
  if (!nmaps_num){
        load_pmapcycle()
        server_cmd("amx_askfornextmap")
        return PLUGIN_HANDLED
  }
  new menu[512], a, mkeys = (1<<MAPS_TO_SELECET+1)
  new pos = copy(menu,511,cstrike_running ? "\yAMX Choose nextmap:\w^n^n" : "AMX Choose nextmap:^n^n")
  new dmax = (nmaps_num > MAPS_TO_SELECET) ? MAPS_TO_SELECET : nmaps_num

  new wc3enabledmaps = 0
  new textline[64], nextline=0, textlength
  new bool:wc3mapsfilenameexists = false
  new bool:warcraft3enabled = false
  new wc3mapsfilename[32] = "war3maps.ini"
  new wc3enabled[32] = "[WC3 enabled]"
  if (file_exists(wc3mapsfilename))
  {
      wc3mapsfilenameexists = true
  }

  for(nmapstoch = 0;nmapstoch<dmax;++nmapstoch){
      a=random_num(0,nmaps_num-1)
      while( isinmenu(a) )
        if (++a >= nmaps_num) a = 0
      nnextmaps[nmapstoch] = a

      // JGHG EDIT START
      warcraft3enabled = false
      if (wc3mapsfilenameexists)
      {
        do
        {
            nextline = read_file(wc3mapsfilename,nextline,textline,63,textlength)
            if (equal(textline,nmaps[a]))
            {
              pos += format(menu[pos],511,"%d. %s %s^n",nmapstoch+1,nmaps[a],wc3enabled)
              warcraft3enabled = true
              wc3enabledmaps++
            }
        } while(nextline && warcraft3enabled == false)

        if (!warcraft3enabled)
        {
            if (wc3enabledmaps >= MINIMUM_WC3_ENABLED_MAPS || dmax - nmapstoch > MINIMUM_WC3_ENABLED_MAPS)
            {
              pos += format(menu[pos],511,"%d. %s^n",nmapstoch+1,nmaps[a])
            }
            else
            {
              nmapstoch--
            }
        }

        new bool:amongLastFewMapsPlayed = false
        for (new ii = 1;ii <= NUMBER_OF_MAPS_TO_REMEMBER && !amongLastFewMapsPlayed;ii++) {

            new rememberedmapstring[15]
            format(rememberedmapstring,14,"amx_last%d_%d",NUMBER_OF_MAPS_TO_REMEMBER,ii)
            new rememberedmap[50]
            get_cvar_string(rememberedmapstring,rememberedmap,49)
            if (equal(textline,rememberedmap)) {
              amongLastFewMapsPlayed = true
              nmapstoch--
            }
        }

      }
      else
      {
        pos += format(menu[pos],511,"%d. %s^n",nmapstoch+1,nmaps[a])
      }
      // JGHG EDIT STOP

      mkeys |= (1<<nmapstoch)
      nvotes[nmapstoch] = 0
  }
  menu[pos++]='^n'
  nvotes[MAPS_TO_SELECET] = 0
  nvotes[MAPS_TO_SELECET+1] = 0   
  new mapname[32]
  get_mapname(mapname,31)

  if (get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max")){
      pos += format(menu[pos],511,"%d. I7PODJIUTb KAPTY (Extend map) %s^n",MAPS_TO_SELECET+1,mapname)
      mkeys |= (1<<MAPS_TO_SELECET)
  }

  new voteStarterName[50]
  get_user_name(id,voteStarterName,49)
  new voteStarterWonID = 0 //get_user_wonid(id)

  format(menu[pos],511,"%d. None",MAPS_TO_SELECET+2)
  show_menu(0,mkeys,menu,15)
  set_task(15.0,"check_votes")
  client_cmd(0,"spk Gman/Gman_Choose2")
  if (voteStarterWonID != 0) {
      client_print(0,print_chat,"* It's time to choose the nextmap... Initiated by %s",voteStarterName)
      log_to_file(logfilename,"Vote: Voting for the nextmap started, initiated by %d",voteStarterWonID)
  }
  else {
      client_print(0,print_chat,"* It's time to choose the nextmap... Initiated by server console.")
      log_to_file(logfilename,"Vote: Voting for the nextmap started, initiated by server console.")
  }
  return PLUGIN_HANDLED
}
// JGHG EDIT STOP

public addmaptolist(id,level,cid){
  if (!cmd_access(id,level,cid,2))
      return PLUGIN_HANDLED
  new arg[32], argcl = read_argc()
  new current_map[32]
  get_mapname(current_map,31)
  for(new a = 1; a < argcl; ++a){
      read_argv(a,arg,31)
      if (is_map_valid(arg)){
        if (equali(arg,current_map) || equali(arg,last_map))
            continue
        for(new i = 0; i < nmaps_num; ++i)
            if (equali(arg,nmaps[i])){
              console_print(id,"Map ^"%s^" is already in list",arg)
              return PLUGIN_HANDLED
            }
        copy(nmaps[nmaps_num++],31,arg)
      }
      else
        console_print(id,"Map ^"%s^" not found or is invalid",arg)
  }
  return PLUGIN_HANDLED
}

public team_score(){ 
  new team[2]
  read_data(1,team,1)
  teamscore[ (team[0]=='C') ? 0 : 1 ] = read_data(2)
  return PLUGIN_CONTINUE
}

public plugin_end(){
  new current_map[32]
  get_mapname(current_map,31)
  set_localinfo("amx_lastmap",current_map)
  return PLUGIN_CONTINUE
}

public plugin_init(){
  register_plugin("Chronotopica Pro & Nextmapchooser","0.2.1","jghg+BouHPycu")
  register_srvcmd("amx_nextmapch","addmaptolist",0,"<mapname> ...")
  register_concmd("amx_askfornextmap","amx_askfornextmap",ADMIN_LEVEL_F,"Picks five maps on random and starts a vote on them")
  register_menucmd(register_menuid("AMX Choose nextmap:"),(-1^(-1<<(MAPS_TO_SELECET+2))),"vote_count")
  register_cvar("amx_extendmap_max","90")
  register_cvar("amx_extendmap_step","15")
  register_cvar("amx_pnm","14")
  new mod_name[32]
  get_modname(mod_name,31)
  cstrike_running = equal(mod_name,"cstrike") ? true : false
  //announcedmapvote = false

  if (cstrike_running)
      register_event("TeamScore", "team_score", "a")
     
  //set_task(15.0,"askfornextmap",987456,"",0,"b")
  get_time("addons/amx/logs/admin%m%d.log",logfilename,255)
  get_localinfo("amx_lastmap",last_map,31)
  set_localinfo("amx_lastmap","")

  // jghg added stuff below
  if (NUMBER_OF_MAPS_TO_REMEMBER > 0.0) {
      new mapmatrix[NUMBER_OF_MAPS_TO_REMEMBER][100]
      for (new i = 0;i < NUMBER_OF_MAPS_TO_REMEMBER;++i) {
        new cvarstring[15]
        format(cvarstring,14,"amx_last%d_%d",NUMBER_OF_MAPS_TO_REMEMBER,i)
        get_cvar_string(cvarstring,mapmatrix[i],99)
      }

      new firstmaptoremember[15]
      format(firstmaptoremember,14,"amx_last%d_%d",NUMBER_OF_MAPS_TO_REMEMBER,1)
      register_cvar(firstmaptoremember,"")
      new currentmapplayed[50]
      get_mapname(currentmapplayed,49)
      set_cvar_string(firstmaptoremember,currentmapplayed)

      for (new i = 2;i <= NUMBER_OF_MAPS_TO_REMEMBER;i++) {
        new maptoremember[15]
        format(maptoremember,14,"amx_last%d_%d",NUMBER_OF_MAPS_TO_REMEMBER,i)
        register_cvar(maptoremember,"")
        set_cvar_string(maptoremember,mapmatrix[i - 1])
      }
  }
  // jghg added stuff above

    // ************************
  // Below ChronoTopica stuff

  register_concmd("amx_addtime","amx_addtime",ADMIN_LEVEL_H,": Add minutes to map time")
  register_concmd("amx_roundmode","amx_roundmode",ADMIN_LEVEL_H,": <on|off|# (set number of rounds)> .")
  register_concmd("amx_roundmode_default","amx_roundmode_d",ADMIN_RCON,": sets the current round mode (on/off) as default.")   

  register_clcmd("say /roundsleft","sayroundsleft",0,": show remaining rounds, if in round mode.")
  register_clcmd("say roundsleft","sayroundsleft",0,": show remaining rounds, if in round mode.")
  register_clcmd("say /timeleft","saytimeleft",0,": show remaining time in time mode, remaing rounds in round mode.")
  register_clcmd("say timeleft","saytimeleft",0,": show remaining time in time mode, remaing rounds in round mode.")
  //register_concmd("amx_nsay", "cnsay", ADMIN_LEVEL_A, "testing...don't touch...")


  // Events that tell us a round has ended and a new one is coming up
  register_event("SendAudio", "roundended", "a", "2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
  register_event("TextMsg","roundended","a","2&#Game_C","2&#Game_w")

  // New round event?
  register_event("ResetHUD","newround", "b")

  // This (TeamScore) is supposed to be a end of map event... no use right now
  //register_event("TeamScore","cmd","a")

  ejl_vault("READ","RoundMode","")
  if(equal(vault_value,"on"))
      roundmode_on(true)
  else
      roundmode_off()

  rounds = 20

  // ChronoTopica stuff above
  // ************************
  return PLUGIN_CONTINUE
}



All times are GMT -4. The time now is 11:12.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.