/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <hamsandwich>
#include <codmod>

#define DMG_BULLET (1<<1) 

new const perk_name[] = "Weteran Noza"
new const perk_desc[] = "Zadajesz dodatkowe 40(+inteligencja) obrazen nozem"

new bool:ma_perk[33]

new komandos_id;

public plugin_init() 
{
	register_plugin(perk_name, "1.0", "QTM_Peyote")
	
	cod_register_perk(perk_name, perk_desc)
	RegisterHam(Ham_TakeDamage, "player", "TakeDamage")
	
	komandos_id = cod_get_classid("Komandos");
}


public cod_perk_enabled(id)
{
	if(cod_get_user_class(id) == komandos_id)
		return COD_STOP;
			
	ma_perk[id] = true;
	return COD_CONTINUE;
}

public cod_perk_disabled(id)
	ma_perk[id] = false;

public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
	if(!is_user_connected(idattacker))
		return HAM_IGNORED;
	
	if(!ma_perk[idattacker])
		return HAM_IGNORED;
		
	if(get_user_team(this) != get_user_team(idattacker) && get_user_weapon(idattacker) == CSW_KNIFE && damagebits & DMG_BULLET)
		cod_inflict_damage(idattacker, this, 40.0, 1.0, idinflictor, damagebits);
		
	return HAM_IGNORED;
}
