/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <engine>
#include <fakemeta_util>
#include <codmod>


new const nazwa[] = "Szybka Bron"
new const opis[] = "Masz o LW procent wieksza szybkosc strzelania"

new bool: ma_perk[33]
new wartosc_perku[33];

static const g_szWpnEntNames[] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
	"weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
	"weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
	"weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
	"weapon_ak47", "weapon_knife", "weapon_p90" }

public plugin_init() 
{
	register_plugin(nazwa, "1.0", "Hleb")
	cod_register_perk(nazwa, opis, 25, 50)
	register_event("CurWeapon","CurWeapon","be", "1=1");
}
public cod_perk_enabled(id, wartosc)
{
	ma_perk[id] = true;
	wartosc_perku[id] = wartosc;
}
public cod_perk_disabled(id)
{
	ma_perk[id] = false;
}
public CurWeapon(id)
{
	if(!is_user_connected(id) || !is_user_alive(id) || !ma_perk[id])
		return PLUGIN_CONTINUE;
		
	new iEnt;
	
	static Float:fSpeedMultiplier;
	
	fSpeedMultiplier = floatdiv(1.0, 1.0+(float(wartosc_perku[id])/100.0));
	
	for (new i = 1; i < sizeof g_szWpnEntNames; i++)
	{
		iEnt = fm_find_ent_by_owner(-1, g_szWpnEntNames[i], id)
			
		if(iEnt)
		{
			set_pdata_float( iEnt, 46, ( get_pdata_float(iEnt, 46, 4) * fSpeedMultiplier), 4 );
			set_pdata_float( iEnt, 47, ( get_pdata_float(iEnt, 47, 4) * fSpeedMultiplier), 4 );
		}
	}
	return PLUGIN_CONTINUE;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
