/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <codmod>
#include <hamsandwich>
#define DMG_BULLET (1<<1)


new const nazwa[] = "Strzelec Wyborowy";
new const opis[] = "DMG +5 (+inteligencja)";
new const bronie = 1<<CSW_M4A1;
new const zdrowie = 0;
new const kondycja = 10;
new const inteligencja = 0;
new const wytrzymalosc = 0;
new bool:ma_klase[33];

public plugin_init() {
	register_plugin(nazwa, "1.0", "QTM_Peyote");
	RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
	
	cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
}

public cod_class_enabled(id)
ma_klase[id] = true;

public cod_class_disabled(id)
ma_klase[id] = false;

public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
                                if(!is_user_connected(idattacker))
                                                                return HAM_IGNORED; 

                                if(!ma_klase[idattacker])
                                                                return HAM_IGNORED;

                                if(damagebits & DMG_BULLET)
                                {
                                                                new weapon = get_user_weapon(idattacker);
                                                                if(weapon == CSW_M4A1)
                                                                                                cod_inflict_damage(idattacker, this, 5.0, 0.3, idinflictor, damagebits);                                
                                }

                                return HAM_IGNORED;
}
