AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   using menu_addblank (https://forums.alliedmods.net/showthread.php?t=126396)

HLM 05-09-2010 00:21

using menu_addblank
 
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?

fysiks 05-09-2010 00:58

Re: using menu_addblank
 
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



HLM 05-09-2010 01:13

Re: using menu_addblank
 
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?

fysiks 05-09-2010 14:03

Re: using menu_addblank
 
Quote:

Originally Posted by HLM (Post 1175143)
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.

Xellath 05-09-2010 16:15

Re: using menu_addblank
 
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.

HLM 05-09-2010 16:54

Re: using menu_addblank
 
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


All times are GMT -4. The time now is 03:39.

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