Zobacz:
#define EXTRAOFFSET_WEAPONS 4
public give_scout(id)
{
new ent = fm_give_item(id, "weapon_scout"); //jaka born ma byc dodana
fm_set_weapon_ammo(ent, 0) //tutaj wpisujemy ilosc ammo
return PLUGIN_HANDLED
}
// From fakemeta_util
stock fm_create_entity(const classname[])
return engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, classname))
stock fm_set_weapon_ammo(weapon_id, ammo)
{
set_pdata_int(weapon_id, 51, ammo, EXTRAOFFSET_WEAPONS);
}
// From fakemtea_util
stock fm_give_item(index, const item[])
{
if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
return 0;
new ent = fm_create_entity(item);
if (!pev_valid(ent))
return 0;
new Float:origin[3];
pev(index, pev_origin, origin);
set_pev(ent, pev_origin, origin);
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
dllfunc(DLLFunc_Spawn, ent);
new save = pev(ent, pev_solid);
dllfunc(DLLFunc_Touch, ent, index);
if (pev(ent, pev_solid) != save)
return ent;
engfunc(EngFunc_RemoveEntity, ent);
return -1;
}
Tu ustawiasz:
new ent = fm_give_item(id, "weapon_scout"); //jaka born ma byc dodana
fm_set_weapon_ammo(ent, 0) //tutaj wpisujemy ilosc ammo