
   /* AMXMOD script.
   *
   * (c) Copyright 2002, iaby  (iaby@lanetarium.de)
   * This file is provided as is (no warranties).
   *
   *   put in server.cfg:
   *
   *   ta_warning_mode < flags >
   *   "a" - show ta waring msg in hud
   *   "b" - show teamattacker in victim hud
   *   "c" - show attacker to his teammates
   *   "d" - show message on teamkill to everyone
   *
   *
   *   set ta_warning_mode "" to disable ta_warning plugin
   *
   *   default ta_warning_mode is "abd"
   *
   */
   #include <amxmod>
   new playerdead[33]
   public damage_msg(id)
   {
      new enemy_id = get_user_attacker(id)
      if (enemy_id == 0)  //if attacker is a bomb
         return PLUGIN_CONTINUE
      if (playerdead[id] == 1)
         return PLUGIN_CONTINUE
      if (get_user_team(id) == get_user_team(enemy_id)){  //was it really
   a teamattacker?
         if (id != enemy_id){  //attacked the user himself?
            new tawarnmode[8]
            get_cvar_string("ta_warning_mode",tawarnmode,8)
            new tawarnmode_bit = read_flags(tawarnmode)
            new enemy_name[32]
            get_user_name(enemy_id,enemy_name,32)
            set_hudmessage(255,  255,  255, -1.0, 0.20, 0, 3.0, 3.0, 0.1,
   0.5, 1)
            if (tawarnmode_bit & 4){
               for (new i = 1; i < (get_playersnum(1)+1); i++){
                   if (get_user_team(i) == get_user_team(enemy_id)){
                      show_hudmessage(i,"%s           attacked          a
   teammate!!!",enemy_name)
                   }
               }
            }
            if (tawarnmode_bit & 1){
               show_hudmessage(enemy_id,"Attention,     this     is     a
   teammate!!!")
            }
            if (tawarnmode_bit & 2){
               show_hudmessage(id,"Your  teammate  %s  attacked  you!!!",
   enemy_name)
            }
         }
      }
      return PLUGIN_CONTINUE
   }
   public death_msg(){
      new victim = read_data(2)
      playerdead[victim]= 1
      new killer = read_data(1)
      if (killer == 0)
         return PLUGIN_CONTINUE
      if (killer == victim)
         return PLUGIN_CONTINUE
      if (get_user_team(killer) == get_user_team(victim)){
         new tawarnmode[8]
         get_cvar_string("ta_warning_mode",tawarnmode,8)
         new tawarnmode_bit = read_flags(tawarnmode)
         if (tawarnmode_bit & 8){
            new k_name[32]
            get_user_name(killer, k_name, 32)
            set_hudmessage(255,  0, 0, -1.0, 0.20, 0, 3.0, 3.0, 0.1, 0.5,
   1)
            show_hudmessage(0,"%s killed a teammate!!!", k_name)
            }
      }
      return PLUGIN_CONTINUE
   }
   public respawn_msg(id){
      playerdead[id] = 0
   }
   public plugin_init()
   {
       register_plugin("TA warning","0.3","iaby")
           register_event("Damage",   "damage_msg",  "b",  "2!0",  "3=0",
   "4!0")
           register_event("DeathMsg", "death_msg", "a")
           register_event("ResetHUD", "respawn_msg","b")
           register_cvar("ta_warning_mode","abd")
       return PLUGIN_CONTINUE
   }
