/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <engine>
#include <fakemeta> 
#include <fun>
#include <cstrike>
#include <amxmisc>
#include <codmod>


new const perk_name[] = "Vampyric Scepter";
new const perk_desc[] = "Wysysa +LW HP zadawanych obrazen.";

new bool:ma_perk[33]
new player_b_vampire[33] = 0	//Vampyric damage

public plugin_init() 
{
	register_plugin(perk_name, "1.0", "Play");
	
	cod_register_perk(perk_name, perk_desc, 10, 35);
	
	register_event("Damage", "Damage", "b", "2!0")
}
public cod_perk_enabled(id, wartosc)
{
	ma_perk[id] = true;
	player_b_vampire[id] = wartosc;
}
public cod_perk_disabled(id)
{
	player_b_vampire[id] = 0	//Vampyric damage
	ma_perk[id] = false;
}	
public Damage(id)
{
	if (is_user_connected(id))
	{
		new damage = read_data(2)
		new weapon
		new bodypart
		new attacker_id = get_user_attacker(id,weapon,bodypart) 
		if (is_user_connected(attacker_id) && attacker_id != id)
			add_vampire_bonus(id,damage,attacker_id)
	}
}
/* ==================================================================================================== */
public add_vampire_bonus(id,damage,attacker_id)
{
	if (player_b_vampire[attacker_id] > 0)
	{
		new maxhealth = 250+cod_get_user_health(attacker_id,1,1,1)
		
		
		if (get_user_health(attacker_id)+player_b_vampire[attacker_id] <= maxhealth)
		{
			set_user_health(attacker_id,get_user_health(attacker_id)+player_b_vampire[attacker_id])
		} 
		else 
		{
			set_user_health(attacker_id,maxhealth)
		}
	}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
