
   /* AMX Mod script.
   *
   * AMX Firstblood Plugin
   *
   * (c) Copyright 2002-2003, sonic 'sonic@codet.de'
   * This file is provided as is (no warranties).
   *
   */
   /*  Put in server.cfg:
   *
   *   amx_fb_mode < flags >
   *   "a" - show firstblood msg in hud
   *   "b" - show firstblood msg in chat
   *   "c" - play firstblood sound
   *   "d" - show attacker @ fistblood msg
   *   "e" - set firstblood msg to damage_event (default death_event)
   *
   *   Set amx_fb_mode "" to disable fistblood plugin
   *   Default amx_fb_mode is "ac"
   */
   #include <amxmod>
   public new_round() {
      if ((get_cvar_num("mp_roundtime") * 60) == read_data(1)) {
         new fbmode[8]
         get_cvar_string("amx_fb_mode",fbmode,7)
         new fbmode_bit = read_flags(fbmode)
         if (fbmode_bit & 16) {
            unpause("b","damage_msg")
         }
         else
            unpause("b","death_msg")
      }
      return PLUGIN_CONTINUE
   }
   public death_msg() {
      new aIndex = read_data(1)
      new vIndex = read_data(2)
      if ( !aIndex || aIndex==vIndex ||
   get_user_team(aIndex)==get_user_team(vIndex))
         return PLUGIN_CONTINUE
      fb_event(aIndex,vIndex)
      pause("b","death_msg")
      return PLUGIN_CONTINUE
   }
   public damage_msg() {
      new vIndex = read_data(0)
      new aIndex = get_user_attacker(vIndex)

      if ( !aIndex || aIndex==vIndex ||
   get_user_team(aIndex)==get_user_team(vIndex))
         return PLUGIN_CONTINUE
      fb_event(aIndex,vIndex)
      pause("b","damage_msg")
      return PLUGIN_CONTINUE
   }
   public fb_event(aIndex,vIndex) {
      new msg[128], fbmode[8]
      get_cvar_string("amx_fb_mode",fbmode,7)
      new fbmode_bit = read_flags(fbmode)

      if (fbmode_bit & 8) {
         new aName[32]
         get_user_name(aIndex,aName,31)
         format(msg,127,"%s: First Blood!",aName)
      }
      else
         format(msg,127,"First Blood!")

      if (fbmode_bit & 1) {
         set_hudmessage(220,80,0,-1.0,0.30,0, 6.0, 5.0, 1.0, 2.0, 2)
         show_hudmessage(0,msg)
      }
      if (fbmode_bit & 2)   client_print(0,print_chat,"[AMX] %s",msg)
      if (fbmode_bit & 4)   client_cmd(0,"spk misc/firstblood")
      return PLUGIN_CONTINUE
   }
   public plugin_init() {
      register_plugin("FirstBlood","0.9.3","Sonic (sonic@codet.de)")
      register_event("RoundTime", "new_round", "bc")
      register_event("DeathMsg","death_msg","a")
      register_event("Damage", "damage_msg","b","2!0","4!0")
      register_cvar("amx_fb_mode","ace")
      pause("b","death_msg")
      pause("b","damage_msg")
      return PLUGIN_CONTINUE
   }
