AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Changing items amount in the new menu (https://forums.alliedmods.net/showthread.php?t=68841)

KWo 03-23-2008 15:14

Changing items amount in the new menu
 
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.

Arkshine 03-23-2008 15:25

Re: Changing items amount in the new menu
 
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


All times are GMT -4. The time now is 04:00.

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