
   /*
       Credits:
       - Original source for amx_ban command by OLO
       - Changes made by Gambit
       Description:
           Adds command amx_banx with access level equal
           to kick level, and cvar amx_banx_time.  When
           amx_banx is used it will ban the target for
           "amx_banx_time" number of minutes.  The default
           for amx_banx_time is 1440 (24 hours).
   */
   #include<amxmod>
   #include <amxmisc>
   new logfilename[256]
   public admin_banx(id,level,cid){
       if (!cmd_access(id,level,cid,2))
           return PLUGIN_CONTINUE
       new arg[32]
       read_argv(1,arg,31)
       new player = cmd_target(id,arg,9)
       if (!player) return PLUGIN_HANDLED


       new         minutes[32],authid[16],name2[32],authid2[16],name[32],
   arg3[32]
       new userid2 = get_user_userid(player)

       get_cvar_string("amx_banx_time", minutes, 31)
       get_user_authid(player,authid2,15)
       get_user_authid(id,authid,15)
       get_user_name(player,name2,31)
       get_user_name(id,name,31)
       read_argv(2,arg3,31)
       log_to_file(logfilename,"Ban:   ^"%s<%d><%s><>^"   ban   and  kick
   ^"%s<%d><%s><>^"      (minutes      ^"%s^")      (reason     ^"%s^")",
   name,get_user_userid(id),authid, name2,userid2,authid2,minutes,arg3 )

       if (equal("4294967295",authid2)){ /* lan */
           new ipa[32]
           get_user_ip(player,ipa,31,1)
           server_cmd("addip %s %s;writeip",minutes,ipa)
       }
       else
           server_cmd("banid %s #%d kick;writeid",minutes,userid2)

       new activity = get_cvar_num("amx_show_activity")
       if (activity)    {
           new temp[64], temp2[64]
           if (activity == 1)
               copy(temp,63,"ADMIN:")
           else
               format(temp,63,"ADMIN %s:",name)
           if (strtonum(minutes))
               format(temp2,63,"for %s min.",minutes)
           else
               copy(temp2,63,"permanently")
           client_print(0,print_chat,"%s ban %s %s",temp,name2,temp2)
       }

       console_print(id,"Client ^"%s^" banned",name2)
       return PLUGIN_HANDLED
   }
   public plugin_init() {
       register_plugin("banx","1.0","Gambit")
       register_concmd("amx_banx","admin_banx",ADMIN_KICK,"<authid,  nick
   or #userid> [reason]")
       register_cvar("amx_banx_time","1440")
       get_time("addons/amx/logs/admin%m%d.log",logfilename,255)
       return PLUGIN_CONTINUE
   }
