
   /* Admin Posion.
   *
   * (c) Copyright 2002-2003, AssKicR
   * This file is provided as is (no warranties).
   */
   #include <amxmod>
   #include <amxmisc>
   /*
   * Usage: amx_poison <nick> <damage/second> <secs>
   * Examples:
   *  amx_poison AssKicR 10 10       - makes AssKicR loose 10hp every sec
   for 10secs
   *  amx_poison  HaXXor  1 100   - makes HaXXor loose 1 hp every sec for
   100secs
   *
   *
   * Know Bugs::
   * None
   *
   */
   new g_isPoisoned[33]
   new g_PoisonDmg[33]
   new g_PoisonTime[33]
   new gmsgDamage
   new logfilename[256]
   //--------------------------------------------------------------------
   --------------------------
   public plugin_init()
   {
     // Plugin Info
     register_plugin("Admin Poison","1.1","AssKicR")
     register_concmd("amx_poison","cmdPoison",ADMIN_SLAY,"<nick>
   <damage/second> <secs>")
     set_task(1.0,"posion_loop",0,"",0,"b" )
     register_event("DeathMsg","death","a")
     register_event("ResetHUD","newround","b")
     get_time("addons/amx/logs/admin%m%d.log",logfilename,255)
     gmsgDamage = get_user_msgid("Damage")
   }
   //--------------------------------------------------------------------
   --------------------------
   public posion_loop()
   {
     for ( new id=1; id<=32; id++ ) {
       if (  g_isPoisoned[id] && is_user_alive(id)  )
       {
       if ( is_user_alive(id) )
       {
           new userHealth=get_user_health(id)
           set_user_health(id, userHealth - g_PoisonDmg[id] )
           g_PoisonTime[id]=(g_PoisonTime[id]-1)
           if (g_PoisonTime[id]<=0) {
               g_isPoisoned[id]=false
           }
       if ( userHealth - g_PoisonDmg[id] <= 0 ) {
           message_begin( MSG_BROADCAST,
   get_user_msgid("DeathMsg"),{0,0,0},0)
           write_byte(id)
           write_byte(id)
           write_byte(0)
           write_string("infection")
           message_end()
           }
       }
       new korigin[3]
       get_user_origin(id,korigin)
       message_begin(MSG_ONE, gmsgDamage, {0,0,0}, id)
       write_byte(30) // dmg_save
       write_byte(30) // dmg_take
       write_long((1 << 16)) // visibleDamageBits
       write_coord(korigin[0]) // damageOrigin.x
       write_coord(korigin[1]) // damageOrigin.y
       write_coord(korigin[2]) // damageOrigin.z
       message_end()
      }
     }
   }
   //--------------------------------------------------------------------
   --------------------------
   //--------------------------------------------------------------------
   --------------------------
   public client_connect(id) {
   g_isPoisoned[id]=false
   }
   //--------------------------------------------------------------------
   --------------------------
   public client_disconnect(id) {
   g_isPoisoned[id]=false
   }
   //--------------------------------------------------------------------
   --------------------------
   public death() {
   new id = read_data(2)
   g_isPoisoned[id]=false
   }
   //--------------------------------------------------------------------
   --------------------------
   public newround(id) {
   g_isPoisoned[id]=false
   }
   //--------------------------------------------------------------------
   --------------------------
   public cmdPoison(id,level,cid){
     if (!cmd_access(id,level,cid,2))
       return PLUGIN_HANDLED

     new arg[32]
     read_argv(1,arg,31)
     new player = cmd_target(id,arg,5)
     if (!player) return PLUGIN_HANDLED
     new spower[32],authid[16],name2[32],authid2[16],name[32],newarg[32]
     read_argv(2,spower,31)
     new damage = strtonum(spower)

     read_argv(3,newarg,31)
     new ptime = strtonum(newarg)
     if (damage == 0 && ptime == 0) {
     g_isPoisoned[player]=true
     g_PoisonDmg[player]=1
     g_PoisonTime[player]=99
     }
     if (damage <= 0) {
         client_print(id,print_console,"You  cannot  poison with 0 dmg or
   less")
         return PLUGIN_HANDLED
     }
     if (ptime <= 0) {
         client_print(id,print_console,"You cannot poison for 0 seconds")
         return PLUGIN_HANDLED
     }
     g_isPoisoned[player]=true
     g_PoisonDmg[player]=damage
     g_PoisonTime[player]=ptime
     get_user_authid(id,authid,15)
     get_user_name(id,name,31)
     get_user_authid(player,authid2,15)
     get_user_name(player,name2,31)
     log_to_file(logfilename,"Cmd: ^"%s<%d><%s><>^" posion with %d damage
   each second for %d seconds ^"%s<%d><%s><>^"",
       name,get_user_userid(id),authid, damage,
   ptime,name2,get_user_userid(player),authid2 )

     switch(get_cvar_num("amx_show_activity")) {
     case  2:  client_print(0,print_chat,"ADMIN  %s:  poison  %s  with %d
   damage each second",name,name2,damage)
     case  1:  client_print(0,print_chat,"ADMIN: poison %s with %d damage
   each second",name2,damage)
     }

     return PLUGIN_HANDLED
   }
