Raised This Month: $ Target: $400
 0% 

Adding different menus into one menu. [Done]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Going Dutch
Member
Join Date: Dec 2013
Old 01-01-2014 , 17:36   Adding different menus into one menu. [Done]
Reply With Quote #1

Hey,

This might be a stupid question but i am wondering if there is something as adding other menus into one menu.

Example:

PHP Code:
Custom Menu

1. Weapon Menu
2. Respawn Menu
3. Camera Angle
4. Servers
5. Admins online
9. Close menu 
So when the client presses 1 in the menu the menu forces him to say /weapons, but the text won't visible in the chat.

Thank you, and best wishes this year!
__________________
Learning amxx/pawn and all that good stuff.

Last edited by Going Dutch; 01-02-2014 at 17:02.
Going Dutch is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-01-2014 , 18:06   Re: Adding different menus into one menu.
Reply With Quote #2

You can make people say stuff but as for it showing or not will be determined by the plugin that is handling that command. So, if the plugin that handles the command shows it then you can't do what you want without creating a custom function in that plugin (which contains /weapons).
__________________
fysiks is offline
Going Dutch
Member
Join Date: Dec 2013
Old 01-02-2014 , 09:22   Re: Adding different menus into one menu.
Reply With Quote #3

I'm not quite sure where to add the path to the other menus could you explain that to me?

PHP Code:
 #include <amxmodx>

 
public plugin_init()
 {
    
//..stuff for your plugin

    
register_clcmd("say /menu""AwesomeMenu");
    
//note that we do not need to register the menu anymore, but just a way to get to it
 
}
 
//lets make the function that will make the menu
 
public AwesomeMenuid )
 {
    
//first we need to make a variable that will hold the menu
    
new menu menu_create"\rServer Menu:""menu_handler" );
    
//Note - menu_create
    //The first parameter  is what the menu will be titled ( what is at the very top )
    //The second parameter is the function that will deal/handle with the menu ( which key was pressed, and what to do )

    //Now lets add some things to select from the menu
    
menu_additemmenu"\wBlockMaker Menu""");
    
menu_additemmenu"\wI'm Selection #2""");
    
menu_additemmenu"\wI'm Secret Selection #3"""ADMIN_ADMIN );
    
//Note - menu_additem
    //The first parameter is which menu we will be adding this item/selection to
    //The second parameter is what text will appear on the menu ( Note that it is preceeded with a number of which item it is )
    //The third parameter is data that we want to send with this item
    //The fourth parameter is which admin flag we want to be able to access this item ( Refer to the admin flags from the amxconst.inc )
    //The fifth parameter is the callback for enabling/disabling items, by default we will omit this and use no callback ( default value of -1 ) Refer to the Menu Items with Callbacks section for more information.

    //Set a property on the menu
    
menu_setpropmenuMPROP_EXITMEXIT_ALL );
    
//Note - menu_setprop
    //The first parameter is the menu to modify
    //The second parameter is what to modify ( found in amxconst.inc )
    //The third parameter is what to modify it to ( in this case, we are adding a option to the menu that will exit the menu. setting it to MEXIT_NEVER will disable this option )
    //Additional note - MEXIT_ALL is the default property for MPROP_EXIT, so this is redundant

    //Lets display the menu
    
menu_displayidmenu);
    
//Note - menu_display
    //The first parameter is which index to show it to ( you cannot show this to everyone at once )
    //The second parameter is which menu to show them ( in this case, the one we just made )
    //The third parameter is which page to start them on
 
}
 
//okay, we showed them the menu, now lets handle it ( looking back at menu_create, we are going to use that function )
 
public menu_handleridmenuitem )
 {
    
//Because of the simplicity of this menu, we can switch for which item was pressed
    //Note - this is zero-based, so the first item is 0
    
switch( item )
    {
        case 
0:
        {
            
client_printidprint_chat"Hooray! You selected the Awesome 1st Selection" );
            
            
//Note that if we dont want to continue through the function, we can't just end with a return. We want to kill the menu first
            
menu_destroymenu );
            return 
PLUGIN_HANDLED;
        }
        case 
1:
        {
            
client_printidprint_chat"OH NO! You selected the Awesome 2nd Selection! BEWARE!" );
        }
        case 
2:
        {
            
client_printidprint_chat"You have selected the Awesome Admin Selection! Hail Teh Bail!" );
        }
        case 
MENU_EXIT:
        {
            
client_printidprint_chat"You exited the menu... what a bummer!" );
        }
    }

    
//lets finish up this function by destroying the menu with menu_destroy, and a return
    
menu_destroymenu );
    return 
PLUGIN_HANDLED;
 } 
I tried this but this didn't work.

PHP Code:
menu_additemmenu"\wBlockMaker Menu"""); 
--->

