
   /* AMX Mod script.
   *
   * (c) Copyright 2003, [CCC]Taz-Deveil
   * This file is provided as is (no warranties).
   * [CCC]Taz-Devil Plugin's
   * * amx_awp_mode <flags> -
   *  "a"  -  lost n HP after each shooting / perds n points de vie apres
   chaque tir
   * "b" - slap him after each shooting / slap le joueur apres chaque tir
   *  "c"  -  slay  him  when his health is inferior "amx_awppv" / Tue le
   joueur quand sa vie est inferieur a celle définie a "amx_awppv"
   inferieur a celle définie a "amx_awppv"
   * "d" - disable this plug with map's name contain "awp" / désactive le
   plug si le nom de la map contient awp
   * amx_awp_mode "a" lost "amx_awppv" HP after each shooting but no kill
   him  / perds "amx_awppv" points de vie apres chaque tir mais ne le tue
   pas
   *  amx_awp_mode  "b"  slap  him  but no decrease Health / le slap mais
   n'enleve aucun point de vie
   *  amx_awp_mode  "c"  slay  him  when  is  life  is  inferior  to slap
   "amx_awppv" / le tue quand son nivo de vie est inferieur a "amx_awppv"
   *  amx_awp_mode  "ac" decrease his health and slay him when his health
   is  inferior  "amx_awppv" / Enleve de la vie et le tue le joueur quand
   sa vie est sa vie est inferieur a celle définie a "amx_awppv"
   *  amx_awp_mode  "bc" slap but no decrease Health and slay him hen his
   health  is inferior "amx_awppv" / le slap et le tue le joueur quand sa
   vie est inferieur a celle définie a "amx_awppv"
   *  amx_awp_mode  "abc" slap/decrease health / slay him when is life is
   inferior  to  slap  "amx_awppv"  /  le slap et enleve de la vie et tue
   quand son nivo de vie est inferieur a "amx_awppv"
   * Thanks :
   * To OLO, Djeyl, www.ServeGamers.com and amx communauty
   * www.countercheat.com
   *  This plug is a multi-language plug. 0 -> English, 1-> francais, 2->
   Deutsch
   * Cvars to add on your server.cfg
   * // AWP health punish example
   * amx_awp_mode "abcd"
   * amx_awppv 10
   * AwpEnabled 1
   * Amx_plugin_language 0
   */
   #include <amxmod>
   #include <amxmisc>
   #define ACCESS_AWPHP ADMIN_LEVEL_A
   /* This part it's for multilanguage */
   new language = 0 /* 0= English  1= Francais 2= Deutsch */
   new  TxtModeAwp[3][] = {"[AMX] Awp mode TH enabled to","[AMX] Awp mode
   TH actif to","[AMX] Awp mode TH = "}
   new  TxtMessageFire[3][]  = {"When you R fire you loose","A chaque tir
   tu perds","Bei jedem Schuss verlierst Du"}
   new  TxtActivate[3][]  = {"Awp TH activate !!","Awp TH activé !!","Awp
   TH hat begonnen !!"}
   new  TxtUnactivate[3][]  = {"Awp TH is disable !!","Awp TH est inactif
   !!","Awp TH wurde beendet !!"}
   /* End language part   */
   new lastwpn[33]
   new lastammo[33]
   new white, smoke
   new powerPV = 0
   new smode[8]
   public explode(playerSlay) {
       new vec1[3]
       get_user_origin(playerSlay,vec1)
       // 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
       write_byte( 16 ) // width
       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)
       write_byte( 10 ) // byte (framerate)
       message_end()
       //Smoke
       message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
       write_byte( 5 )
       write_coord(vec1[0])
       write_coord(vec1[1])
       write_coord(vec1[2])
       write_short( smoke )
       write_byte( 2 )
       write_byte( 10 )
       message_end()
       user_kill(playerSlay,1)
   }
   public playsoundtoall(VarWave[]){
      new players[32], inum
      get_players(players,inum,"a")
      for(new i = 0 ;i < inum ;++i) {
         emit_sound(players[i],CHAN_ITEM,  VarWave,  1.0,  ATTN_NORM,  0,
   PITCH_NORM)
      }
   }
   public func_server() {
       language = get_cvar_num("Amx_plugin_language")
       powerPV = get_cvar_num("amx_awppv")
       get_cvar_string("amx_awp_mode",smode,7)
       return PLUGIN_CONTINUE
   }
   public amx_awpenable(id,level,cid) {
       if (!cmd_access(id,level,cid,2)) {
           return PLUGIN_HANDLED
       }
       if (read_argc() != 2) {
           client_print(id,print_console,"[AMX] Usage: amx_awp <1 | 0>")
           return PLUGIN_HANDLED
       }
       new argstr[12]
       read_argv(1,argstr,12)
       new arg = str_to_num(argstr)
       if ((arg != 1) && (arg != 0)) {
           client_print(id,print_console,"[AMX] Usage: amx_awp <1 | 0>")
           return PLUGIN_HANDLED
       }
       client_print(id,print_console,"%s %i",TxtModeAwp[language],arg)
       set_hudmessage(100, 100,0, 0.05,0.60, 0, 6.0, 6.0, 0.5, 0.15, 2)
       if (arg == 1)
           show_hudmessage(0,"%s",TxtActivate[language])
       if (arg == 0)
           show_hudmessage(0,"%s",TxtUnactivate[language])
       set_cvar_num("AwpEnabled",arg )
       playsoundtoall("items/nvg_on.wav")
       return PLUGIN_HANDLED
   }
   public Awpfire(id) {
       new Awpactive = get_cvar_num("AwpEnabled")
       if (Awpactive== 1) {
           new wpn = read_data(2)
           new ammo = read_data(3)
           if ( (lastwpn[id]==wpn) && (lastammo[id]>ammo)) {
               awp_mode(id)
           }
           lastwpn[id] = wpn
           lastammo[id] = ammo
       }
       return PLUGIN_CONTINUE
   }
   public awp_mode(id) {
       func_server()
       new imode=read_flags(smode)
       new user_health = get_user_health(id)
       if ((imode&4) && (user_health <= powerPV)) {
           explode(id)
           return PLUGIN_CONTINUE
       }
       if ((imode&1) && (user_health > powerPV)) {
           set_user_health(id,(user_health-powerPV))
           client_print(id,print_chat," %s %i
   HP",TxtMessageFire[language],powerPV)
       }
       if (imode&2) {
           user_slap(id,0)
       }
       return PLUGIN_CONTINUE
   }
   public plugin_precache() {
       precache_sound("items/nvg_on.wav")
       smoke = precache_model("sprites/steam1.spr")
       white = precache_model("sprites/white.spr")
       return PLUGIN_CONTINUE
   }
   public awp_mapname(){
       new mapname[33]
       new Awpactive = get_cvar_num("AwpEnabled")
       if (Awpactive ==1) {
           get_cvar_string("amx_awp_mode",smode,7)
           new imode=read_flags(smode)
           get_mapname(mapname,32)
           if ((containi(mapname,"awp")!=-1) && (imode&8)) {
               set_cvar_num("AwpEnabled",0)
           }
       }
       return PLUGIN_CONTINUE
   }
   public plugin_init(){
       register_plugin("Awppunish","9.4.0","[CCC]Taz-Devil")
       register_event("CurWeapon","Awpfire","be","1=1","2=18","3>0")
       register_concmd("amx_awp","amx_awpenable",ACCESS_AWPHP,"amx_awp <1
   | 0>")
       register_cvar("Amx_plugin_language","0",FCVAR_SERVER)
       register_cvar("amx_awppv","10",FCVAR_SERVER)
       register_cvar("AwpEnabled","1",FCVAR_SERVER)
       register_cvar("amx_awp_mode","acd")
       set_task(4.0,"awp_mapname")
       return PLUGIN_CONTINUE
   }
