Raised This Month: $7 Target: $400
 1% 

Changing items amount in the new menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KWo
AMX Mod X Beta Tester
Join Date: Jul 2004
Location: Poland
Old 03-23-2008 , 15:14   Changing items amount in the new menu
Reply With Quote #1

This is the part of my plugin:
Code:
public plugin_init() {        register_plugin(PLUGINNAME, VERSION, AUTHORS)     register_clcmd("rendering_menu", "rendering_menu", ADMIN_MAP, "Rendering Menu")     AddMenuItem("Rendering Menu", "rendering_menu", ADMIN_MAP, PLUGINNAME)     register_concmd("amx_set_rendering","amx_set_rendering",ADMIN_MAP,"Sets the rendering for the player")     register_concmd("amx_get_rendering","amx_get_rendering",ADMIN_MAP,"Gets the rendering of the player")     g_MainMenuID = menu_create(g_MainMenu, "m_mm_handler", 0)     g_PlayerMenuID = menu_create(g_PlayerMenu, "m_pm_handler", 0)     g_FxMenuID = menu_create(g_FxMenu, "m_fxm_handler", 0)     g_ColorMenuID = menu_create(g_ColorMenu, "m_cm_handler", 0)     g_RenderModeMenuID = menu_create(g_RenderModeMenu, "m_rmm_handler", 0)     g_RenderAmountMenuID = menu_create(g_RenderAmountMenu, "m_ram_handler", 0)     gMaxPlayers = get_maxplayers()     new UserName[32], ItemName[2]     new pl_id     for(new i = 0; i < gMaxPlayers; ++i)     {         pl_id = i + 1         num_to_str(i, ItemName, 2)         copy(UserName, 31, "UNKNOWN")         if (is_user_connected(pl_id))         {             get_user_name(pl_id, UserName, 31)         }         menu_additem(g_PlayerMenuID, UserName, ItemName, ADMIN_MAP, -1)     }     menu_additem(g_MainMenuID, g_PlayerMenu, "1", ADMIN_MAP, -1)     menu_additem(g_MainMenuID, g_FxMenu, "2", ADMIN_MAP, -1)     menu_additem(g_MainMenuID, g_ColorMenu, "3", ADMIN_MAP, -1)     menu_additem(g_MainMenuID, g_RenderModeMenu, "4", ADMIN_MAP, -1)     menu_additem(g_MainMenuID, g_RenderAmountMenu, "5", ADMIN_MAP, -1)     menu_additem(g_MainMenuID, "Set Rendering on The Player", "6", ADMIN_MAP, -1)     menu_additem(g_MainMenuID, "Get Rendering of The Player", "7", ADMIN_MAP, -1)
As You can see, I'm adding the command to invoke my new menu and I'm adding the call for it from amxmodmenu. But my menu contains some items - they are just some other menus (deeper level). Where is my problem? My problem is player menu, which should display the amount of items depanding of the current players on the server (sometimes is more, sometimes is less them overthere). The current method with adding items to the new menu lets me always add some new items to the menu (menu_additem), lets me change the displaying name of the item (menu_item_setname), but it doesn't let me delete any items if there is too many of them (now I have less players amount on the server for example). Someone may say - just use menu_delete function and create the new menu with the new amount of items You need. I can say - Yes, but is this the only way to do that? Or should I just ask as a new request to add the new function - menu_delitem?
That should be more easy. With the old menu system we are doing the same - we are refreshing the displaying items, but there is no need to delete the registered menuid. Once created could be used a lot of times with different amount of items.
__________________
The Fullpack of podbot mm V3B22 - 24 apr 2012!!! is available here.
The All-In-One 3.2a package - 02 jun 2013 (AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available here.
KWo is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-23-2008 , 15:25   Re: Changing items amount in the new menu
Reply With Quote #2

Quote:
Or should I just ask as a new request to add the new function - menu_delitem?
A request has already been asked here : http://bugs.alliedmods.net/index.php...s&task_id=1375
__________________
Arkshine is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:57.


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