/* Plugin generated by AMXX-Studio */

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

#define TASK_PALACE_REKAWICZKI -736

new const perk_name[] = "Palace Rekawiczki";
new const perk_desc[] = "Co 5 sekund dostajesz granat wybuchowy";


new bool:ma_perk[33];

public plugin_init() 
{
	register_plugin(perk_name, "1.0", "Play");
	
	cod_register_perk(perk_name, perk_desc);
}

public cod_perk_enabled(id)
{
	if(cod_get_user_class(id) == cod_get_classid("Gogus [MegaP]"))
		return COD_STOP;

	ma_perk[id] = true;
	cod_give_weapon(id, CSW_HEGRENADE);
	set_task(5.0, "PalaceRekawiczki", id+TASK_PALACE_REKAWICZKI);
	return PLUGIN_CONTINUE;
}

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

public PalaceRekawiczki(id)
{
	id -= TASK_PALACE_REKAWICZKI;
	
	if(!is_user_connected(id))
		return PLUGIN_CONTINUE;
		
	if(ma_perk[id])
	{
		set_task(5.0, "PalaceRekawiczki", id+TASK_PALACE_REKAWICZKI);
		give_item(id, "weapon_hegrenade");
	}
	
	return PLUGIN_CONTINUE;
}
