下面是引用 Rubbish-Nec 于 2009-12-25 22:34 发表的 请大大看看我的sma:
我写了以下的东西
复制程式
#include <amxmodx> #include <hamsandwich> #include <zombieplague> #include <fun> #include <fakemeta> #include <xs> new const g_item_name[] = { "丧尸急冻手雷" } const g_item_cost = 5 new g_itemid_flashbang public plugin_init() { register_plugin("[ZP] Extra: Flashbang for zombie", "1.0", "Rubbish-.Nec") g_itemid_flashbang = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_ZOMBIE) } public zp_extra_item_selected(player, itemid) { client_print(player, print_chat, "[ZP] 你买了一颗急冻手雷.") fm_give_item(player, "weapon_flashbang") }
这是我改的:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague> new const g_item_name[] = { "丧尸急冻手雷" }
const g_item_cost = 5
new g_itemid_flashbang
public plugin_init()
{
register_plugin("[ZP] Extra: Flashbang for zombie", "1.0", "Rubbish-.Nec")
g_itemid_flashbang = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_ZOMBIE)
}
public zp_extra_item_selected(player, itemid)
{
if ( itemid == g_itemid_flashbang)
{ client_print(player, print_chat, "[ZP] 你买了一颗急冻手雷.")
fm_give_item(player, "weapon_flashbang")
} }
stock fm_give_item(id, const item[])
{
static ent
ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item))
if (!pev_valid(ent)) return;
static Float:originF[3]
pev(id, pev_origin, originF)
set_pev(ent, pev_origin, originF)
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
dllfunc(DLLFunc_Spawn, ent)
static save
save = pev(ent, pev_solid)
dllfunc(DLLFunc_Touch, ent, id)
if (pev(ent, pev_solid) != save)
return;
engfunc(EngFunc_RemoveEntity, ent)
}
红色部分是你错误或是缺少的内容。
参考资料:
我的经验值…