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

SetMenuExitBackButton


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sim242
AlliedModders Donor
Join Date: Dec 2012
Location: England
Old 03-22-2015 , 08:17   SetMenuExitBackButton
Reply With Quote #1

Hey guys, I just wanted to know exactly how to use this function. It has MenuEnd_ExitBack and I thought I knew how to use it but apparently not.

I've set up a menu that when you select an item it opens a new menu. On the new menu I want a back button that would take the user back to the previous menu but I'm not sure how to do this.

Any help is appreciated, thanks.
__________________
Steam - Sim
Request a private plugin
Not accepting requests at this time
sim242 is offline
Send a message via Skype™ to sim242
ici
Member
Join Date: Jan 2014
Old 03-22-2015 , 11:13   Re: SetMenuExitBackButton
Reply With Quote #2

PHP Code:
FirstMenu(client)
{
    new 
Handle:menu CreateMenu(FirstMenu_Handler);
    
SetMenuTitle(menu"My First Menu");
    
AddMenuItem(menu"1""Go to the second menu");
    
SetMenuOptionFlags(menuMENUFLAG_BUTTON_EXIT|MENUFLAG_NO_SOUND);
    
DisplayMenu(menuclientMENU_TIME_FOREVER);
}

public 
FirstMenu_Handler(Handle:menuMenuAction:actionparam1param2)
{
    switch (
action)
    {
        case 
MenuAction_Select:
        {
            
decl String:info[4];
            
GetMenuItem(menuparam2infosizeof(info));
            new 
key StringToInt(info);
            if (
key == 1) {
                
SecondMenu(param1);
            }
        }
        case 
MenuAction_EndCloseHandle(menu);
    }
}

SecondMenu(client)
{
    new 
Handle:menu CreateMenu(SecondMenu_Handler);
    
SetMenuTitle(menu"My Second Menu");
    
AddMenuItem(menu"1""Test 1");
    
AddMenuItem(menu"2""Test 2");
    
SetMenuOptionFlags(menuMENUFLAG_BUTTON_EXIT|MENUFLAG_BUTTON_EXITBACK|MENUFLAG_NO_SOUND);
    
DisplayMenu(menuclientMENU_TIME_FOREVER);
}

public 
SecondMenu_Handler(Handle:menuMenuAction:actionparam1param2)
{
    switch (
action)
    {
        case 
MenuAction_Select:
        {
            
decl String:info[4];
            
GetMenuItem(menuparam2infosizeof(info));
            new 
key StringToInt(info);
            switch (
key)
            {
                case 
1PrintToChat(param1"You selected Test 1");
                case 
2PrintToChat(param1"You selected Test 2");
            }
        }
        case 
MenuAction_Cancel:
        {
            if (
param2 == MenuCancel_ExitBack) {
                
FirstMenu(param1);
            }
        }
        case 
MenuAction_EndCloseHandle(menu);
    }

ici is offline
sim242
AlliedModders Donor
Join Date: Dec 2012
Location: England
Old 03-22-2015 , 12:19   Re: SetMenuExitBackButton
Reply With Quote #3

Thanks ici, I got it working now, much appreciated
__________________
Steam - Sim
Request a private plugin
Not accepting requests at this time
sim242 is offline
Send a message via Skype™ to sim242
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 23:05.


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