Raised This Month: $ Target: $400
 0% 

using menu_addblank


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 05-09-2010 , 00:21   using menu_addblank
Reply With Quote #1

PHP Code:
public wpnmenu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        
        
//If they are still connected
        
if( is_user_connected(id) )
            
//Lets send them back to the top menu
        
bb_menu(id);
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            
wm1_menu(id);
        }
        case 
2:
        {
            
wm2_menu(id);
        }
        case 
3:
        {
            
wm3_menu(id);
        }
        case 
4:
        {
            
wm4_menu(id);
        }
        case 
5:
        {
            
wm5_menu(id);
        }
        case 
7:
        {
            if(
CheckBank(id750))
            {
                
giveweapon(id,100)
                
client_print(id,print_chat,"[OK] You recieved all weapons!")
                
g_bhealth[id] -= 750
                SaveData
(id)
            }
            else if(!
CheckBank(id750))
            {
                
client_print(id,print_chat,"[OK] You do not have enough blood for this. Cost:750 Have:%d",g_bhealth[id])
            }
        }
    }
    
    
menu_destroy(menu);
    
    
//Here you might want to show the submenu or the top menu again.
    //bb_menu(id);
    
    
return PLUGIN_HANDLED;

for some reason, when doing this, pressing menu item 7 will just return me to bb_menu, is it counting 7 as exit?
__________________
+|- KARMA Respectively

HLM is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-09-2010 , 00:58   Re: using menu_addblank
Reply With Quote #2

I've had issues with addblank before so I just stopped trying to use it.

BTW, You don't need to check a bool twice:

Bad:

PHP Code:
if( function() )
{
    
// . . . stuff
}
else if( !function() )
{
    
// .  . . stuff

Good:

PHP Code:
if( function() )
{
    
// . . . stuff
}
else
{
    
// .  . . stuff

__________________
fysiks is offline
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 05-09-2010 , 01:13   Re: using menu_addblank
Reply With Quote #3

ok, ill adjust that.. all 20+ iterations, lol

but is there any other way of using the new menu system and making a blank line?
__________________
+|- KARMA Respectively

HLM is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-09-2010 , 14:03   Re: using menu_addblank
Reply With Quote #4

Quote:
Originally Posted by HLM View Post
but is there any other way of using the new menu system and making a blank line?
You will have to post the code. It's been a while since I tried to use the addblank for the new menu system.
__________________
fysiks is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 05-09-2010 , 16:15   Re: using menu_addblank
Reply With Quote #5

Code:
public Function( ) {     new hMenu = menu_create( "TITLE", "Handler" );         menu_additem( hMenu, "Whatever", "1" );     menu_additem( hMenu, "Whatever2", "2" );         // will output this:     // TITLE     // 1. Whatever     // 2. Whatever2     //     // 0. Exit             // while this:     new hMenu = menu_create( "TITLE", "Handler" );         menu_additem( hMenu, "Whatever^n", "1" );     menu_additem( hMenu, "Whatever2", "2" );         // will output:     // TITLE     // 1. Whatever     //     // 2. Whatever2     //     // 0. Exit }

That way you can create a blank line. The '^n' is used to make a new row.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 05-09-2010 , 16:54   Re: using menu_addblank
Reply With Quote #6

ive scrapped the idea, there is no way of fixing it, I wanted it to go 1-5 with new menus, and option 7 would be to purchase them all, its fine though, thanks for the help though
__________________
+|- KARMA Respectively

HLM 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 03:39.


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