Ufff tyle pracy.
Nie jestem pewien działania 1/1 na kradzież perku
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <codmod>
#include <engine>
#include <colorchat>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
new const nazwa[] = "Zlodziej";
new const opis[] = "Ma zmniejszona widocznosc oraz 1/1 szansy na zabranie perku swojej ofierze";
new const bronie = 1<<CSW_GALIL | 1<<CSW_AWP | 1<<CSW_DEAGLE | 1<<CSW_FLASHBANG | 1<<CSW_HEGRENADE;
new const zdrowie = 50;
new const kondycja = 35;
new const inteligencja = 35;
new const wytrzymalosc = 25;
new bool:ma_klase[33];
new ofiara[33], perk_ofiary[33], wartosc_perku_ofiary[33];
new const max_clip[31] = { -1, 13, -1, 10, 1, 7, 1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 };
public plugin_init() {
register_plugin(nazwa, "1.0", "QTM_Peyote");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
register_event("DeathMsg", "DeathMsg", "ade");
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
RegisterHam(Ham_TakeDamage, "player", "TakeDamage2");
register_forward(FM_CmdStart, "CmdStart");
}
public cod_class_enabled(id)
{
set_rendering(id,kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 10);
ma_klase[id] = true;
ColorChat(id, GREEN, "Klasa %s zostala dla Cs-Agropol.pl", nazwa);
ColorChat(id, GREEN, "Zmodyfikowana przez www.Cs-Agropol.pl");
}
public cod_class_disabled(id)
{
set_rendering(id,kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255);
ma_klase[id] = false;
}
public DeathMsg()
{
new killer = read_data(1);
new victim = read_data(2);
if(!is_user_connected(killer))
return;
if(!ma_klase[killer])
return;
if(random(1))
return;
if(!(perk_ofiary[killer] = cod_get_user_perk(victim, wartosc_perku_ofiary[killer])))
return;
ofiara[killer] = victim;
Zapytaj(killer);
}
public Zapytaj(id)
{
new tytul[55];
new nazwa_perku[33];
cod_get_perk_name(perk_ofiary[id], nazwa_perku, 32);
format(tytul, 54, "Czy chcesz ukrasc perk: %s ?", nazwa_perku);
new menu = menu_create(tytul, "Zapytaj_Handle");
menu_additem(menu, "Tak");
menu_setprop(menu, MPROP_EXITNAME, "Nie");
menu_display(id, menu);
}
public Zapytaj_Handle(id, menu, item)
{
new nick_zlodzieja[33];
get_user_name(id, nick_zlodzieja, 32);
ColorChat(ofiara[id], RED, "Twoj perk zostal skradziony przez %s.", nick_zlodzieja);
cod_set_user_perk(ofiara[id], 0);
cod_set_user_perk(id, perk_ofiary[id], wartosc_perku_ofiary[id]);
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(!ma_klase[idattacker])
return HAM_IGNORED;
if(get_user_weapon(idattacker) == CSW_AWP && damagebits & DMG_BULLET && damage > 20.0)
cod_inflict_damage(idattacker, this, float(get_user_health(this))-damage+1.0, 0.0, idinflictor, damagebits);
return HAM_IGNORED;
}
public TakeDamage2(this, idinflictor, idattacker, Float:damage, damagebits)
{
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(!ma_klase[idattacker])
return HAM_IGNORED;
if(get_user_weapon(idattacker) == CSW_HEGRENADE && damagebits & DMG_BULLET && damage > 20.0)
cod_inflict_damage(idattacker, this, float(get_user_health(this))-damage+1.0, 0.0, idinflictor, damagebits);
return HAM_IGNORED;
}
public CmdStart(id, uc_handle)
{
if(!is_user_alive(id) || !ma_klase[id])
return FMRES_IGNORED;
new buttons = get_uc(uc_handle, UC_Buttons);
new oldbuttons = pev(id, pev_oldbuttons);
new clip, ammo, weapon = get_user_weapon(id, clip, ammo);
if(max_clip[weapon] == -1 || !ammo)
return FMRES_IGNORED;
if((buttons & IN_RELOAD && !(oldbuttons & IN_RELOAD) && !(buttons & IN_ATTACK)) || !clip)
{
cs_set_user_bpammo(id, weapon, ammo-(max_clip[weapon]-clip));
new new_ammo = (max_clip[weapon] > ammo)? clip+ammo: max_clip[weapon]
set_user_clip(id, new_ammo);
}
return FMRES_IGNORED;
}
stock set_user_clip(id, ammo)
{
new weaponname[32], weaponid = -1, weapon = get_user_weapon(id, _, _);
get_weaponname(weapon, weaponname, 31);
while ((weaponid = engfunc(EngFunc_FindEntityByString, weaponid, "classname", weaponname)) != 0)
if (pev(weaponid, pev_owner) == id) {
set_pdata_int(weaponid, 51, ammo, 4);
return weaponid;
}
return 0;
}