Raised This Month: $51 Target: $400
 12% 

[Solved]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
d3athkai
Junior Member
Join Date: Jul 2009
Old 12-25-2009 , 04:51   [Solved]
Reply With Quote #1

Thanks for the help.
__________________


Last edited by d3athkai; 12-26-2009 at 22:03.
d3athkai is offline
Bigbuck
Senior Member
Join Date: Jul 2009
Old 12-25-2009 , 13:03   Re: [L4D] Sub Menu
Reply With Quote #2

This is just a copy/paste from one of my plugins that uses keyvalues, but hopefully you can figure it out. Menu_Campaign creates the main menu then the MenuHandler_Campaign creates the sub menu based off of the selection from the main menu which is stored as a global string, campaign_selected.

PHP Code:
/**
 * Creates the ZA campaign menu
 *
 * @param: Client - The Client that is using the menu
 * @param: args - The clients choice
 *
 */
public ActionMenu_Campaign(Clientargs)
{
    
// Create campaign menu handle
    
new HandleCampaignMenu CreateMenu(MenuHandler_Campaign);
    
// Set menu title
    
SetMenuTitle(CampaignMenu"%T:""L_CHANGE_CAMPAIGN"LANG_SERVER);

    new 
Handlecampaigns CreateKeyValues("ZA_CampaignsMenu");
    
FileToKeyValues(campaigns"addons/sourcemod/configs/l4d_zombie_apocalypse_campaigns_menu.txt");

    
// Get correct maps based on game
    
if (game_l4d)
    {
        
KvJumpToKey(campaigns"L4D"false);
        if (
KvGotoFirstSubKey(campaigns))
        {
            
LoadCampaignValues(campaignsCampaignMenu);
        }
    }
    else if (
game_l4d2)
    {
        
KvJumpToKey(campaigns"L4D2"false);
        if (
KvGotoFirstSubKey(campaigns))
        {
            
LoadCampaignValues(campaignsCampaignMenu);
        }
    }

    
// Always close this to prevent memory errors
    
CloseHandle(campaigns);

    
DisplayMenu(CampaignMenuClient20);

    return 
Plugin_Handled;
}

/**
 * ZA campaign menu handler
 *
 * @handle: CampaignMenu - The campaign menu handle
 * @menuaction: action - The action the user has taken on the menu
 * @param: Client - The Client using the menu
 * @param: position - The name of the campaign chosen
 *
 */
public MenuHandler_Campaign(HandleCampaignMenuMenuActionactionClientposition)
{
    if (
action == MenuAction_Select)
    {
        
// Get the chosen campaign name
        
GetMenuItem(CampaignMenupositioncampaign_selectedsizeof(campaign_selected));

        new 
HandleMapMenu CreateMenu(MenuHandler_Map);
        
SetMenuTitle(MapMenu"%T:"campaign_selectedLANG_SERVER);

        new 
Handlemaps CreateKeyValues("ZA_CampaignsMenu");
        
FileToKeyValues(maps"addons/sourcemod/configs/l4d_zombie_apocalypse_campaigns_menu.txt");

        
// Get to the correct position based on game
        
if (game_l4d)
        {
            
KvJumpToKey(maps"L4D"false);
        }
        else if (
game_l4d2)
        {
            
KvJumpToKey(maps"L4D2"false);
        }

        
// Get the maps
        
if(KvJumpToKey(mapscampaign_selectedfalse))
        {
            if (
KvGotoFirstSubKey(maps))
            {
                
LoadCampaignValues(mapsMapMenu);
            }
        }

        
// Always close this to prevent memory errors
        
CloseHandle(maps);

        
DisplayMenu(MapMenuClient20);
    }

Bigbuck 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 18:17.


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