Raised This Month: $ Target: $400
 0% 

Second page in a menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
h3llzOr
Member
Join Date: Nov 2011
Old 01-01-2013 , 20:13   Second page in a menu
Reply With Quote #1

Hi, i want to know how to do an second page to this menu, i have meny times and not working...

PHP Code:
// Function will display the changerace menu
public MENU_ChangeRaceidiRaceXP[MAX_RACES] )
{
    
    new 
szRaceName[MAX_RACES+1][64], iposiKeys 0szMenu[512], szXP[16];

    
// Get our race names
    
for ( 0get_pcvar_numCVAR_wc3_races ); i++ )
    {
        
lang_GetRaceName1idszRaceName[i], 63 );
    }

    
pos += formatexszMenu[pos], 512-pos"%L"id"MENU_SELECT_RACE" );

    
// Then add the experience column
    
if ( get_pcvar_numCVAR_wc3_save_xp ) )
    {
        
pos += formatexszMenu[pos], 512-pos"\R%L^n^n"id"MENU_WORD_LEVEL" );
    }
    else
    {
        
pos += formatexszMenu[pos], 512-pos"^n^n" );
    }

    
// Build the changerace menu (for every race)
    
for ( 0get_pcvar_numCVAR_wc3_races ); i++ )
    {
        
num_to_striRaceXP[i], szXP15 );
        
        
// Add the "Select a Hero" message if necessary
        /*if ( i == 4 )
        {
            pos += format( szMenu[pos], 512-pos, "%L", id, "SELECT_HERO" );
        }*/
        
        // User's current race
        
if ( == p_data[id][P_RACE] - )
        {
            
pos += formatexszMenu[pos], 512-pos"\d%d. %s\d\R%s^n"1szRaceName[i], ( (get_pcvar_numCVAR_wc3_save_xp )) ? szXP " " ) );

            
iKeys |= (1<<i);
        }

        
// Race the user wants to change to
        
else if ( == p_data[id][P_CHANGERACE] - )
        {
            
pos += formatexszMenu[pos], 512-pos"\r%d. %s\r\R%s^n"1szRaceName[i], ( (get_pcvar_numCVAR_wc3_save_xp )) ? szXP " " ) );

            
iKeys |= (1<<i);
        }

        
// All other cases
        
else
        {
            
/*
            new iRaceLimit = get_pcvar_num( CVAR_wc3_race_limit );
            new bool:bAllowRace = true;

            if ( iRaceLimit > 0 )
            {
                new iTotal[MAX_RACES];

                // Get how many people are using each race
                new iPlayers[32], iNumPlayers, i, iTarget;
                get_players( iPlayers, iNumPlayers );

                for ( i = 0; i < iNumPlayers; i++ )
                {
                    iTarget = iPlayers[i];

                    if ( iTarget != id && p_data[iTarget][P_RACE] > 0 && p_data[iTarget][P_RACE] <= get_pcvar_num( CVAR_wc3_races ) )
                    {
                        iTotal[p_data[iTarget][P_RACE]]++;
                    }
                }
                
                // Now if we have more races selected than iRaceLimit provides us with, then we need to increase iRaceLimit
                while ( HLPR_TotalUsingRaces( iTotal ) > iRaceLimit * get_playersnum() )
                {
                    iRaceLimit++;
                }

                // Check to see if there was an increase that was necessary
                if ( iRaceLimit > get_pcvar_num( CVAR_wc3_race_limit ) )
                {
                    WC3_Log( true, "Error, increase wc3_race_limit to at least %d", iRaceLimit );
                }

                if ( iTotal[i+1] >= iRaceLimit )
                {
                    bAllowRace = false;

                }
            }*/

            
new bool:bAllowRace true;

            
// Check to see if the user can choose this race (are there too many of this race?)
            
if ( bAllowRace )
            {
                
pos += formatexszMenu[pos], 512-pos"\w%d. %s\y\R%s^n"1szRaceName[i], ( (get_pcvar_numCVAR_wc3_save_xp )) ? szXP " " ) );

                
iKeys |= (1<<i);
            }

            
