下面是引用 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)
}
紅色部分是你錯誤或是缺少的內容。
參考資料:
我的經驗值…