Raised This Month: $51 Target: $400
 12% 

[HELP] Menu modify.


Post New Thread Reply   
 
Thread Tools Display Modes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-03-2009 , 13:39   Re: [HELP] Menu modify.
Reply With Quote #11

That's why I asked for more code. It's important where you build the menu. It will never work in plugin_init().

You need a function that builds the menu when the command is used. "plr" or "id" is the entity number of whoever is using the command.
__________________
fysiks is offline
Old 08-03-2009, 13:43
fysiks
This message has been deleted by fysiks.
lolzin123
Member
Join Date: Apr 2009
Old 08-03-2009 , 17:04   Re: [HELP] Menu modify.
Reply With Quote #12

can you help me at the construction of this?
lolzin123 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-03-2009 , 19:08   Re: [HELP] Menu modify.
Reply With Quote #13

Try this. say /testmenu.

<attachment removed>
__________________

Last edited by fysiks; 08-03-2009 at 21:45.
fysiks is offline
lolzin123
Member
Join Date: Apr 2009
Old 08-03-2009 , 21:17   Re: [HELP] Menu modify.
Reply With Quote #14

oh
thanx man!!!
but how i do this with this menu?

PHP Code:
gMainMenu menu_create("\rBCM4 by joker.""mnuMain"0);
    
menu_additem(gMainMenu"Build Menu""1"0, -1);
    
menu_additem(gMainMenu"Move Menu""2"0, -1);
    
menu_additem(gMainMenu"Destroy""3"accessDelete, -1);
    
menu_additem(gMainMenu"Noclip""4"accessNoclip, -1);
    
menu_additem(gMainMenu"Load""5"0, -1);
    
menu_additem(gMainMenu"Save""6"accessSave, -1);
    
menu_additem(gMainMenu"Custom Menu""7"0, -1); 
gCustomMenu = menu_create("Custom Menu", "mnuCustom", 0);
menu_additem(gCustomMenu, "Revive", "1", accessCustom, -1);
menu_additem(gCustomMenu, "Godmode", "2", accessCustom, -1);
menu_additem(gCustomMenu, "Scout + Usp", "3", accessCustom, -1);
menu_additem(gCustomMenu, "Healer", "4", accessCustom, -1);
menu_additem(gCustomMenu, "Sobre este plugin.", "5", 0, -1);
menu_setprop(gCustomMenu, MPROP_EXITNAME, "Main Menu");[/PHP]

This is a menu inside other menu the way you show me ... is one menu, how i do this?
lolzin123 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-03-2009 , 21:44   Re: [HELP] Menu modify.
Reply With Quote #15

You just make a couple more functions. One for showing the main menu and one for the action of the main menu.

Then in the action of the main menu you would open the custom menu in case 7.

PHP Code:
#include <amxmodx>
#include <fun>

new g_pMainMenu

public plugin_init()
{
    
register_clcmd("say /testmenu""cmdMenu")

    
/* Build non-changing menus here */
    
g_pMainMenu menu_create("\rBCM4 by joker.""actionMainMenu")
    
menu_additem(g_pMainMenu"Build Menu""1")
    
menu_additem(g_pMainMenu"Move Menu""2")
    
menu_additem(g_pMainMenu"Destroy""3")
    
menu_additem(g_pMainMenu"Noclip""4")
    
menu_additem(g_pMainMenu"Load""5")
    
menu_additem(g_pMainMenu"Save""6")
    
menu_additem(g_pMainMenu"Custom Menu""7")
}

public 
cmdMenu(id)
{
    
showMainMenu(id)

    return 
PLUGIN_CONTINUE
}

public 
showMainMenu(id)
{
    
// show main menu here
    
menu_display(idg_pMainMenu0)
}

public 
actionMainMenu(idmenuitem)
{
    
// action of main menu here
    
if( item == MENU_EXIT )
    {
        return 
PLUGIN_HANDLED
    
}

    new 
szCmd[3],  _accesscallback
    menu_item_getinfo
(menuitem_accessszCmd2""0callback)

    switch( 
str_to_num(szCmd) )
    {
        case 
.. 6:
        {
            
// Code here
        
}
        case 
7:
        {
            
showCustomMenu(id)
        }
    }
    
    
// Do NOT destroy Main Menu.
    
return PLUGIN_HANDLED
}

public 
showCustomMenu(id)
{
    
// Build and show the custom menu here
    
static pCustomMenu
    pCustomMenu 
menu_create("Custom Menu""actionCustomMenu")
    
menu_additem(pCustomMenu"Revive""1")
    
menu_additem(pCustomMenuget_user_godmode(id) ? "Godmode: \yOn" "Godmode: \rOff""2")
    
menu_additem(pCustomMenu"Scout + Usp""3")
    
menu_additem(pCustomMenu"Healer""4")
    
menu_additem(pCustomMenu"About Plugin""5")
    
menu_setprop(pCustomMenuMPROP_EXITNAME"Main Menu")

    
menu_display(idpCustomMenu0)
}

public 
actionCustomMenu(idmenuitem)
{
    
// Action of the custom menu here
    
if( item == MENU_EXIT )
    {
        
menu_destroy(menu)
        
showMainMenu(id)
        return 
PLUGIN_HANDLED
    
}

    new 
szCmd[3],  _accesscallback
    menu_item_getinfo
(menuitem_accessszCmd2""0callback)

    switch( 
str_to_num(szCmd) )
    {
        case 
1// Revive
        
{
            
// Code Here
        
}
        case 
2// GodMode
        
{
            
set_user_godmode(idget_user_godmode(id) ? 1)
        }
        case 
3// Scout + Usp
        
{
            
// Code Here
        
}
        case 
4// Healer
        
{
            
// Code Here
        
}
        case 
5// About plugin.
        
{
            
// Code Here
        
}
    }

    
menu_destroy(menu)
    
showCustomMenu(id)
    return 
PLUGIN_HANDLED

I built the Main menu in plugin_init() because I'm assuming it will never change.
__________________
fysiks is offline
lolzin123
Member
Join Date: Apr 2009
Old 08-04-2009 , 10:36   Re: [HELP] Menu modify.
Reply With Quote #16

thanx very much man

EDIT: Any Idea at this forun?
http://forums.alliedmods.net/showthr...039#post888039

And how i set this menu only for Admins?

Last edited by lolzin123; 08-04-2009 at 10:54.
lolzin123 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-04-2009 , 18:17   Re: [HELP] Menu modify.
Reply With Quote #17

Quote:
Originally Posted by lolzin123 View Post
thanx very much man
And how i set this menu only for Admins?
That depends on if there is more then one way to get to the menu.

Do you want the main menu accessible only by admins or just the custom menu?
__________________
fysiks is offline
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 21:37.


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