View Single Post
Author Message
retail
New Member
Join Date: Jun 2021
Old 06-01-2021 , 11:33   show only first 7 items in menu
Reply With Quote #1

i have this small menu, it shows all items, i want to show only 7 items on a page and if i press 9 it should to switch to another page

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <engine> #include <cstrike> #include <fakemeta> const KEYSMENU = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_9|MENU_KEY_0 new const items[][] = {     "Item 1",     "Item 2",     "Item 3",     "Item 4",     "Item 5",     "Item 6",     "Item 7",     "Item 8",     "Item 9",     "Item 10",     "Item 11",     "Item 12",     "Item 13",     "Item 14",     "Item 15",     "Item 16",     "Item 17",     "Item 18",     "Item 19",     "Item 20",     "Item 21",     "Item 22",     "Item 23" } public plugin_init() {     register_plugin("[AMXX] Shop", "1.0", "retail")         register_clcmd("say /menu", "show_shop", ADMIN_ALL)     register_menu("Shop Menu", KEYSMENU, "menu_handler") } public show_shop(id) {        new szMenu[512], len     len = formatex(szMenu, charsmax(szMenu), ("\yShop^n"))         for (new i = 0; i < sizeof items; i++)         len += formatex(szMenu[len], charsmax(szMenu) - len, "^n\w%d. \y%s", i + 1, items[i])     len += formatex(szMenu[len], charsmax(szMenu) - len, "^n^n\w9. \yNext / Back")         formatex(szMenu[len], charsmax(szMenu) - len, "^n^n\w0. \yExit")         set_pdata_int(id, 205, 0)     show_menu(id, KEYSMENU, szMenu, -1, "Shop Menu") } public menu_handler(id, key) {     new iKey = key + 1         switch(iKey)     {         case 9:         {             // what i need to do here?         }     }         return PLUGIN_HANDLED }

Last edited by retail; 06-01-2021 at 16:57.
retail is offline