

          This plugin must be the FIRST or at least before the base 
      or adminmod default plugins in your PLUGIN.INI or it wont work.


/***********************************************************************
 * plugin_ejl_adminhierarchy.sma     release version 4.0  October 26/2002
 *  By:  Eric Lidman	Alias: Ludwig van
 *  Upgrade: http://lidmanmusic.com/cs/plugins.html        
 *
 *
 * This plugin performs much the same function as the cvar 
 *  admin_highlander, except it is more flexible. It allows a group of
 *  top admins to have their complete access (as specified in users.ini,
 *  but no more) to admin commands, while admins not in the group will
 *  only have limited access.
 *
 * Adminhierarchy should be useful for servers with many admins. Only
 *  admins in the top rank who are on at the time will have control over
 *  the more "global" commands on the server -- commands which directly 
 *  affect more than one player such as admin_gravity or admin_map.
 *  This way admins can argue about what the gravity will be, but only 
 *  the top admins can do anything about it -- until they leave, then the 
 *  next highest admin in the ranks takes control. It is aimed at keeping
 *  order on the server.
 * 
 * This plugin also gives partial immunity to all admins. No one can
 *  admin_ban, admin_kick, or admin_vote_kick any admin. Admins without
 *  immunity in their access can still be slapped, slayed etc. This is
 *  just a precaution to keep lower admins from gaining power by 
 *  kicking/banning higher admins.
 *
 * Commands:
 *
 *  admin_signin    --- tells the server you are on and ready to take your
 *                      place in the admin hierarchy, low or high. This is 
 *                      not required if you are using the default scheme 
 *                      of having the server automatically sign you in.
 *  admin_resign    --- used by a higher admin to let the next lower admin
 *                      be the top admin while the higher admin is still
 *                      connected. This is for all your either humble or 
 *                      lazy higher admins out there who dont want to be 
 *                      the higher admin for the moment.  
 *  admin_topadmin  --- use this to find out who the current top admin is.
 *  admin_adminstatus  --- Lists admins who are currently playing in rank 
 *                         order and reports if they are signed in or not.
 *                         A regular player looking at this will only see
 *                         admins who have their access (admin_password)
 *                         active, although the admins dont need to be 
 *                         signed in. Admins with thier access active from 
 *                         the users.ini looking at this will see all 
 *                         admins connected even if the othe admin do not
 *                         have their admin access in the users.ini active.
 *  admin_cloak_owner      --- Makes the number 1 admin invisible to the 
 *                             other admins. He wont be reported at all 
 *                             and will not be signed in automatically
 *                             even if auto-signin is the current mode.
 *                             If you decide to sign in, however, you will
 *                             be exposed. But thats not the point of this.
 *                             This allows for the server owner to watch
 *                             stealthily over his admins while playing
 *                             under a fake name. The command toggles on 
 *                             and off stealth mode and sets it in the 
 *                             vault.ini as the default until it is 
 *                             changed again. Only the server owner 
 *                             can set this mode on or off. Make sure as
 *                             the server owner that you are the number 
 *                             1 admin listed in the adminhierarchy.txt.
 *                             Admin access RCON also required. Also, if
 *                             you are running any plugins which announce
 *                             admin's entrances, you will want to modify
 *                             them in such a way that they dont announce
 *                             you, or disable them altogether. Of course
 *                             you would only need to do this if you want 
 *                             to use the cloak owner mode. Obviosly an 
 *                             annouced entrance could blow your cover.
 * admin_signin_default    --- Toggles auto-signin mode on and off and 
 *                             sets it in the vault.ini as the default
 *                             until it is changed again. Only the server
 *                             owner can set this mode on or off. Make 
 *                             sure as the server owner that you are the
 *                             number 1 admin in the adminhierarchy.txt.
 *                             Admin access RCON also required.
 * admin_ah_reload         --- Reloads the adminhierarchy.txt file so that
 *                             changes made to it midway through a game
 *                             can be effective immediately without having
 *                             to wait for a map change. Only the server
 *                             owner is allowed to use this command. Make 
 *                             sure as the server owner that you are the
 *                             number 1 admin in the adminhierarchy.txt.
 *                             Admin access RCON also required. 
 * admin_ah_report         --- Toggles the use of messeges telling when
 *                             admins sign in, resign, connect, or
 *                             diconnect and sets it in the vault.ini as
 *                             the default until it is changed again.
 *                             This cuts down on chat use by the plugin
 *                             and the bombarding of players with admin
 *                             information if thats the way you like it. 
 *                             The commands, admin_adminstatus and
 *                             admin_topadmin still work. Only the server
 *                             owner can set this mode on or off. Make 
 *                             sure as the server owner that you are the
 *                             number 1 admin in the adminhierarchy.txt.
 *                             Admin access RCON also required. 
 *
 * By default, this plugin tries to automatically sign in admins on
 *  their connect. If it misses there, everytime this admin says
 *  anything, he gets signed in -- unless he resigns. Also by default
 *  owner cloaking is off and use of messenging (admin_ah_report) is
 *  on. It is possible in cloak mode for a server owner to allow himself
 *  to be kicked (but not banned) by one of his admins. This is useful if
 *  you want to observe them extensively and not raise thier suspicions
 *  as they kick you. Then of course you can tell them later that they
 *  kicked you. (Then fire them. lol) By default in cloak mode you cant
 *  be kicked, but there is a switch below you can set to be in allow
 *  kick mode. If you change it, you need to recompile the plugin. The
 *  switch looks like this: #define AllowOwnerKick 0 // 0=no 1=yes
 * 
 * This plugin uses WONIDs for admin identification so it WILL NOT WORK
 *  for LAN games. Actually, it might work for a lan server if you use
 *  your unique id, as long as it doesnt change. I dont have enough
 *  experience to say. WONIDs for your admins MUST be entered into the 
 *  adminhierarchy.txt file and that file must be in your mod directory.
 *  I am not certain, but I think SteamIDs may also be used. We'll see.
 *  I actually dont even know what a SteamID looks like. But since I am
 *  using the new AUTHID scheme in this plugin, it seems like it should
 *  work.  
 *
 * Make sure admin_highlander is set to 0 -- not 1 in your adminmod.cfg
 *  Also change these values in your adminmod.cfg to 1:
 *    allow_client_exec 1
 *    file_access_read 1
 *    file_access_write 1  
 * 
 * How to set up adminhierarchy.txt:
 *
 *  At the beginning of each map, this file is read by the server to see
 *   how it should treat the admins. The format of the file is one admin 
 *   for each line. Rank numbers are not given, it just goes in order top
 *   to bottom. First there is a number 1 or 2 to identify admin type
 *   (then a space), next is the admin's wonid (then a space), next is
 *   optional -- the admin's name just so it is easier for you to see who
 *   is who in the order. The name is not important to the plugin. Type 1 
 *   admins are those who are not limited by this plugin. They can be on
 *   the server all at the same time and all issue "global" commands.
 *   Type 2 admins are the reason for this plugin in the first place. If 
 *   an admin ranking higher than them is on, all the lower ranking type 2
 *   admins will have their power limited by this plugin. All type 1
 *   admins should be listed first, then type 2 in rank order.  
 * 
 *    example of adminhierarchy.txt contents:
 *
 *    1 123454   mynamecuzimtheowner
 *    1 527373   anothername
 *    1 43498    anotherhighadmin
 *    2 8994422  thehiestlowadmin
 *    2 33743    anyoldadmin
 *    2 748433   howiecarr
 *    2 1277344  yetanotheradmin
 *
 *   The file adminhierarchy.txt included in the .zip file is an actual 
 *   working one from my own server provided to be a further example.
 *   You need to change all the info in it to match your admins info of
 *   course if you use it.
 *
 * Known issues: Adminmod has difficulty detecting the first player/admin
 *  or more connecting to the server after a startup or mapchange. As a 
 *  result, the plugin might not detect if a higher admin is on since it
 *  relies on adminmod's connect routine to register an admin present.
 *  My plugin tries to correct for this by allowing an admin to check 
 *  himself in just by chatting, saying anything. Further, when an admin
 *  attempts to use a "global" command, he will be re-registered in the
 *  plugin. So a higher admin will never have his commands denied, even
 *  if he wasnt detected at connect. The only possible error the plugin 
 *  can make is letting a lower admin execute global commands while a
 *  higher admin is on -- which can be remedied by time (eventually the 
 *  higher admin will be picked up) or by the higher admin asserting his
 *  authority by using a "global" command. 
 *
 * Changes/fixes from earlier versions:
 *  8/25/02 Added restricted/enabled indicator to admin_adminstatus.
 *   Added admin_ah_reload / Removed the outdated admin_unresign  
 *  8/02/02 Cloak owner mode bug fixed and now works as it should.
 *  6/29/02 Compliant with adminmod 2.51 (earlier versions not supported)  
 *   Modified reporting of top admins. Included an auto-response to 
 *   players who ask who the top admin is through the chat. Added 
 *   cloaking for server operators. Added a command to list admins who
 *   are connected and report if they are signed in. Auto-sign in mode
 *   can be turned off and that mode set as default from the game via 
 *   the vault.ini data and therefore no re-compiling of the plugin is 
 *   necessary to make that change anymore.  
 *  5/23/02 Added the admin_signin / admin_resign commands with
 *   echo of sign in and announcement of who top admin is.  
 *  5/16/02 Completely re-written to use a text file with admins info
 *   instead of having admins info written write into the .sma thus
 *   making it more user friendly. Also, there is now no limit now to
 *   the numbers of admins you can have (well 200 admins, but that can
 *   change in a few keystrokes if necessary). 
 *  4/30/02 fixed to work with the new adminmod 2.50.26 small compiler.
 *
 **********************************************************************/
