AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   menu_create and outside ids? (https://forums.alliedmods.net/showthread.php?t=170890)

sake 10-30-2011 04:55

menu_create and outside ids?
 
Hello there,

PHP Code:

            new menu,keys;
            
get_user_menu(id,menu,keys);
            
//only show the menu if no other is being displayed
            
if(menu == 0)
            {
                
menu_display(id,g_menu_main,0);
            }
            else
            {
                
//No menu is being displayed
            


The above code works as long as I don't want to check if menu is a menu I created in my plugin. So I was wondering how I could get the outside ID of a menu created via menu_create (new Menu system). In the old system one could use register_menuid for that but whats the pendant for this in the new system?

sake

Backstabnoob 10-30-2011 06:20

Re: menu_create and outside ids?
 
Save it in a global variable, like:

Code:
new g_Menu[33] ... public menu(id)      g_Menu[id] = menu_create(...)

Edit: You don't need to create 33 cells and save the menu for everyone, that's just a solution if you want custom menus for every player out there

Code:
new g_Menu ... public menu(id)      g_Menu = menu_create(...)

sake 10-30-2011 06:41

Re: menu_create and outside ids?
 
I already do that (Look at the variable name).

But the menus are saved internally with ids (0,1,2) and not with the outside ids.

Code:
g_menu_main = menu_create("Weapon Main Menu","mainMenuHandle");

fysiks 10-30-2011 13:02

Re: menu_create and outside ids?
 
Explain what you are trying to do.

sake 10-30-2011 13:12

Re: menu_create and outside ids?
 
I want to check if a player has a menu opened and if yes (and not the menu i want to show him) then I want to tell him he has to use a command for the menu.

fysiks 10-30-2011 13:14

Re: menu_create and outside ids?
 
Then compare the menu id you get from get_user_menu() to the id of the menu that you want and if not equal then they are not looking at your menu.

sake 10-30-2011 13:54

Re: menu_create and outside ids?
 
-.-

I already know that and told you this. But I can't figure out a way to find the menuids of my menus which are registered via menu_create because menu_create just returns internal ids and no global ones...

Emp` 10-30-2011 14:00

Re: menu_create and outside ids?
 
player_menu_info

sake 10-30-2011 14:34

Re: menu_create and outside ids?
 
Which id of the menu does this return? The outside or the inside id?

fysiks 10-30-2011 19:06

Re: menu_create and outside ids?
 
Quote:

Originally Posted by sake (Post 1586615)
Which id of the menu does this return? The outside or the inside id?

You can easily find that out. Afaik, there is no "local only" reference to menus. There is only global menu identifiers. Emp would need to confirm or deny this.


All times are GMT -4. The time now is 14:17.

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