
   /*********************************************************************
   ******
   *  amx_ejl_allsound_downloader.sma
   *   version 1.2             Date: 1/20/2003
   *   Author: Eric Lidman     ejlmozart@hotmail.com
   *   Alias: Ludwig van       Upgrade:
   http://lidmanmusic.com/cs/plugins.html
   *
   *  This  a  a system for managing your sound downloads to clients. You
   can
   *   specify  some  sounds to download to clients regardless of the map
   they
   *   join  on,  also  you can make some sounds only download to clients
   for
   *   certain  maps.  The advantages of using this plugin instead of res
   files
   *   are many. If you want sounds to download to clients no matter what
   map
   *   they  play on, you need to specify that sound in every single .res
   file.
   *   Also,  this  simplifies  the  management of sound downloads. It is
   easier to
   *   see  what  you are downloading to people if you have a single list
   to work
   *   of off rather than a zillion individual .res files.
   *
   *  Setup: You should create a file in your ..addons/amx folder called:
   *   MASTER_SOUND_DL_LIST.txt,  if  you  dont, the server will make one
   for you
   *   which you can modify and add to as you please. That file should be
   set
   *   up like thisup like this:
   *
   *   FORMAT:       ACTUAL EXAMPLE:
   *
   *   #ALL          #ALL
   *   sound         lol.wav
   *
   *   #mapname      #de_dust
   *   sound         gnyso/2_bonjour.wav
   *   sound         misc/PartyMusic.wav
   *
   *   #mapname      #cs_italy
   *   sound         gnyso/2_ELMO.wav
   *
   *  Download as many as you want, but see warning-2 below.
   *
   *  Warning-1:  Unlike  .res  files,  you should not put "sound" in the
   path to
   *   your   sound.  sound/something.wav  should  be  listed  as  simply
   something.wav
   *   if  the  list file. sound/misc/elmo.wav would be misc/elmo.wav and
   so on.
   *
   *  Warning-2:  Be  aware  of how much you are downloading to people. I
   have a
   *   standard  where  I  limit  sound  downloads  to  300kb  per map or
   thereabouts.
   *   That  takes  the  average  client 1-2 minutes to download off your
   server.
   *   #ALL counts for every map, so take that into account when figuring
   how
   *   much  you  can  get  away with downloading to a client before they
   lose
   *   patience  and  decide  to drop and go to another server where they
   can
   *   actually  play  and  not  have to wait years for your downloads to
   finish.
   *
   *  NEW:  Can  download  sprites  and  models as well. For this type of
   download
   *   the  default  path  is  not sound, it is your mod directory. These
   files
   *   you may include right along with the sounds in the same
   *   MASTER_SOUND_DL_LIST.txt file. Examples:
   *
   *      #ALL
   *      models/bowling_ball.mdl
   *      vox/lol.wav
   *
   *      #de_dust
   *      gnyso/2_bonjour.wav
   *      misc/PartyMusic.wav
   *      sprites/scary_ghost.spr
   *
   *
   *  Acknowledgements:
   *   Spacedude from the AMX forums for coming up with the original idea
   for
   *   this plugin and writing its rough draft.
   *
   **********************************************************************
   *****/
   #include <amxmod>
   public plugin_precache() {
       new ThisMap[32]
       get_mapname(ThisMap, 32)
       new soundfile[128]
       new line
       new txtlen
       new prec_on = 0
       if (file_exists("addons/amx/MASTER_SOUND_DL_LIST.txt")){
           while((line=read_file("addons/amx/MASTER_SOUND_DL_LIST.txt",li
   ne,soundfile,128,txtlen))!=0){
               if(equal(soundfile[0],"#",1)){
                   if(prec_on == 1)
                       prec_on = 0
                   if(          (equali(soundfile[1],ThisMap))         ||
   (equali(soundfile[1],"ALL",3)) )
                       prec_on = 1
               }else{
                   if(containi(soundfile,".wav") != -1){
                       if(prec_on == 1){
                           precache_sound(soundfile)
                       }
                   }
                   else if(containi(soundfile,".spr") != -1){
                       if(prec_on == 1){
                           precache_model(soundfile)
                       }
                   }
                   else if(containi(soundfile,".mdl") != -1){
                       if(prec_on == 1){
                           precache_model(soundfile)
                       }
                   }
                   else if(containi(soundfile,".wad") != -1){
                       if(prec_on == 1){
                           precache_model(soundfile)
                       }
                   }
               }
           }
       }else{
           write_file("addons/amx/MASTER_SOUND_DL_LIST.txt","MASTER
   DOWNLOAD  LIST  for  sounds  - replaces res files. Format: read top of
   .sma file",-1)
       }
       return PLUGIN_CONTINUE
   }
   public plugin_init(){
       register_plugin("SOUND DOWNLOAD MANAGEMENT","1.2","EJL")
   }
