plugin_join_notify (v1.20)

/*****************************************\
* Bill Bateman aka "HunteR"               *
* http://thepit.shacknet.nu/cs            *
* http://thepit.shacknet.nu/bill/plugins/ *
* huntercc@hotmail.com                    *
\*****************************************/

///////////////////////////////////////////////////////////////////////////

This plugin will read from a text file Player/Csay/Sound file combinations
  and when someone with a matching Name, IP Address, or AuthID connects to
  the server, the specified sound file will be played for everyone to hear.
  This allows players to have a custom sound that will play every time they
  connect so everyone knows who is joining the game.  A custom Csay message
  can also be defined in the config file.

Much of the code for the file parsing and the playsoundall function was
  borrowed from plugin_sank_sounds, by Luke Sankey <sank@spu.edu>
  while the general structure of this plugin was modeled after my
  plugin_pager, and is in fact almost identical.  Forgive me if I don't
  specify, but some smaller chunks of code may have been borrowed from
  plugin_sank_sounds as well.

Functions included in this plugin:
  admin_join_off
  admin_join_on
  admin_join_reload
  admin_join_list
  admin_join_lock <on | off>
  admin_join_add
  admin_join_delete


//////////////////////////
Installation instructions:
//////////////////////////

1) Compile the plugin_join_notify.sma file

2) Put the resulting plugin_join_notify.amx file in your scripts folder,
   for example:  <MOD>\addons\adminmod\scripts\plugin_join_notify.amx
   where <MOD> is the name of your mod; "cstrike" for Counter-Strike,
   "tfc" for Team Fortress Classic, etc

3) Put any custom sound files in your <MOD>\sound\misc folder

4) Create a .res file for each map in your mapcycle, for example de_dust.res
   and open it in a simple text editor such as Notepad.  Now add a line for
   each of your custom sounds, like this:  sound/misc/run.wav
   Each sound file should be on its own line.  Then make a copy of this res
   file for each map in your cycle.
   
5) Next, open your plugin.ini file and at the bottom add the following line:
   addons/adminmod/scripts/plugin_join_notify.amx

6) Place the JOIN.cfg file in your <MOD>\addons\adminmod\config folder

7) Next time the map changes the plugin will load and announce anyone in the
   config file.

////////////////////
Configuration Notes:
////////////////////

Neither the sound nor the Csay message are necessary, so you can have one
 without the other, as long as you leave the appropriate field blank.  For
 example to play a sound without the Csay, just use this format:
     <search_type>;<user>; ;<sound_file>
                         ^^^notice the space between the two semi-colons

 Or if you want the Csay without the sound:
     <search_type>;<user>;<message>;
                                   ^notice the last semi-colon

A "%n" in the Csay message will be replaced by the plugin with the connecting
 player's name (good for clan-specific notifications).
  
One thing to remember is that only the FIRST line from the config file that
 matches the connecting player will be processed, so if their clan tags are
 on the first line of your config file but they also have their Name farther
 down, ONLY the line related to their clan tags will be processed.  If there
 is enough demand, maybe I will add support for multiple greetings in the
 future, but it is not currently planned because I don't see a need for it.
 
It is a good idea to keep clan tags near the bottom of the config file.


//////////////////////////////
"JOIN.CFG" Config File Format:
//////////////////////////////

 NAME_LOCK;1
 NOTIFY_DELAY;5
 <search_type>;<user>;<message>;<sound_file>

 NAME_LOCK:  [default: 1]
     This may seem unneccesary, but many admins wouldn't want someone using
     another admin's name to be announced.  With this set to 1, only those
     with ACCESS_JOIN = 512+64 will be announced when they join the server.
     Set this to 0, and anyone can change their name to one in the config
     file and be announced.

 NOTIFY_DELAY:  [default: 5]
     This is the minimum number of seconds between announcements, useful
     when several people connect.  This helps prevent announcements from
     overlapping each other.  Typically this should be set to 1 or 2 seconds
     longer than the longest sound in the config file.  This is also the
     delay from the moment a player enters the game to the moment he/she
     is announced.

 <search_type> :
     1=Exact Name
     2=Partial Name
     3=IP Address
     4=AuthID

 <user> :
     Exact Name, Partial Name, IP Address, or AuthID
     (see description of <search_type> for more info).
     Names are not case sensitive.

 <message> :
     Type in a message as you would when using admin_csay.
     For example, you can specify a color by using the appropriate
     word at the beginning of your message, as shown below in the
     example config file.  If you don't specify a color, the default
     color is green.

 <sound_file> : ***(Changed in v1.02)***
     This can be either an external wav file, such as the run.wav file
     included with this plugin, or a built-in wav file such as those
     used by the speak command or the speech plugin.

     If you want to specify a sound file, type in the location of the
     file starting from the sound directory - but always use a forward
     slash, "/", instead of a backslash, for both internal and external
     sound files (new in v1.02).

     For an internal sound file, do NOT include the .wav at the end.
     You must also NOT include the command "speak" -- this plugin does
     that automatically.  See the examples below.

     For a list of available internal sounds, you will need to get
     a pak-file extractor such as PakExplorer, which can be found at
     http://quakestuff.telefragged.com

     The most commonly used internal sounds are in the half-life\valve
     directory in the file pak0.pak

#####################################################################
#
# Sample Config file for plugin_join_notify
# #-sign denotes a commented line
#
#This line will display a Blue message, play the external
# file located at "half-life\<mod>\sound\misc\run.wav",
# for a name with the exact spelling "HunteR [CSS]"
# (Note: names are NOT case sensitive)
#
1;HunteR [CSS];blue HunteR [CSS] is joining the battle!;misc/run.wav
#
#
#This line will display a Green message, play the internal sound
# specified by "you will die", for the partial name "[CSS]", and
# automatically replaces "%n" with the player's name.
#
2;[CSS];green %n has joined the server!;you will die
#
#
#This line will display a Red message, play the internal sound
# specified by "fvox/danger evacuate_area", for the AuthID "12345"
#
4;12345;red Look who joined the battle!^nNone other than %n!;fvox/danger evacuate_area
