od razu mówię ze zapożyczyłem sobie kod z klasy lekki żołnierz oraz itemku Rece MacGyver'a. ( www.pluginymody.webd.pl )
Wygląda on tak, wydaje mi się że wszystko ok, jednak nie działa.
Spoiler
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <fakemeta>
#include <codmod>
#include <colorchat>
new bool:ma_moc[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 };
new const nazwa[] = "Lekki zolnierz";
new const opis[] = "Posiada 1/2 szans ze po wystrzeleniu magazynku nie bedzie trzeba ladowac";
new const bronie = 1<<CSW_FAMAS;
new const zdrowie = 10;
new const kondycja = 30;
new const inteligencja = 0;
new const wytrzymalosc = 5;
public plugin_init() {
register_plugin(nazwa, "1.0", "QTM_Peyote");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
register_forward(FM_CmdStart, "CmdStart");
}
public cod_class_enabled(id)
{
ColorChat(id, GREEN, "Klasa Lekki zolnierz zostala stworzona przez www.pluginymody.webd.pl");
ma_moc[id] = true;
}
public cod_class_disabled(id)
ma_moc[id] = false;
public CmdStart(id, uc_handle)
{
if(!is_user_alive(id) || !ma_moc[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(random_num(1, 4) != 1)
return FMRES_IGNORED;
if((buttons & IN_RELOAD && !(oldbuttons & IN_RELOAD) && !(buttons & IN_ATTACK)) || !clip)
{
fm_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;
}
stock fm_set_user_bpammo(index, weapon, amount)
{
new offset;
switch(weapon)
{
case CSW_AWP: offset = 377;
default:
{
new invalidMsg[20 + 7];
formatex(invalidMsg,20 + 6,"Invalid weapon id %d",weapon);
set_fail_state(invalidMsg);
return 0;
}
}
set_pdata_int(index,offset,amount);
return 1;
}
Przedmiot wygląda tak bez edycji:
Spoiler
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <fakemeta>
#include <colorchat>
#include <codmod>
new const nazwa[] = "Rece MacGyver'a";
new const opis[] = "Masz 1/4 szans, ze po wystrzelaniu magazynku nie bedzie trzeba przeladowac";
new bool:ma_perk[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_perk(nazwa, opis);
register_forward(FM_CmdStart, "CmdStart");
}
public cod_perk_enabled(id)
{
ColorChat(id, GREEN, "Perk %s zostal stworzony przez www.PluginyMody.webd.pl.", nazwa);
ma_perk[id] = true;
}
public cod_perk_disabled(id)
ma_perk[id] = false;
public CmdStart(id, uc_handle)
{
if(!is_user_alive(id) || !ma_perk[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(random_num(1, 4) != 1)
return FMRES_IGNORED;
if((buttons & IN_RELOAD && !(oldbuttons & IN_RELOAD) && !(buttons & IN_ATTACK)) || !clip)
{
fm_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;
}
stock fm_set_user_bpammo(index, weapon, amount)
{
new offset;
switch(weapon)
{
case CSW_AWP: offset = 377;
default:
{
new invalidMsg[20 + 7];
formatex(invalidMsg,20 + 6,"Invalid weapon id %d",weapon);
set_fail_state(invalidMsg);
return 0;
}
}
set_pdata_int(index,offset,amount);
return 1;
}
Może macie pomysł co źle? Pozdrawiam.
Użytkownik Zielony Smerf edytował ten post 08.02.2011 18:41