
   /* AMXMOD script.
   *
   * This file is provided as is (no warranties).
   *
   */
   /*
   *  This  plugin  adds  on  to  the default logging in the admincmd.sma
   plugin.
   *  If  there are more commands that you wish to log simply add them to
   the
   *  plugin_ini()  section.  There  are  two  functions  that handle the
   logging,
   *  one for player actions and one for server actions.
   *
   *  The default is to log to 2 different files, both defined by cvars:
   *     amx_playerlog_file "addons/amx/adminplayer.log"
   *     amx_serverlog_file "addons/amx/adminserver.log"
   *
   *  IMPORTANT:  This  file must be above the admincmd.amx pluing in the
   plugins.ini file!
   */
   #include <amxmod>
   public admin_logplayercmd(id)
   {
       new PLAYER_LOG_FILE[192]
       get_cvar_string("amx_playerlog_file",PLAYER_LOG_FILE,192)
       new thecmd[32]
       read_argv(0,thecmd,32)
       new arg[32]
       read_argv(1,arg,32)
       new player = find_player("b",arg)
       if(!player)
           player = find_player("c",arg)
       if (player)
       {
           if (!(get_user_flags(player)&ADMIN_IMMUNITY))
           {
               new authid[16],authid2[16],name2[32],name[32],userid2
               get_user_authid(id,authid,16)
               get_user_authid(player,authid2,16)
               get_user_name(player,name2,32)
               get_user_name(id,name,32)
               userid2 = get_user_userid(player)
               log_to_file(PLAYER_LOG_FILE,"^"%s<%d><%s><>^"           %s
   ^"%s<%d><%s><>^"",
                   name,get_user_userid(id),authid,thecmd,name2,userid2,a
   uthid2 )
           }
       }
       return PLUGIN_CONTINUE
   }
   public admin_logservercmd(id)
   {
       new SERVER_LOG_FILE[192]
       get_cvar_string("amx_serverlog_file",SERVER_LOG_FILE,192)
       if   ((get_user_flags(id)   &  ADMIN_RCON)||(get_user_flags(id)  &
   ADMIN_CFG)||(get_user_flags(id)  &  ADMIN_CVAR)||(get_user_flags(id) &
   ADMIN_MAP))
       {
           new thecmd[32]
           read_argv(0,thecmd,32)
           new message[192]
           read_args(message,192)
           new authid[16],name[32]
           get_user_authid(id,authid,16)
           get_user_name(id,name,32)
           log_to_file(SERVER_LOG_FILE,"^"%s<%d><%s><>^" %s ^"%s^"",
               name,get_user_userid(id),authid, thecmd, message)
       }
       return PLUGIN_CONTINUE
   }
   public plugin_init()
   {
       register_plugin("Admin Log Commands","0.1","default")
       register_clcmd("amx_kick","admin_logplayercmd",ADMIN_KICK,"Kick
   Log Alias")
       register_clcmd("amx_ban","admin_logplayercmd",ADMIN_BAN,"Ban   Log
   Alias")
       register_clcmd("amx_slay","admin_logplayercmd",ADMIN_SLAY,"Slay
   Log Alias")
       register_clcmd("amx_slay2","admin_logplayercmd",ADMIN_SLAY,"Slay2
   Log Alias")
       register_clcmd("amx_map","admin_logservercmd",ADMIN_MAP,"Map   Log
   Alias")
       register_clcmd("amx_cvar","admin_logservercmd",ADMIN_CVAR,"Cvar
   Log Alias")
       register_clcmd("amx_cfg","admin_logservercmd",ADMIN_CFG,"Config
   Log Alias")
       register_clcmd("amx_rcon","admin_logservercmd",ADMIN_RCON,"Rcon
   Log Alias")
       register_cvar("amx_playerlog_file","addons/amx/adminplayer.log")
       register_cvar("amx_serverlog_file","addons/amx/adminserver.log")
       return PLUGIN_CONTINUE
   }
