下面是引用 ryoson 於 2011-05-04 22:42 發表的 :
以上的是 ZP 4.2 的?
因為找不到 public menu_zclass(id, key) 有些不同
能發 4.3 的教學嗎? 感謝大大..
4.3為尋找public menu_zclass(id, menuid, item)
會看到這樣
複製程式
public menu_zclass(id, menuid, item)
{
// Menu was closed
if (item == MENU_EXIT)
{
menu_destroy(menuid)
//***** (選單頁面記憶)
g_menu_last_data[id][0] = -1 // reset menu code memory
g_menu_last_data[id][1] = -1 // reset menu id memory
return PLUGIN_HANDLED;
}
// Retrieve zombie class id
static buffer[2], dummy, classid
menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
classid = buffer[0]
// Store selection for the next infection
g_zombieclassnext[id] = classid
static name[32]
ArrayGetString(g_zclass_name, g_zombieclassnext[id], name, charsmax(name))
// Show selected zombie class info and stats
zp_colored_print(id, "^x04[ZP]^x01 %L: %s", id, "ZOMBIE_SELECT", name)
zp_colored_print(id, "^x04[ZP]^x01 %L: %d %L: %d %L: %d %L: %d%%", id, "ZOMBIE_ATTRIB1", ArrayGetCell(g_zclass_hp, g_zombieclassnext[id]), id, "ZOMBIE_ATTRIB2", ArrayGetCell(g_zclass_spd, g_zombieclassnext[id]),
id, "ZOMBIE_ATTRIB3", floatround(Float:ArrayGetCell(g_zclass_grav, g_zombieclassnext[id]) * 800.0), id, "ZOMBIE_ATTRIB4", floatround(Float:ArrayGetCell(g_zclass_kb, g_zombieclassnext[id]) * 100.0))
menu_destroy(menuid)
return PLUGIN_HANDLED;
}
在classid = buffer[0]的後面且在g_zombieclassnext[id] = classid前面加入
static check_name[32]
ArrayGetString(g_zclass_name, classid, check_name, charsmax(check_name))
接著在下面加你要的檢查條件就可以了
ex: 蕾妮亞進化體需要有ban權限才能使用
if (equal(check_name, "蕾妮亞進化體")
{
if (!access(id,ADMIN_BAN))
{
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_ACCESS")
return PLUGIN_HANDLED
}
}