Raised This Month: $ Target: $400
 0% 

Menus keep closing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 02-09-2010 , 21:28   Menus keep closing
Reply With Quote #1

I made a plugin earlier with emps menu tutorial and when i press an option the menu closes. How should i fix it? I tried to my opinion alot of ways
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-09-2010 , 21:46   Re: Menus keep closing
Reply With Quote #2

Quote:
Originally Posted by r4ndomz View Post
I made a plugin earlier with emps menu tutorial and when i press an option the menu closes. How should i fix it? I tried to my opinion alot of ways
When you select an option it is supposed to close.
__________________
fysiks is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-09-2010 , 22:16   Re: Menus keep closing
Reply With Quote #3

Quote:
Originally Posted by r4ndomz View Post
I made a plugin earlier with emps menu tutorial and when i press an option the menu closes. How should i fix it? I tried to my opinion alot of ways
Like fysiks said, it's supposed to close. If you want to be able to choose another item from the same menu prior to your first choice, in the case handler, just execute the things that you want to happen and then re-display the menu.

PHP Code:
#include <amxmodx>

new m_YourMenu;

new const 
VERSION[] = "0.0.1";

public 
plugin_init() {
    
register_plugin"Menu Example"VERSION"wrecked_" );
    
    
register_clcmd"say /menu""cmd_Menu" );
}

public 
cmd_Menuid )
{
    
m_YourMenu menu_create"Example Menu""cmd_MenuHandler" );
    
    
menu_additemm_YourMenu"Example #1""1");
    
menu_additemm_YourMenu"Example #2""2");
    
    
menu_setpropm_YourMenuMPROP_EXITMEXIT_ALL );
    
    
menu_displayidm_YourMenu);
    
    return 
PLUGIN_CONTINUE;
}

public 
cmd_MenuHandleridm_YourMenuitem )
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroym_YourMenu );
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
sz_Name[64];
    new 
sz_Data[64];
    new 
access;
    new 
callback;
    
    
// All that good stuff
    
menu_item_getinfom_YourMenuitemaccesssz_Data5sz_Name63callback );
    
    new 
key str_to_numsz_Data );
    
    switch( 
key )
    {
        case 
1:
        {
            
// Your Stuff
            
            
menu_displayidm_YourMenu);
        }
        
        case 
2:
        {
            
// Your Stuff
            
            
menu_displayidm_YourMenu);
        }
        
        
// ...
    
}

__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT

Last edited by wrecked_; 02-09-2010 at 22:31. Reason: Added quick example
wrecked_ is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 02-10-2010 , 15:36   Re: Menus keep closing
Reply With Quote #4

Yea but when i do that it takes me back to the main menu and the menu doesnt update either (like theres an if statement in the code and its value changed)
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-10-2010 , 15:39   Re: Menus keep closing
Reply With Quote #5

Then make it display the menu that you want instead of the main menu example,
PHP Code:
menu_displayidsubmenu
and just change that value that you want in the original menu declaration function...
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 02-10-2010 , 15:48   Re: Menus keep closing
Reply With Quote #6

Yes but i only have one menu with two pages. How would i make it display the menu page it was on?
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-10-2010 , 15:50   Re: Menus keep closing
Reply With Quote #7

PHP Code:
menu_displayidmainmenu)
/*
    Parameters:
    1) Player Index
    2) Menu
    3) Page - 0 is the first, 1 is the second, etc.
*/ 
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 02-10-2010 , 16:06   Re: Menus keep closing
Reply With Quote #8

Ok ty, but how do i update the menu? i dont really get what you said before. Can you explain a little bit more?
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-10-2010 , 16:08   Re: Menus keep closing
Reply With Quote #9

Post your menu creation function.

ex: Where you did
PHP Code:
public cmd_MenuCreationid )
{
    new 
menu menu_create"Example Menu""cmd_MenuHandler" )

    
// ...

__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 02-10-2010 , 16:11   Re: Menus keep closing
Reply With Quote #10

PHP Code:
public AwsomeMenu(id)
{
    new 
noclip get_user_noclip(id)
    new 
godmode get_user_godmode(id)
    new 
footsteps get_user_footsteps(id)

    
#if SM_ADMIN == 1
        
if( !( get_user_flags(id) & ADMIN_FLAG ) )
        {
            return
        }
    
#endif
    
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
    {
        
// Didnt think it wouldnt give me errors
    
}
    else
    {
        
client_print(idprint_chat"You need to be in Spec to use this")
        return 
PLUGIN_CONTINUE
    
}

    new 
menu menu_create("\ySpec Menu by r4nDoMz""menu_handler");

    if(
noclip == 1)
    {
        
menu_additem(menu,"\wNoclip: \yON""1"0);
    }
    else
    {
        
menu_additem(menu,"\wNoclip: \yOFF""1"0);
    }

    if(
godmode == 1)
    {
        
menu_additem(menu,"\wGodmode: \yON""2"0);
    }
    else
    {
        
menu_additem(menu,"\wGodmode: \yOFF""2"0);
    }

    if(
footsteps == 1)
    {
        
menu_additem(menu,"\wSilent walk: \yON""3"0);
    }
    else
    {
        
menu_additem(menu,"\wSilent walk: \yOFF""3"0);
    }
    
menu_additem(menu,"\wRevive""4"0);
    
menu_additem(menu,"\wLow Gravity""5"0);
    
menu_additem(menu,"\wDefault Gravity""6"0);
    
menu_additem(menu,"\wNades...He/Flash/Smoke""7"0);
    
menu_additem(menu,"\wRoad Runner(Fast run)""8"0);
    
menu_additem(menu,"\wSpeed Boost""9"0);
    
menu_additem(menu,"\wThirdperson""10"0);
    
menu_additem(menu,"\wFirstperson""11"0);
    
menu_additem(menu,"\wSuperjump""12"0);


    
menu_setprop(menuMPROP_EXITMEXIT_ALL);

    
menu_display(idmenu0);

    return 
PLUGIN_CONTINUE

__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
Reply



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 07:24.


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