// Game Menu
show_menu_game(id)
{
static menu[250], len, userflags
len = 0
userflags = get_user_flags(id)
// Title
len += formatex(menu[len], charsmax(menu) - len, "\y%s^n^n", g_modname)
// 1. Buy weapons
if (get_pcvar_num(cvar_buycustom))
len += formatex(menu[len], charsmax(menu) - len, "\r1.\w %L^n", id, "MENU_BUY")
else
len += formatex(menu[len], charsmax(menu) - len, "\d1. %L^n", id, "MENU_BUY")
// 2. Extra items
if (get_pcvar_num(cvar_extraitems) && g_isalive[id])
len += formatex(menu[len], charsmax(menu) - len, "\r2.\w %L^n", id, "MENU_EXTRABUY")
else
len += formatex(menu[len], charsmax(menu) - len, "\d2. %L^n", id, "MENU_EXTRABUY")
// 3. Zombie class
if (get_pcvar_num(cvar_zclasses))
len += formatex(menu[len], charsmax(menu) - len, "\r3.\w %L^n", id,"MENU_ZCLASS")
else
len += formatex(menu[len], charsmax(menu) - len, "\d3. %L^n", id,"MENU_ZCLASS")
// 4. Unstuck
if (g_isalive[id])
len += formatex(menu[len], charsmax(menu) - len, "\r4.\w %L^n", id, "MENU_UNSTUCK")
else
len += formatex(menu[len], charsmax(menu) - len, "\d4. %L^n", id, "MENU_UNSTUCK")
// 5. Help
len += formatex(menu[len], charsmax(menu) - len, "\r5.\w %L^n^n", id, "MENU_INFO")
// 6. Join spec
if (!g_isalive[id] || !get_pcvar_num(cvar_blocksuicide) || (userflags & g_access_flag[ACCESS_ADMIN_MENU]))
len += formatex(menu[len], charsmax(menu) - len, "\r6.\w %L^n^n", id, "MENU_SPECTATOR")
else
len += formatex(menu[len], charsmax(menu) - len, "\d6. %L^n^n", id, "MENU_SPECTATOR")
// 9. Admin menu
if (userflags & g_access_flag[ACCESS_ADMIN_MENU])
len += formatex(menu[len], charsmax(menu) - len, "\r9.\w %L", id, "MENU_ADMIN")
else
len += formatex(menu[len], charsmax(menu) - len, "\d9. %L", id, "MENU_ADMIN")
// 0. Exit
len += formatex(menu[len], charsmax(menu) - len, "^n^n\r0.\w %L", id, "MENU_EXIT")
show_menu(id, KEYSMENU, menu, -1, "Game Menu")
}
// Buy Menu 1
public show_menu_buy1(taskid)
{
// Get player's id
static id
(taskid > g_maxplayers) ? (id = ID_SPAWN) : (id = taskid);
// Zombies or survivors get no guns
if (!g_isalive[id] || g_zombie[id] || g_survivor[id])
return;
// Bots pick their weapons randomly / Random weapons setting enabled
if (get_pcvar_num(cvar_randweapons) || g_isbot[id])
{
buy_primary_weapon(id, random_num(0, ArraySize(g_primary_items) - 1))
menu_buy2(id, random_num(0, ArraySize(g_secondary_items) - 1))
return;
}
// Automatic selection enabled for player and menu called on spawn event
if (WPN_AUTO_ON && taskid > g_maxplayers)
{
buy_primary_weapon(id, WPN_AUTO_PRI)
menu_buy2(id, WPN_AUTO_SEC)
return;
}
static menu[300], len, weap, maxloops
len = 0
maxloops = min(WPN_STARTID+7, WPN_MAXIDS)
// Title
len += formatex(menu[len], charsmax(menu) - len, "\y%L \r[%d-%d]^n^n", id, "MENU_BUY1_TITLE", WPN_STARTID+1, min(WPN_STARTID+7, WPN_MAXIDS))
// 1-7. Weapon List
for (weap = WPN_STARTID; weap < maxloops; weap++)
len += formatex(menu[len], charsmax(menu) - len, "\r%d.\w %s^n", weap-WPN_STARTID+1, WEAPONNAMES[ArrayGetCell(g_primary_weaponids, weap)])
// 8. Auto Select
len += formatex(menu[len], charsmax(menu) - len, "^n\r8.\w %L \y[%L]", id, "MENU_AUTOSELECT", id, (WPN_AUTO_ON) ? "MOTD_ENABLED" : "MOTD_DISABLED")
// 9. Next/Back - 0. Exit
len += formatex(menu[len], charsmax(menu) - len, "^n^n\r9.\w %L/%L^n^n\r0.\w %L", id, "MENU_NEXT", id, "MENU_BACK", id, "MENU_EXIT")
show_menu(id, KEYSMENU, menu, -1, "Buy Menu 1")
}
// Buy Menu 2
show_menu_buy2(id)
{
static menu[250], len, weap, maxloops
len = 0
maxloops = ArraySize(g_secondary_items)
// Title
len += formatex(menu[len], charsmax(menu) - len, "\y%L^n", id, "MENU_BUY2_TITLE")
// 1-6. Weapon List
for (weap = 0; weap < maxloops; weap++)
len += formatex(menu[len], charsmax(menu) - len, "^n\r%d.\w %s", weap+1, WEAPONNAMES[ArrayGetCell(g_secondary_weaponids, weap)])
// 8. Auto Select
len += formatex(menu[len], charsmax(menu) - len, "^n^n\r8.\w %L \y[%L]", id, "MENU_AUTOSELECT", id, (WPN_AUTO_ON) ? "MOTD_ENABLED" : "MOTD_DISABLED")
// 0. Exit
len += formatex(menu[len], charsmax(menu) - len, "^n^n\r0.\w %L", id, "MENU_EXIT")
show_menu(id, KEYSMENU, menu, -1, "Buy Menu 2")
}
// Extra Items Menu
show_menu_extras(id)
{
static menuid, menu[128], item, team, buffer[32]
// Title
formatex(menu, charsmax(menu), "%L [%L]\r", id, "MENU_EXTRA_TITLE", id, g_zombie[id] ? g_nemesis[id] ? "CLASS_NEMESIS" : "CLASS_ZOMBIE" : g_survivor[id] ? "CLASS_SURVIVOR" : "CLASS_HUMAN")
menuid = menu_create(menu, "menu_extras")
// Item List
for (item = 0; item < g_extraitem_i; item++)
{
// Retrieve item's team
team = ArrayGetCell(g_extraitem_team, item)
// Item not available to player's team/class
if ((g_zombie[id] && !g_nemesis[id] && !(team & ZP_TEAM_ZOMBIE)) || (!g_zombie[id] && !g_survivor[id] && !(team & ZP_TEAM_HUMAN)) || (g_nemesis[id] && !(team & ZP_TEAM_NEMESIS)) || (g_survivor[id] && !(team & ZP_TEAM_SURVIVOR)))
continue;
// Check if it's one of the hardcoded items, check availability, set translated caption
switch (item)
{
case EXTRA_NVISION:
{
if (!get_pcvar_num(cvar_extranvision)) continue;
formatex(buffer, charsmax(buffer), "%L", id, "MENU_EXTRA1")
}
case EXTRA_ANTIDOTE:
{
if (!get_pcvar_num(cvar_extraantidote) || g_antidotecounter >= get_pcvar_num(cvar_antidotelimit)) continue;
formatex(buffer, charsmax(buffer), "%L", id, "MENU_EXTRA2")
}
case EXTRA_MADNESS:
{
if (!get_pcvar_num(cvar_extramadness) || g_madnesscounter >= get_pcvar_num(cvar_madnesslimit)) continue;
formatex(buffer, charsmax(buffer), "%L", id, "MENU_EXTRA3")
}
case EXTRA_INFBOMB:
{
if (!get_pcvar_num(cvar_extrainfbomb) || g_infbombcounter >= get_pcvar_num(cvar_infbomblimit)) continue;
formatex(buffer, charsmax(buffer), "%L", id, "MENU_EXTRA4")
}
default:
{
if (item >= EXTRA_WEAPONS_STARTID && item <= EXTRAS_CUSTOM_STARTID-1 && !get_pcvar_num(cvar_extraweapons)) continue;
ArrayGetString(g_extraitem_name, item, buffer, charsmax(buffer))
}
}
// Add Item Name and Cost
formatex(menu, charsmax(menu), "%s \y%d %L", buffer, ArrayGetCell(g_extraitem_cost, item), id, "AMMO_PACKS2")
buffer[0] = item
buffer[1] = 0
menu_additem(menuid, menu, buffer)
}
// No items to display?
if (menu_items(menuid) <= 0)
{
zp_colored_print(id, "^x04[ZP 提示] ^x01 %L", id ,"CMD_NOT_EXTRAS")
menu_destroy(menuid)
return;
}
// Back - Next - Exit
formatex(menu, charsmax(menu), "%L", id, "MENU_BACK")
menu_setprop(menuid, MPROP_BACKNAME, menu)
formatex(menu, charsmax(menu), "%L", id, "MENU_NEXT")
menu_setprop(menuid, MPROP_NEXTNAME, menu)
formatex(menu, charsmax(menu), "%L", id, "MENU_EXIT")
menu_setprop(menuid, MPROP_EXITNAME, menu)
menu_display(id, menuid)
}
// Zombie Class Menu
public show_menu_zclass(id)
{
// Player disconnected
if (!g_isconnected[id])
return;
// Bots pick their zombie class randomly
if (g_isbot[id])
{
g_zombieclassnext[id] = random_num(0, g_zclass_i - 1)
return;
}
static menuid, menu[128], class, buffer[32], buffer2[32]
// Title
formatex(menu, charsmax(menu), "%L\r", id, "MENU_ZCLASS_TITLE")
menuid = menu_create(menu, "menu_zclass")
// Class List
for (class = 0; class < g_zclass_i; class++)
{
// Retrieve name and info
ArrayGetString(g_zclass_name, class, buffer, charsmax(buffer))
ArrayGetString(g_zclass_info, class, buffer2, charsmax(buffer2))
// Add to menu
if (class == g_zombieclassnext[id])
formatex(menu, charsmax(menu), "\d%s %s", buffer, buffer2)
else
formatex(menu, charsmax(menu), "%s \y%s", buffer, buffer2)
buffer[0] = class
buffer[1] = 0
menu_additem(menuid, menu, buffer)
}
// Back - Next - Exit
formatex(menu, charsmax(menu), "%L", id, "MENU_BACK")
menu_setprop(menuid, MPROP_BACKNAME, menu)
formatex(menu, charsmax(menu), "%L", id, "MENU_NEXT")
menu_setprop(menuid, MPROP_NEXTNAME, menu)
formatex(menu, charsmax(menu), "%L", id, "MENU_EXIT")
menu_setprop(menuid, MPROP_EXITNAME, menu)
menu_display(id, menuid)
}
// Help Menu
show_menu_info(id)
{
static menu[150]
formatex(menu, charsmax(menu), "\y%L^n^n\r1.\w %L^n\r2.\w %L^n\r3.\w %L^n\r4.\w %L^n^n\r0.\w %L", id, "MENU_INFO_TITLE", id, "MENU_INFO1", id,"MENU_INFO2", id,"MENU_INFO3", id,"MENU_INFO4", id, "MENU_EXIT")
show_menu(id, KEYSMENU, menu, -1, "Mod Info")
}
// Admin Menu
show_menu_admin(id)
{
static menu[250], len, userflags
len = 0
userflags = get_user_flags(id)
// Title
len += formatex(menu[len], charsmax(menu) - len, "\y%L^n^n", id, "MENU_ADMIN_TITLE")
// 1. Zombiefy/Humanize command
if (userflags & (g_access_flag[ACCESS_MODE_INFECTION] | g_access_flag[ACCESS_MAKE_ZOMBIE] | g_access_flag[ACCESS_MAKE_HUMAN]))
len += formatex(menu[len], charsmax(menu) - len, "\r1.\w %L^n", id, "MENU_ADMIN1")
else
len += formatex(menu[len], charsmax(menu) - len, "\d1. %L^n", id, "MENU_ADMIN1")
// 2. Nemesis command
if (userflags & (g_access_flag[ACCESS_MODE_NEMESIS] | g_access_flag[ACCESS_MAKE_NEMESIS]))
len += formatex(menu[len], charsmax(menu) - len, "\r2.\w %L^n", id, "MENU_ADMIN2")
else
len += formatex(menu[len], charsmax(menu) - len, "\d2. %L^n", id, "MENU_ADMIN2")
// 3. Survivor command
if (userflags & (g_access_flag[ACCESS_MODE_SURVIVOR] | g_access_flag[ACCESS_MAKE_SURVIVOR]))
len += formatex(menu[len], charsmax(menu) - len, "\r3.\w %L^n", id, "MENU_ADMIN3")
else
len += formatex(menu[len], charsmax(menu) - len, "\d3. %L^n", id, "MENU_ADMIN3")
// 4. Respawn command
if (userflags & g_access_flag[ACCESS_RESPAWN_PLAYERS])
len += formatex(menu[len], charsmax(menu) - len, "\r4.\w %L^n", id, "MENU_ADMIN4")
else
len += formatex(menu[len], charsmax(menu) - len, "\d4. %L^n", id, "MENU_ADMIN4")
// 5. Swarm mode command
if ((userflags & g_access_flag[ACCESS_MODE_SWARM]) && allowed_swarm())
len += formatex(menu[len], charsmax(menu) - len, "\r5.\w %L^n", id, "MENU_ADMIN5")
else
len += formatex(menu[len], charsmax(menu) - len, "\d5. %L^n", id, "MENU_ADMIN5")
// 6. Multi infection command
if ((userflags & g_access_flag[ACCESS_MODE_MULTI]) && allowed_multi())
len += formatex(menu[len], charsmax(menu) - len, "\r6.\w %L^n", id, "MENU_ADMIN6")
else
len += formatex(menu[len], charsmax(menu) - len, "\d6. %L^n", id, "MENU_ADMIN6")
// 7. Plague mode command
if ((userflags & g_access_flag[ACCESS_MODE_PLAGUE]) && allowed_plague())
len += formatex(menu[len], charsmax(menu) - len, "\r7.\w %L^n", id, "MENU_ADMIN7")
else
len += formatex(menu[len], charsmax(menu) - len, "\d7. %L^n", id, "MENU_ADMIN7")
// 0. Exit
len += formatex(menu[len], charsmax(menu) - len, "^n\r0.\w %L", id, "MENU_EXIT")
show_menu(id, KEYSMENU, menu, -1, "Admin Menu")
}
// Player List Menu
show_menu_player_list(id)
{
static menuid, menu[128], player, userflags, buffer[2]
userflags = get_user_flags(id)
// Title
switch (PL_ACTION)
{
case ACTION_ZOMBIEFY_HUMANIZE: formatex(menu, charsmax(menu), "%L\r", id, "MENU_ADMIN1")
case ACTION_MAKE_NEMESIS: formatex(menu, charsmax(menu), "%L\r", id, "MENU_ADMIN2")
case ACTION_MAKE_SURVIVOR: formatex(menu, charsmax(menu), "%L\r", id, "MENU_ADMIN3")
case ACTION_RESPAWN_PLAYER: formatex(menu, charsmax(menu), "%L\r", id, "MENU_ADMIN4")
}
menuid = menu_create(menu, "menu_player_list")
// Player List
for (player = 0; player <= g_maxplayers; player++)
{
// Skip if not connected
if (!g_isconnected[player])
continue;
// Format text depending on the action to take
switch (PL_ACTION)
{
case ACTION_ZOMBIEFY_HUMANIZE: // Zombiefy/Humanize command
{
if (g_zombie[player])
{
if (allowed_human(player) && (userflags & g_access_flag[ACCESS_MAKE_HUMAN]))
formatex(menu, charsmax(menu), "%s \r[%L]", g_playername[player], id, g_nemesis[player] ? "CLASS_NEMESIS" : "CLASS_ZOMBIE")
else
formatex(menu, charsmax(menu), "\d%s [%L]", g_playername[player], id, g_nemesis[player] ? "CLASS_NEMESIS" : "CLASS_ZOMBIE")
}
else
{
if (allowed_zombie(player) && (g_newround ? (userflags & g_access_flag[ACCESS_MODE_INFECTION]) : (userflags & g_access_flag[ACCESS_MAKE_ZOMBIE])))
formatex(menu, charsmax(menu), "%s \y[%L]", g_playername[player], id, g_survivor[player] ? "CLASS_SURVIVOR" : "CLASS_HUMAN")
else
formatex(menu, charsmax(menu), "\d%s [%L]", g_playername[player], id, g_survivor[player] ? "CLASS_SURVIVOR" : "CLASS_HUMAN")
}
}
case ACTION_MAKE_NEMESIS: // Nemesis command
{
if (allowed_nemesis(player) && (g_newround ? (userflags & g_access_flag[ACCESS_MODE_NEMESIS]) : (userflags & g_access_flag[ACCESS_MAKE_NEMESIS])))
{
if (g_zombie[player])
formatex(menu, charsmax(menu), "%s \r[%L]", g_playername[player], id, g_nemesis[player] ? "CLASS_NEMESIS" : "CLASS_ZOMBIE")
else
formatex(menu, charsmax(menu), "%s \y[%L]", g_playername[player], id, g_survivor[player] ? "CLASS_SURVIVOR" : "CLASS_HUMAN")
}
else
formatex(menu, charsmax(menu), "\d%s [%L]", g_playername[player], id, g_zombie[player] ? g_nemesis[player] ? "CLASS_NEMESIS" : "CLASS_ZOMBIE" : g_survivor[player] ? "CLASS_SURVIVOR" : "CLASS_HUMAN")
}
case ACTION_MAKE_SURVIVOR: // Survivor command
{
if (allowed_survivor(player) && (g_newround ? (userflags & g_access_flag[ACCESS_MODE_SURVIVOR]) : (userflags & g_access_flag[ACCESS_MAKE_SURVIVOR])))
{
if (g_zombie[player])
formatex(menu, charsmax(menu), "%s \r[%L]", g_playername[player], id, g_nemesis[player] ? "CLASS_NEMESIS" : "CLASS_ZOMBIE")
else
formatex(menu, charsmax(menu), "%s \y[%L]", g_playername[player], id, g_survivor[player] ? "CLASS_SURVIVOR" : "CLASS_HUMAN")
}
else
formatex(menu, charsmax(menu), "\d%s [%L]", g_playername[player], id, g_zombie[player] ? g_nemesis[player] ? "CLASS_NEMESIS" : "CLASS_ZOMBIE" : g_survivor[player] ? "CLASS_SURVIVOR" : "CLASS_HUMAN")
}
case ACTION_RESPAWN_PLAYER: // Respawn command
{
if (allowed_respawn(player) && (userflags & g_access_flag[ACCESS_RESPAWN_PLAYERS]))
formatex(menu, charsmax(menu), "%s", g_playername[player])
else
formatex(menu, charsmax(menu), "\d%s", g_playername[player])
}
}
// Add player
buffer[0] = player
buffer[1] = 0
menu_additem(menuid, menu, buffer)
}
// Back - Next - Exit
formatex(menu, charsmax(menu), "%L", id, "MENU_BACK")
menu_setprop(menuid, MPROP_BACKNAME, menu)
formatex(menu, charsmax(menu), "%L", id, "MENU_NEXT")
menu_setprop(menuid, MPROP_NEXTNAME, menu)
formatex(menu, charsmax(menu), "%L", id, "MENU_EXIT")
menu_setprop(menuid, MPROP_EXITNAME, menu)
menu_display(id, menuid)
}