#include <amxmodx>
#include <hamsandwich>
#include <codmod>
#include <colorchat>
#define DMG_BULLET (1<<1)
new const perk_name[] = "Tajemnica Strzelca";
new const perk_desc[] = "Dostajesz M4A1 i Ak47 oraz dodatkowe 10 obrazen z nich";
new bool:ma_perk[33];
public plugin_init()
{
        register_plugin(perk_name, "1.0", "QTM_Peyote");
  
        cod_register_perk(perk_name, perk_desc);
        RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
}
public cod_perk_enabled(id)
{
        cod_give_weapon(id, CSW_M4A1);
        cod_give_weapon(id, CSW_AK47);
        ma_perk[id] = true;
}
public cod_perk_disabled(id)
{
        cod_take_weapon(id, CSW_M4A1);
        cod_take_weapon(id, CSW_AK47);
        ma_perk[id] = false;
}
  
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
        if(!is_user_connected(idattacker))
                return HAM_IGNORED;
  
        if(!ma_perk[idattacker])
                return HAM_IGNORED;
  
        if(get_user_team(this) != get_user_team(idattacker) && get_user_weapon(idattacker) == CSW_M4A1 && damagebits & DMG_BULLET)
                cod_inflict_damage(idattacker, this, 10.0, 0.0, idinflictor, damagebits);

        if(get_user_team(this) != get_user_team(idattacker) && get_user_weapon(idattacker) == CSW_AK47 && damagebits & DMG_BULLET)
                cod_inflict_damage(idattacker, this, 10.0, 0.0, idinflictor, damagebits);

return HAM_IGNORED;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
