/* Plugin generated by AMXX-Studio */

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

new const perk_name[] = "Mroczne Kule";
new const perk_desc[] = "Zadajesz 15% wiecej obrazen. Masz 1/15 szansy na zabranie przeciwnikowi 100 expa.";
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)
{
        ma_perk[id] = true
}

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

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

	if(!ma_perk[idattacker])
		return HAM_IGNORED;
		
	if(ma_perk[idattacker] && liczba == 15){
		SetHamParamFloat(3, damage * 1.15)
		new xp_zabitego = cod_get_user_xp(this)
		new xp_killera = cod_get_user_xp(idattacker)
		cod_set_user_xp(this, xp_zabitego-100)
		cod_set_user_xp(idattacker, xp_killera+100)
		return HAM_HANDLED
	}
		
	return HAM_IGNORED
}

