public display_weaponmenu(id, menuid, pos)
{
if(pos < 0 || menuid < 0)
return
static start
start = pos * 8
static maxitem
maxitem = menuid == 1 ? sizeof g_primaryweapons : sizeof g_secondaryweapons
if(start >= maxitem)
start = pos = g_menuposition[id]
static menubody[512], len, primary[64], secondary[64]
formatex(primary, sizeof(primary), "%L", OFFICIAL_LANG, "WPN_PRIMARY")
formatex(secondary, sizeof(secondary), "%L", OFFICIAL_LANG, "WPN_SECONDARY")
len = formatex(menubody, 511, "\y%s\w^n^n", menuid == 1 ? primary : secondary)
static end
end = start + 8
if(end > maxitem)
end = maxitem
static keys
keys = MENU_KEY_0
static a, b
b = 0
static string_next[32], string_back[32], string_exit[32]
formatex(string_next, sizeof(string_next), "%L", OFFICIAL_LANG, "MENU_NEXT")
formatex(string_back, sizeof(string_back), "%L", OFFICIAL_LANG, "MENU_BACK")
formatex(string_exit, sizeof(string_exit), "%L", OFFICIAL_LANG, "MENU_EXIT")
for(a = start; a < end; ++a)
{
keys |= (1<< B)
len += formatex(menubody[len], 511 - len,"%d. %s^n", ++b, menuid == 1 ? g_primaryweapons[a][0]: g_secondaryweapons[a][0])
}
if(end != maxitem)
{
formatex(menubody[len], 511 - len, "^n9. %s^n0. %s", string_next, pos ? string_back : string_exit)
keys |= MENU_KEY_9
}
else
formatex(menubody[len], 511 - len, "^n0. %s", pos ? string_back : string_exit)
show_menu(id, keys, menubody, -1, menuid == 1 ? primary : secondary)
}