PHP Code:
menu_additemmenu"\wBlockMaker Menu""/bm"); 
Sorry if i'm coming over as an noob or something, i'm learning.
__________________
Learning amxx/pawn and all that good stuff.
Going Dutch is offline
ShLuMieL
Senior Member
Join Date: Jul 2010
Old 01-02-2014 , 10:06   Re: Adding different menus into one menu.
Reply With Quote #4

Maybe it would be more ovbious:

PHP Code:
/* Plugin generated by AMXX-Studio */ 

#include <amxmodx> 
#include <amxmisc> 

#define PLUGIN "Weapons Menu" 
#define VERSION "1.0" 
#define AUTHOR "Asafmazon." 

public plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR
    
    
// Add your code here... 
    
    
register_clcmd("say /menu""MenuW");


public 
MenuW(id)
{
    new 
menu menu_create("Custom Menu:""MenuW_Handler" );
    
    
menu_additem(menu"Weapon Menu"""0);
    
menu_additem(menu"Respawn Menu"""0);
    
menu_additem(menu"Camera Angle"""1);
    
menu_additem(menu"Servers"""1);
    
menu_additem(menu"Admins online"""0);
    
    
menu_setpropmenuMPROP_EXITNAME"Close menu" )
    
menu_setprop(menuMPROP_EXITMEXIT_ALL );
    
menu_display(idmenu);
    
    return 
PLUGIN_HANDLED;
}

public 
MenuW_Handler(idmenuitem
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    switch(
item)
    {
        case 
0:
        {
            
WeaponsMenu(id)
        }
        case 
1:
        {
            
RespawnMenu(id)
        }
        case 
2:
        {
            
//CameraMenu(id)
        
}
        case 
3:
        {
            
//ServersMenu(id)
        
}
        case 
4:
        {
            
AdminsMenu(id)
        }
    }
    return 
PLUGIN_HANDLED;
}

public 
WeaponsMenu(id)
{
    new 
menu menu_create("Weapons Menu:""Weapons_Handler" );
    
    
menu_additem(menu"Weapon 1"""0);
    
menu_additem(menu"Weapon 2"""1);
    
menu_additem(menu"Weapon 3"""1);
    
    
menu_setpropmenuMPROP_EXITNAME"Back" )
    
menu_setprop(menuMPROP_EXITMEXIT_ALL );
    
menu_display(idmenu);
    
    return 
PLUGIN_HANDLED;
}

public 
Weapons_Handler(idmenuitem
{
    if(
item == MENU_EXIT)
    {
        
MenuW(id)
        return 
PLUGIN_HANDLED
    
}
    
    switch(
item)
    {
        case 
0:
        {
            
WeaponsMenu(id)
        }
    }
    return 
PLUGIN_HANDLED;
}

public 
RespawnMenu(id)
{
    new 
menu menu_create("Respawn Menu:""RespawnMenu_Handler" );
    
    
menu_additem(menu"Respawn 1"""0);
    
menu_additem(menu"Respawn 2"""1);
    
menu_additem(menu"Respawn 3"""1);
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL );
    
menu_display(idmenu);
    
    return 
PLUGIN_HANDLED;
}

public 
RespawnMenu_Handler(idmenuitem
{
    if(
item == MENU_EXIT)
    {
        
MenuW(id)
        return 
PLUGIN_HANDLED
    
}
    
    switch(
item)
    {
        case 
0:
        {
            
RespawnMenu(id)
        }
    }
    return 
PLUGIN_HANDLED;
}

public 
AdminsMenu(id)
{
    new 
menu menu_create("Weapons Menu:""AdminsMenu_Handler" );
    
    
menu_additem(menu"Admin 1"""0);
    
menu_additem(menu"Admin 2"""1);
    
menu_additem(menu"Admin 3"""1);
    
    
menu_setpropmenuMPROP_EXITNAME"Back" )
    
menu_setprop(menuMPROP_EXITMEXIT_ALL );
    
menu_display(idmenu);
    
    return 
PLUGIN_HANDLED;
}

