/* Plugin generated by AMXX-Studio */

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

new const perk_name[] = "Bron Smierci";
new const perk_desc[] = "Dostajesz AUG oraz 1/6 na zabicie z niego.";
new bool:ma_perk[32]


public plugin_init() 
{
	register_plugin(perk_name, "1.0", "Czyzyk");
	cod_register_perk(perk_name, perk_desc);
	RegisterHam(Ham_TakeDamage, "player", "TakeDamage", 1)
}
public cod_perk_enabled(id)
{
	cod_give_weapon(id, CSW_AUG)
	ma_perk[id] = true
}

public cod_perk_disabled(id)
{
	cod_take_weapon(id, CSW_AUG)
	ma_perk[id] = false
}

public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
	new liczba = random_num(1,6)
	new weapon = get_user_weapon(idattacker)
	new health = get_user_health(this)
	
	if(!is_user_connected(idattacker))
		return HAM_IGNORED;

	if(!ma_perk[idattacker])
		return HAM_IGNORED;
		
	if(ma_perk[idattacker] && liczba==6 && weapon==CSW_AUG){
		SetHamParamFloat(4, float(health))
		return PLUGIN_HANDLED
	}
		
	return HAM_IGNORED
	
}


