
/* 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
*
*   set ta_warning_mode "" to disable ta_warning plugin 
*
*   default ta_warning_mode is "ab"
*
*/

#include <amxmod>

public damage_msg(id)
{
        new enemy_name[32]
        new enemy_id = get_user_attacker(id)
        get_user_name(enemy_id,enemy_name,32)
	if (get_user_team(id) == get_user_team(enemy_id))
{
	if (id != enemy_id)
{
        new tawarnmode[8]
        get_cvar_string("ta_warning_mode",tawarnmode,8)
        new tawarnmode_bit = read_flags(tawarnmode)
        if (tawarnmode_bit & 1)
{ 
        set_hudmessage(250, 0, 0, -1.0, 0.30, 0, 3.0, 3.0, 0.5, 0.15, 2)
        show_hudmessage(enemy_id,"Attention, this is a teammate!!!")
}
        if (tawarnmode_bit & 2)
{
        set_hudmessage(250, 0, 0, -1.0, 0.30, 0, 5.0, 5.0, 0.5, 0.15, 2)
        show_hudmessage(id,"your teammate %s attacked you!!!", enemy_name)
}
}
}
	return PLUGIN_CONTINUE
}

public plugin_init()
{
	register_plugin("TA warning","0.1b","iaby")
    	register_event("Damage", "damage_msg", "b", "2!0", "3=0", "4!0")
        register_cvar("ta_warning_mode","ab")
	return PLUGIN_CONTINUE
}


