Raised This Month: $ Target: $400
 0% 

Menu Dont show up..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mammapappa
Member
Join Date: Nov 2008
Old 01-06-2011 , 19:13   Menu Dont show up..
Reply With Quote #1

Hi i dont know how to explain this but the weaponmenu does not show up when i press 1 in the menu hope you understand (:
PHP Code:
public MainMenu(id)
{
    new 
title[100]; 
    
formatex(titlecharsmax(title), "\r[MM] \yHNS MoneyMod^n\wCurrent Money: \r%i \y| \wTotal Money: \r%i"gXP[id], gXPTotal[id]);    
    new 
menu menu_create(title"MainMenu_Handle");
    
    
menu_additem(menu"\wWeapon Menu""-1"0);
    
    new 
iNumber[5], gPriceszItemNumber[100], Amount;
    
    for( new 
iItem 0iItem gItemsiItem++ )
    {
        
num_to_str(iItemiNumber4);
        
gPrice gItemsCost[iItem] * (gLevel[id][iItem] + 1);
        
Amount gItemsValue[iItem] * (gLevel[id][iItem] + 1) / gItemsLevels[iItem];
        
        if( 
gLevel[id][iItem] >= gItemsLevels[iItem] )
        {
            
formatex(szItemNumbercharsmax(szItemNumber), "\d%s: \wMax Level! \r(\w%i %s\r)"g_iItems[iItem], gItemsValuegItemsShort[iItem]);
        }
        else if( 
gXP[id] < gPrice )
        {
            
formatex(szItemNumbercharsmax(szItemNumber), "\d%s: \wLevel %i \r(\w%i %s\r) \y$%i"g_iItems[iItem], (gLevel[id][iItem] + 1), AmountgItemsShort[iItem], gPrice);
        }
        else if( 
gLevel[id][iItem] < gItemsLevels[iItem] )
        {
            
formatex(szItemNumbercharsmax(szItemNumber), "\w%s: Level %i \r(\w%i %s\r) \y$%i"g_iItems[iItem], (gLevel[id][iItem] + 1), AmountgItemsShort[iItem], gPrice);
        }
        
        
menu_additem(menuszItemNumberiNumber);
    }
    
    
menu_display(idmenu0);
    
    return 
PLUGIN_HANDLED;
}

public 
MainMenu_Handle(idmenuitem)
{
    new 
data[6], iName[64], accesscallback;
    new 
key str_to_num(data);
    switch(
key)
    {
        case 
1:
        {
            
ShowWeaponMenu(id);
            return 
PLUGIN_HANDLED;
        }
    }
    
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    
menu_item_getinfo(menuitemaccessdatacharsmax(data), iNamecharsmax(data), callback);
    
    new 
gPriceLevel;
    
Level gLevel[id][key] + 1;
    
gPrice gItemsCost[key] * Level;

    if( 
gLevel[id][key] == gItemsLevels[key] )
    {
        
MainMenu(id);
        return 
PLUGIN_HANDLED;
    }
    else if( 
gXP[id] < gPrice )
    {
        
MainMenu(id);
        return 
PLUGIN_HANDLED;
    }    
    else
    {
        
gXP[id] += gPrice;
        
gLevel[id][key] += 1;
        Print(
id"You bought^x01 %s Level: %i^x03!"g_iItems[key], Level);
    }
    
    
MainMenu(id);
    return 
PLUGIN_HANDLED;
}

public 
ShowWeaponMenu(id)
{
    new 
title[100]; 
    
formatex(titlecharsmax(title), "\r[MM] \yMoneyMod^n\wCurrent Money: \r%i \y| \wTotal Money: \r%i"gXP[id], gXPTotal[id]);    
    new 
menu menu_create(title"WeaponMenu_Handle");
    
    new 
iNumber[5], gPriceszItemNumber[100], Amount;
    
    for( new 
iWeap 0iWeap gWeapsiWeap++ )
    {
        
num_to_str(iWeapiNumber4);
        
gPrice gWeapsCost[iWeap] * (gLevel[id][iWeap] + 1);
        
Amount gWeapsValue[iWeap] * (gLevel[id][iWeap] + 1) / gWeapsLevels[iWeap];
        
        if( 
gLevel[id][iWeap] >= gWeapsLevels[iWeap] )
        {
            
formatex(szItemNumbercharsmax(szItemNumber), "\d%s: \wMax Level! \r(\w%i %s\r)"g_iWeaps[iWeap], gWeapsValuegWeapsShort[iWeap]);
        }
        else if( 
gXP[id] < gPrice )
        {
            
formatex(szItemNumbercharsmax(szItemNumber), "\d%s: \wLevel %i \r(\w%i %s\r) \y$%i"g_iWeaps[iWeap], (gLevel[id][iWeap] + 1), AmountgWeapsShort[iWeap], gPrice);
        }
        else if( 
gLevel[id][iWeap] < gItemsLevels[iWeap] )
        {
            
formatex(szItemNumbercharsmax(szItemNumber), "\w%s: Level %i \r(\w%i %s\r) \y$%i"g_iWeaps[iWeap], (gLevel[id][iWeap] + 1), AmountgWeapsShort[iWeap], gPrice);
        }
        
        
menu_additem(menuszItemNumberiNumber);
    }
    
    
menu_display(idmenu0);
    
    return 
PLUGIN_HANDLED;
}

public 
WeaponMenu_Handle(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64], accesscallback;
    
menu_item_getinfo(menuitemaccessdatacharsmax(data), iNamecharsmax(data), callback);
    
    new 
key str_to_num(data);
    new 
gPriceLevel;
    
Level gLevel[id][key] + 1;
    
gPrice gItemsCost[key] * Level;

    if( 
gLevel[id][key] == gWeapsLevels[key] )
    {
        
ShowWeaponMenu(id);
        return 
PLUGIN_HANDLED;
    }
    else if( 
gXP[id] < gPrice )
    {
        
ShowWeaponMenu(id);
        return 
PLUGIN_HANDLED;
    }    
    else
    {
        
gXP[id] -= gPrice;
        
gLevel[id][key] += 1;
        Print(
id"You bought^x01 %s Level: %i^x03!"g_iWeaps[key], Level);
    }
    
    
ShowWeaponMenu(id);
    return 
PLUGIN_HANDLED;

mammapappa is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-06-2011 , 19:50   Re: Menu Dont show up..
Reply With Quote #2

Are you sure the function "MainMenu" is even being called?
__________________
fysiks is offline
mammapappa
Member
Join Date: Nov 2008
Old 01-06-2011 , 22:06   Re: Menu Dont show up..
Reply With Quote #3

yes i can open the menu when i write /mm but when i press 1 to enter the weaponmenu it doent show it's still on the mainmenu..
mammapappa is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-06-2011 , 22:36   Re: Menu Dont show up..
Reply With Quote #4

I meant to say do you know if the function ShowWeaponMenu is actually being called? You need to debug it (put a client print at the begining of the function to see if it actually is being called). Also, check for runtime errors in the error logs.
__________________

Last edited by fysiks; 01-06-2011 at 22:39.
fysiks is offline
mammapappa
Member
Join Date: Nov 2008
Old 01-07-2011 , 02:52   Re: Menu Dont show up..
Reply With Quote #5

well i added a Print_chat.. but it didnt show when i pressed weaponmenu so i guess it's not called?
mammapappa is offline
Elusive138
Senior Member
Join Date: Dec 2010
Old 01-07-2011 , 03:26   Re: Menu Dont show up..
Reply With Quote #6

Ok... what?
Quote:
PHP Code:
    new data[6], iName[64], accesscallback
    new 
key str_to_num(data); 
    switch(
key
    { 
        case 
1
        { 
            
ShowWeaponMenu(id); 
            return 
PLUGIN_HANDLED
        } 
    } 
Key will always be 0... menu_item_getinfo needs to be above the str_to_num for this to work.

Alternatively, you could just use item. The first menu item is 0, the second is 1, etc. So:
PHP Code:
if (item == 0)
{
    
ShowWeaponMenu(id)
    return 
PLUGIN_HANDLED


Last edited by Elusive138; 01-07-2011 at 03:35.
Elusive138 is offline
mammapappa
Member
Join Date: Nov 2008
Old 01-07-2011 , 07:10   Re: Menu Dont show up..
Reply With Quote #7

still dont show the menu but it's called cuz i got the Print_chat
mammapappa 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 02:12.


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