// If not, display the race, but don't give them a key to press
            
else
            {
                
pos += formatexszMenu[pos], 512-pos"\d%d. %s\y\R%s^n"1szRaceName[i], ( (get_pcvar_numCVAR_wc3_save_xp )) ? szXP " " ) );
            }
        }

    }

    
iKeys |= (1<<i);
    
    
// This is needed so we can make the Auto-Select option "0" if the number of races is 9
    
if ( get_pcvar_numCVAR_wc3_races ) == )
    {
        
= -1;
    }

    
pos += formatszMenu[pos], 512-pos"%L"id"WORD_CANCEL");
    
    
// Add a cancel button to the bottom
    
if ( get_pcvar_numCVAR_wc3_races ) != )
    {
        
iKeys |= (1<<9);

        
pos += formatszMenu[pos], 512-pos"^n\w0. %L"id"WORD_CANCEL" );
    }
    
    
// Show the menu to the user!
    
show_menuidiKeysszMenu, -);

    return;
}

/*HLPR_TotalUsingRaces( iTotalRaces[MAX_RACES] )
{
    new iTotal = 0;
    for ( new i = 1; i <= get_pcvar_num( CVAR_wc3_races ); i++ )
    {
        WC3_Log( true, "%d", i );
        iTotal += iTotalRaces[i];
    }

    return iTotal;
}*/


public _MENU_ChangeRaceidkey )
{

    if ( !
WC3_Check() )
    {
        return 
PLUGIN_HANDLED;
    }
    
    
// User pressed 0 (cancel)
    
if ( get_pcvar_numCVAR_wc3_races ) < && key == get_pcvar_numCVAR_wc3_races ) )
    {
        return 
PLUGIN_HANDLED;
    }

    
// Save the current race data before we change
    
DB_SaveXPidfalse );

    new 
iRaceiCancelKey KEY_0;
    
    
// CAncel ( 0 )
    
if ( key == iCancelKey )
    {
        return 
PLUGIN_HANDLED;
    }

    
// Otherwise race is set
    
else
    {
        
iRace key 1;
    }

    if(
iRace == 9)  
    {  
        if(!(
get_user_flags(id) & ADMIN_LEVEL_H ))  
        {  
            
client_printidprint_center"You have not acces to this race!");    

            return 
PLUGIN_HANDLED;  
        }  
    }
 
    
// User currently has a race
    
if ( p_data[id][P_RACE] != )
    {

        
// Change the user's race at the start of next round
        
if ( iRace != p_data[id][P_RACE] )
        {
            
            
// Special message for csdm
            
if ( CVAR_csdm_active && get_pcvar_numCVAR_csdm_active ) == )
            {
                
client_printidprint_center"Your race will be changed when you respawn" );
            }    
            else
            {
                
client_printidprint_center"%L"id"CENTER_CHANGED_NEXT" );
            }

            
p_data[id][P_CHANGERACE] = iRace;
        }

        
// Do nothing
        
else
        {
            
p_data[id][P_CHANGERACE] = 0;
        }
    }

    
// User doesn't have a race so give it to him!!!
    
else
    {
        
WC3_SetRaceidiRace );
    }

    return 
PLUGIN_HANDLED;


Did anyone want to help me ? please
h3llzOr is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-01-2013 , 20:41   Re: Second page in a menu
Reply With Quote #2

Look at existing plugins that already do it. It's not an easy/short explanation. The alternative is to use the "New Menu" system (not necessarily better, just different) which does all the pages automatically for you.

mapsmenu.sma is on example that does it with the traditional menu system.
__________________
fysiks is offline
h3llzOr
Member
Join Date: Nov 2011
Old 01-02-2013 , 05:34   Re: Second page in a menu
Reply With Quote #3

can you put an exemple here, i heva try two times from two exemples but not working...
h3llzOr is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-02-2013 , 20:22   Re: Second page in a menu
Reply With Quote #4

"putting an example here" don't do any good if you've read my last post. If you can't get it to work then I suggest using the "New Menu" method that does it all for you. It's much quicker to learn and code.
__________________
fysiks 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 13:33.


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