Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: openMenu not working

  1. #1
    Private
    Join Date
    Oct 2013
    Posts
    48
    Thanks
    10
    Thanked 4 Times in 2 Posts

    openMenu not working

    Hey guys..
    I'm trying to add a small admin menu to my mod.
    I want that its only possible to open the menu for specific guids.
    So i created a menu file and changed wm_quickmessage
    In _menus.gsc onMenuResponse() i added:

    Code:
    if(response == "admin")
    		{
    			if(self getGuid() == 0)
    			{
    				self playLocalSound("granted");
    				self openMenu(game["menu_admin"]);
    			}
    			else
    			{
    				self iprintlnbold("^1Access Denied!");
    				self playLocalSound("denied");
    			}
    			continue;
    		}
    If i open the menu it plays the sound but it wont open the menu..
    I precached the menu and if i open it directly without scriptMenuResponse "admin" everything is working
    Whats wrong?

    Sorry for my bad english! :x

  2. #2
    Private First Class YuriJurek's Avatar
    Join Date
    Jun 2013
    Posts
    219
    Thanks
    152
    Thanked 88 Times in 47 Posts
    Try to make sure all other menus are closed, closeMenu(); function would help if you put it before openMenu.

  3. #3
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts
    your precache llooks like this?
    PHP Code:
    game["menu_admin"] = "admin";
    precacheMenu(game["menu_admin"]); 
    if yes , error must be on admin.menu
    developer 1 and look for errors in the console in admin.menu

    need help ?
    xf ; czolk

  4. #4
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    you cant open a menu when quickmessage is open. Make sure you have close quickmessage/quickcommands in the execkey in your menu.

  5. #5
    Private
    Join Date
    Oct 2013
    Posts
    48
    Thanks
    10
    Thanked 4 Times in 2 Posts
    Quote Originally Posted by YuriJurek View Post
    Try to make sure all other menus are closed, closeMenu(); function would help if you put it before openMenu.

    Done!
    Code:
    {
        self closeMenu();
        self closeInGameMenu();
        self openMenu(game["menu_admin"]);
        self playLocalSound("granted");
    }
    Still not working...

    Quote Originally Posted by malyczolg View Post
    your precache llooks like this?
    PHP Code:
    game["menu_admin"] = "admin";
    precacheMenu(game["menu_admin"]); 
    if yes , error must be on admin.menu
    developer 1 and look for errors in the console in admin.menu

    need help ?
    xf ; czolk
    The menu is working if i open it from another menu.
    It only wont work with _menus.gsc
    There are no errors and yes its precached like this! :P

    Quote Originally Posted by IzNoGoD View Post
    you cant open a menu when quickmessage is open. Make sure you have close quickmessage/quickcommands in the execkey in your menu.
    Done.. Still not working..
    Code:
    execKey "8" { close quickmessage; scriptMenuResponse "admin" }

  6. #6
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Quote Originally Posted by DjTranceFire View Post
    Done!

    Done.. Still not working..
    Code:
    execKey "8" { close quickmessage; scriptMenuResponse "admin" }
    Are you sure the menu you're calling this from is the quickmessage menu?

    Also, are you sure the menu is precached? have you checked the client's console for any errors concerning .menu files?

  7. #7
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Why not just use the quickmessage menu to open the admin menu?

    Code:
    execKey "8" { close quickmessage; open admin }
    Then, monitor if the admin menu is open:

    Code:
    if( menu == "admin")
    {
    	if(self getGuid() == 0)
    	{
    		self playLocalSound("granted");
    		self openMenu(game["menu_admin"]);
    	}
    	else
    	{
    		self iprintlnbold("^1Access Denied!");
    		self playLocalSound("denied");
    	}
    			
    	continue;
    }
    Seems a lot easier than all this messing around trying to get openMenu() to work.

    NB - make sure your admin.menu has the menu item name of "admin". The item script name is what the engine looks for. Not the name of the menu file.
    Last edited by Tally; 11th November 2013 at 00:56.

  8. #8
    Private
    Join Date
    Oct 2013
    Posts
    48
    Thanks
    10
    Thanked 4 Times in 2 Posts
    Quote Originally Posted by IzNoGoD View Post
    Are you sure the menu you're calling this from is the quickmessage menu?

    Also, are you sure the menu is precached? have you checked the client's console for any errors concerning .menu files?
    Yes, its preached and its called from wm_quickmessage.menu
    Its working if i use:
    execKey "8" { close quickmessage; open admin }
    But its not working if i use
    execKey "8" { close quickmessage; scriptMenuResponse "admin" }
    There are no errors in the console and yes i'm using developer 1

    Quote Originally Posted by Tally View Post
    Why not just use the quickmessage menu to open the admin menu?

    Code:
    execKey "8" { close quickmessage; open admin }
    Then, monitor if the admin menu is open:

    Code:
    if( menu == "admin")
    {
    	if(self getGuid() == 0)
    	{
    		self playLocalSound("granted");
    		self openMenu(game["menu_admin"]);
    	}
    	else
    	{
    		self iprintlnbold("^1Access Denied!");
    		self playLocalSound("denied");
    	}
    			
    	continue;
    }
    Seems a lot easier than all this messing around trying to get openMenu() to work.

    NB - make sure your admin.menu has the menu item name of "admin". The item script name is what the engine looks for. Not the name of the menu file.
    Of course i could use it like this but i want that it cant be opened if you dont have the right guid.

  9. #9
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Well then, you must be doing something wrong. Post your wm_quickmessage menu, and your admin menu.

  10. #10
    Private
    Join Date
    May 2013
    Posts
    27
    Thanks
    0
    Thanked 19 Times in 11 Posts
    If using a scriptMenuResponse in quickmessage, like this:

    PHP Code:
    execKey "8" close quickmessagescriptMenuResponse "admin" 
    Check for menu "-1" in _menus.gsc.

    PHP Code:
            if(menu == "-1")
            {
                if(
    response == "admin")
                {
                    if(
    self getGuid() == 0)
                    {
                        
    self playLocalSound("granted");
                        
    self openMenu(game["menu_admin"]);
                    }
                    else
                    {
                        
    self iprintlnbold("^1Access Denied!");
                        
    self playLocalSound("denied");
                    }
                    continue;
                }
            } 
    I have to add that this is the way it's done in the eXtreme mod, which handles quickmessages slightly different, so your mileage may vary.
    Last edited by PatmanSan; 11th November 2013 at 13:27.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •