/* Plugin generated by AMXX-Studio */

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

 
#define DMG_BULLET (1<<1)

new nazwa[] = "Killer";
new opis[] = "Nie slychac twoich krokow, masz 1/2 szansy na natychmiastowe zabicie z AWP"

new ma_perk[33];

public plugin_init() 
{
	register_plugin(nazwa, "1.0", "Play");
	
	cod_register_perk(nazwa, opis);
	RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
}
public cod_perk_enabled(id)
{
	ma_perk[id] = true;
	set_user_footsteps(id, 1);
	cod_give_weapon(id, CSW_AWP);
}
public cod_perk_disabled(id)
	cod_take_weapon(id, CSW_AWP);
	
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
	if(!is_user_connected(idattacker))
		return HAM_IGNORED; 
	
	if(!ma_perk[idattacker])
		return HAM_IGNORED;
	
	if(damagebits & DMG_BULLET)
	{
		new weapon = get_user_weapon(idattacker);
		
		if(weapon == CSW_AWP && random_num(1,2) == 1) 
			cod_inflict_damage(idattacker, this, float(get_user_health(this))-damage+1.0, 0.0, idinflictor, damagebits);
			
	}
	
	return HAM_IGNORED;
}
