Raised This Month: $ Target: $400
 0% 

Menu with different options if conditions are met


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-08-2017 , 21:01   Re: Menu with different options if conditions are met
Reply With Quote #3

The solution is to use the menu item's "info" to uniquely identify the items in the menu. With this method, shown below, when you choose option 5, only option 5 will be executed.

PHP Code:
// Menu function

    
menu_additem(g_Menu"Option 1""1")
    
menu_additem(g_Menu"Option 2""2")
    
menu_additem(g_Menu"Option 3""3")
    
menu_additem(g_Menu"Option 5""5")
    
    
//...
    
// Handler function
    
    
new iAccessszInfo[32], szName[32], callback
    menu_item_getinfo
(menuitemiAccessszInfocharsmax(szInfo), szNamecharsmax(szName), callback)
    
    new 
iOption str_to_num(szInfo)
    
    switch(
iOption)
    {
        case 
1:
        {
            
// Option 1
        
}
        case 
2:
        {
            
// Option 2
        
}
        case 
3:
        {
            
// Option 3
        
}
        case 
4:
        {
            
// Option 4
        
}
        case 
5:
        {
            
// Option 5
        
}
    } 
__________________

Last edited by fysiks; 02-08-2017 at 21:03.
fysiks is offline
 



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 20:42.


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