下面是引用 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
}
}