public 
AdminsMenu_Handler(idmenuitem
{
    if(
item == MENU_EXIT)
    {
        
MenuW(id)
        return 
PLUGIN_HANDLED
    
}
    
    switch(
item)
    {
        case 
0:
        {
            
AdminsMenu(id)
        }
    }
    return 
PLUGIN_HANDLED;


Last edited by ShLuMieL; 01-02-2014 at 10:10.
ShLuMieL is offline
Going Dutch
Member
Join Date: Dec 2013
Old 01-02-2014 , 10:36   Re: Adding different menus into one menu.
Reply With Quote #5

I appreciate the replies and the menu you have made.

But is it possible to make it so the menu forces the client to say for example: "/admin", "/weapons" or "timeleft"?
Like, if you are opening "1. Weapon menu" in the menu, it closes the menu and says in chat /weapons.
It doesn't have to open a sub-menu.

Thank you
__________________
Learning amxx/pawn and all that good stuff.

Last edited by Going Dutch; 01-02-2014 at 10:36. Reason: typo
Going Dutch is offline
ShLuMieL
Senior Member
Join Date: Jul 2010
Old 01-02-2014 , 11:01   Re: Adding different menus into one menu.
Reply With Quote #6

Sure:
Have Fun.
PHP Code:
/* Plugin generated by AMXX-Studio */ 

#include <amxmodx> 
#include <amxmisc> 

#define PLUGIN "Weapons Menu" 
#define VERSION "1.0" 
#define AUTHOR "Asafmazon." 

public plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR
    
    
// Add your code here... 
    
    
register_clcmd("say /menu""MenuW");
    
register_clcmd("say /weapon""WeaponsMenu");
    
register_clcmd("say /respawn""RespawnMenu");
    
register_clcmd("say /admins""AdminsMenu");


public 
MenuW(id)
{
    new 
menu menu_create("Custom Menu:""MenuW_Handler" );
    
    
menu_additem(menu"Weapon Menu"""0);
    
menu_additem(menu"Respawn Menu"""0);
    
menu_additem(menu"Camera Angle"""1);
    
menu_additem(menu"Servers"""1);
    
menu_additem(menu"Admins online"""0);
    
    
menu_setpropmenuMPROP_EXITNAME"Close menu" )
    
menu_setprop(menuMPROP_EXITMEXIT_ALL );
    
menu_display(idmenu);

}

public 
MenuW_Handler(idmenuitem
{
    switch(
item)
    {
        case 
0:
        {
            
client_cmd(id"say /weapon")
        }
        case 
1:
        {
            
client_cmd(id"say /respawn")
        }
        case 
2:
        {
            
//CameraMenu(id)
        
}
        case 
3:
        {
            
//ServersMenu(id)
        
}
        case 
4:
        {
            
client_cmd(id"say /admins")
        }
    }
}

public 
WeaponsMenu(id)
{
    new 
menu menu_create("Weapons Menu:""Weapons_Handler" );
    
    
menu_additem(menu"Weapon 1"""0);
    
menu_additem(menu"Weapon 2"""1);
    
menu_additem(menu"Weapon 3"""1);
    
    
menu_setprop(menuMPROP_EXITNAME"Back" )
    
menu_setprop(menuMPROP_EXITMEXIT_ALL );
    
menu_display(idmenu);
}

public 
Weapons_Handler(idmenuitem
{
    if(
item == MENU_EXIT)
    {
        
MenuW(id)
    }
    
    switch(
item)
    {
        case 
0:
        {
            
WeaponsMenu(id)
        }
    }
}

public 
RespawnMenu(id)
{
    new 
menu menu_create("Respawn Menu:""RespawnMenu_Handler" );
    
    
menu_additem(menu"Respawn 1"""0);
    
menu_additem(menu"Respawn 2"""1);
    
menu_additem(menu"Respawn 3"""1);
    
    
menu_setprop(menuMPROP_EXITNAME"Back" )
    
menu_setprop(menuMPROP_EXITMEXIT_ALL );
    
menu_display(idmenu);
}

public 
RespawnMenu_Handler(idmenuitem
{
    if(
item == MENU_EXIT)
    {
        
MenuW(id)
    }
    
    switch(
item)
    {
        case 
0:
        {
            
RespawnMenu(id)
        }
    }
}

public 
AdminsMenu(id)
{
    new 
menu menu_create("Weapons Menu:""AdminsMenu_Handler" );
    
    
menu_additem(menu"Admin 1"""0);
    
menu_additem(menu"Admin 2"""1);
    
menu_additem(menu"Admin 3"""1);
    
    
menu_setpropmenuMPROP_EXITNAME"Back" )
    
menu_setprop(menuMPROP_EXITMEXIT_ALL );
    
menu_display(idmenu);
    
}

public 
AdminsMenu_Handler(idmenuitem
{
    if(
item == MENU_EXIT)
    {
        
MenuW(id)
    }
    
    switch(
item)
    {
        case 
0:
        {
            
AdminsMenu(id)
        }
    }

ShLuMieL is offline
Going Dutch
Member
Join Date: Dec 2013
Old 01-02-2014 , 11:04   Re: Adding different menus into one menu.
Reply With Quote #7

Thank you!
__________________
Learning amxx/pawn and all that good stuff.
Going Dutch is offline
ShLuMieL
Senior Member
Join Date: Jul 2010
Old 01-02-2014 , 11:47   Re: Adding different menus into one menu.
Reply With Quote #8

No problem.
ShLuMieL 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 10:06.


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