AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved show only first 7 items in menu (https://forums.alliedmods.net/showthread.php?t=332791)

retail 06-01-2021 11:33

show only first 7 items in menu
 
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 }

Natsheh 06-01-2021 14:24

Re: show only first 7 items in menu
 
use the new menu system no need to use the old one its deprecated !!!

retail 06-01-2021 14:53

Re: show only first 7 items in menu
 
Quote:

Originally Posted by Natsheh (Post 2748534)
use the new menu system no need to use the old one its deprecated !!!

i used this method to put a text like this:
https://i.imgur.com/BELbr8D.jpg

i dont know how to put that text with new menu system

Natsheh 06-01-2021 15:15

Re: show only first 7 items in menu
 
menu_additem(menuID, "Open Sub-Menu^nLook, this is a cool text!")

^n or \n is a symbol for a newline

retail 06-01-2021 16:57

Re: show only first 7 items in menu
 
Quote:

Originally Posted by Natsheh (Post 2748543)
menu_additem(menuID, "Open Sub-Menu^nLook, this is a cool text!")

^n or \n is a symbol for a newline

thanks


All times are GMT -4. The time now is 11:10.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.