
   #include <amxmod>
   #include <amxmisc>
   #include <Vexd_Utilities>
   new boom
   new wall[33]
   new smoke
   new white
   new fire
   //--------------------------------------------------------------------
   --------------------------
   public plugin_init(){
      register_plugin("wall","1.0","AssKicR")
      register_clcmd("amx_wall","Ass_acc_wall",ADMIN_SLAY)
      register_cvar("wall_radius", "0" )
      register_cvar("wall_maxdamage", "0" )
      return PLUGIN_CONTINUE
   }
   //--------------------------------------------------------------------
   --------------------------
   public plugin_precache() {
      precache_model("models/wall.mdl")
      smoke = precache_model("sprites/steam1.spr")
      white = precache_model("sprites/white.spr")
      fire = precache_model("sprites/explode1.spr")
      return PLUGIN_CONTINUE
      }
   //--------------------------------------------------------------------
   --------------------------
   public Ass_acc_wall(id,level,cid) {
      if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
      Ass_wall(id)
      return PLUGIN_CONTINUE
   }
   //--------------------------------------------------------------------
   --------------------------
   public Ass_wall(id) {
      if (!is_user_alive(id)) {
       client_print(id,print_chat,"**** Wall Placement Denied ****")
       return PLUGIN_HANDLED
      }
      if (wall[id] != 0)
      {
         new Float:vExplodeAt[3]
         Entvars_Get_Vector(wall[id], EV_VEC_origin, vExplodeAt)
         blowUp(id, vExplodeAt)
         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
         write_byte(3)
         write_coord(floatround(vExplodeAt[0]))
         write_coord(floatround(vExplodeAt[1]))
         write_coord(floatround(vExplodeAt[2]))
         write_short(boom)
         write_byte(50)
         write_byte(15)
         write_byte(0)
         message_end()
         RemoveEntity(wall[id])
         client_print(id,print_chat,"**** Wall Detonated ****")
         wall[id] = false
         return PLUGIN_CONTINUE
      } else if (wall[id] == 0) {
         wall[id] = CreateEntity("info_target")
         if(wall[id] == 0) return PLUGIN_HANDLED_MAIN
         Entvars_Set_String(wall[id], EV_SZ_classname, "coool_wall")
         ENT_SetModel(wall[id], "models/wall.mdl")
         Entvars_Set_Float(wall[id], EV_FL_health, 1000.0)
         new Float:MinBox[3]
         new Float:MaxBox[3]
         MinBox[0] = -10.0
         MinBox[1] = -85.0
         MinBox[2] = -125.0
         MaxBox[0] = 10.0
         MaxBox[1] = 85.0
         MaxBox[2] = 125.0
         Entvars_Set_Vector(wall[id], EV_VEC_mins, MinBox)
         Entvars_Set_Vector(wall[id], EV_VEC_maxs, MaxBox)
         new Float:PlayerOrigin[3]
         Entvars_Get_Vector(id, EV_VEC_origin, PlayerOrigin)
         ENT_SetOrigin(wall[id], PlayerOrigin)
         Entvars_Set_Int(wall[id], EV_INT_solid, 2)
         Entvars_Set_Int(wall[id], EV_INT_movetype, 4)
         Entvars_Set_Edict(wall[id], EV_ENT_owner, id)
         new Float:vRetVector[3]
         Entvars_Get_Vector(id, EV_VEC_v_angle, vRetVector)
         vRetVector[0]=float(0)
         Entvars_Set_Vector(wall[id], EV_VEC_angles, vRetVector)
         client_print(id,print_chat,"**** Wall Placed ****")
      }
      return PLUGIN_CONTINUE
   }
   //--------------------------------------------------------------------
   --------------------------
   public blowUp( id, Float:vExplodeAt[3] )
   {
      new distanceBetween
      new damage, multiplier

      new name[32]
      get_user_name(id,name,31)
      set_user_rendering(id,kRenderFxNone,255,255,255, kRenderNormal,16);
      new FFOn= get_cvar_num("mp_friendlyfire")
      new origin[3]
      origin[0]=floatround(vExplodeAt[0])
      origin[1]=floatround(vExplodeAt[1])
      origin[2]=floatround(vExplodeAt[2])+37

      explode(origin) // blowup even if dead

      for(new a = 1; a <= 33; a++)
      {
        if(  is_user_alive(a)  && ( get_user_team(id) != get_user_team(a)
   || FFOn != 0 || a==id ) )
        {
          new origin1[3]
          get_user_origin(a,origin1)
          distanceBetween = get_distance(origin, origin1 )
          if( distanceBetween < get_cvar_num("wall_radius") )
          {
            multiplier=(get_cvar_num("wall_maxdamage")*get_cvar_num("wall
   _maxdamage"))/get_cvar_num("wall_radius")
            damage=(get_cvar_num("wall_radius")-distanceBetween)*multipli
   er
            damage=sqrt(damage)
            ExtraDamage(a, a, damage, "Admin Wall")
          } // distance
        } // alive target...
      } // loop
   }
   //--------------------------------------------------------------------
   --------------------------
   public explode( vec1[3] )
   {
      // blast circles
      message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
      write_byte( 21 )
      write_coord(vec1[0])
      write_coord(vec1[1])
      write_coord(vec1[2] + 16)
      write_coord(vec1[0])
      write_coord(vec1[1])
      write_coord(vec1[2] + 1936)
      write_short( white )
      write_byte( 0 ) // startframe
      write_byte( 0 ) // framerate
      write_byte( 2 ) // life 2
      write_byte( 20 ) // width 16
      write_byte( 0 ) // noise
      write_byte( 188 ) // r
      write_byte( 220 ) // g
      write_byte( 255 ) // b
      write_byte( 255 ) //brightness
      write_byte( 0 ) // speed
      message_end()
      //Explosion2
      message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
      write_byte( 12 )
      write_coord(vec1[0])
      write_coord(vec1[1])
      write_coord(vec1[2])
      write_byte( 188 ) // byte (scale in 0.1's) 188
      write_byte( 10 ) // byte (framerate)
      message_end()
      //TE_Explosion
      message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
      write_byte( 3 )
      write_coord(vec1[0])
      write_coord(vec1[1])
      write_coord(vec1[2])
      write_short( fire )
      write_byte( 60 ) // byte (scale in 0.1's) 188
      write_byte( 10 ) // byte (framerate)
      write_byte( 0 ) // byte flags
      message_end()
      //Smoke
      message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
      write_byte( 5 ) // 5
      write_coord(vec1[0])
      write_coord(vec1[1])
      write_coord(vec1[2])
      write_short( smoke )
      write_byte( 10 )  // 2
      write_byte( 10 )  // 10
      message_end()
   }
   //--------------------------------------------------------------------
   --------------------------
   /* Do Exta Damage to a Player */
   public ExtraDamage(id, attacker, damage, weaponDescription[] )
     {
        if ( is_user_alive(id) )
        {
          new userHealth=get_user_health(id)
          set_user_health(id, userHealth - damage )
          if ( userHealth - damage <= 0 )
          {
            logKill(attacker,id, weaponDescription)
            if ( get_user_team(id) != get_user_team(attacker) )
            {
              //  The person dying shouldn't get negative credit for this
   kill (so add it back)
              set_user_frags( id, get_user_frags(id) + 1 )

              // The killing should get credit for the frag
              set_user_frags( attacker, get_user_frags(attacker)+ 1 )
            }
            else
            {
              //  The person dying shouldn't get negative credit for this
   kill (so add it back)
              set_user_frags( id, get_user_frags(id)+ 1 )

              // The killer killed a teammember or self
              // Engine gives credit for the kill so let's take away that
   + 1
              set_user_frags( attacker, get_user_frags(attacker) - 2)

            }

            message_begin( MSG_BROADCAST,
   get_user_msgid("DeathMsg"),{0,0,0},0)
            write_byte(attacker)
            write_byte(id)
            write_byte(0)
            write_string(weaponDescription)
            message_end()
          }
        }
     }
   //--------------------------------------------------------------------
   --------------------------
   /* Log a kill using standard HL-logging format */
   public logKill(attacker, victim, weaponDescription[] )
     {
       //Save Hummiliation
       new namea[24],namev[24],authida[20],authidv[20],teama[8],teamv[8]

       //Info On Attacker
       get_user_name(attacker,namea,23)
       get_user_team(attacker,teama,7)
       get_user_authid(attacker,authida,19)
       //Info On Victim
       get_user_name(victim,namev,23)
       get_user_team(victim,teamv,7)
       get_user_authid(victim,authidv,19)
       //Log This Kill
       log_message("^"%s<%d><%s><%s>^"   killed  ^"%s<%d><%s><%s>^"  with
   ^"%s^"",
       namea,get_user_userid(attacker),authida,teama,namev,get_user_useri
   d(victim),authidv,teamv, weaponDescription )
     }
   //--------------------------------------------------------------------
   --------------------------
   public sqrt(num)
     {
      // Cool - Newton's Method - Ludwig
      new div = num
      new result = 1
      while (div > result)
      {  // end when div == result, or just below
         div = (div + result) / 2 // take mean value as new divisor
         result = num / div
      }
      return div
     }
   //--------------------------------------------------------------------
   --------------------------
   public vexd_pfntouch(pToucher, pTouched) {
      new pToucherClassname[32]
      new pTouchedClassname[32]
      Entvars_Get_String(pToucher,   EV_SZ_classname,  pToucherClassname,
   31)
      Entvars_Get_String(pTouched,   EV_SZ_classname,  pTouchedClassname,
   31)
      if  (equal(pToucherClassname,"bullet")  && equal(pTouchedClassname,
   "coool_wall") ) {
            RemoveEntity(pToucher)
            Entvars_Set_Float(pTouched, EV_FL_health, 1000.0)
      }
   }
   //--------------------------------------------------------------------
   --------------------------AMXMOD?>
