Raised This Month: $ Target: $400
 0% 

Old Menu Command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 10-21-2010 , 08:14   Old Menu Command
Reply With Quote #1

Hy, all first i have the folowing code
And when i press 1 for case1 doesn't work apears in chat Players Rank but it doesn't execute say /rank for player

So i don't know where to add the question and where to add command

If anyone know please help me with an example

Thank You!

EDIT: I succeded, normal must start with case 0: for old menus.

Thanks
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers

Last edited by CryWolf; 10-21-2010 at 08:47.
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 10-21-2010 , 09:27   Re: Old Menu Command
Reply With Quote #2

New HELP Needed

For the second page of the menu when i click nr 1. it redirects me back to chase 0:

How i can create a case for the second menu and bind it to the first option

I tryed creating case 10: but doesnt work

Any help ?
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 10-21-2010 , 09:38   Re: Old Menu Command
Reply With Quote #3

Use Case 8 !
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 10-21-2010 , 09:41   Re: Old Menu Command
Reply With Quote #4

I'm using this model
Code:
/* Multi-page menu */ 



#include <amxmod>
#include <amxmisc>

#define MAX_MENU 16    //  This is the number of options u have
#define MAX_DISPLAY 8    //  This is the number of Options per page (Dont change)
#define MAX_PAGES 2    //  This is the number of pages (MAX_MENU / MAX_DISPLAY [if Remainder>0 Then +1])

new g_szOptions[ MAX_MENU ][ ] = { 
 "PG 1: Option 1",
 "PG 1: Option 2",
 "PG 1: Option 3",
 "PG 1: Option 4",
 "PG 1: Option 5",
 "PG 1: Option 6",
 "PG 1: Option 7",
 "PG 1: Option 8",

 "PG 2: Option 1",
 "PG 2: Option 2",
 "PG 2: Option 3",
 "PG 2: Option 4",
 "PG 2: Option 5",
 "PG 2: Option 6",
 "PG 2: Option 7",
 "PG 2: Option 8"
}

new g_nMenuPosition[33]


public plugin_init()
{
    register_menucmd( register_menuid("\yOptions Menu:"), 1023, "MenuCommand" )

    register_clcmd( "say /menu","DoShowMenu", ADMIN_MENU, "Shows The menu" )

    return PLUGIN_CONTINUE
}


public MenuCommand( id, key )
{
    switch( key )
    {
        case 8: ShowMenu( id, ++g_nMenuPosition[id] )
        case 9: ShowMenu( id, --g_nMenuPosition[id] )
          default:
                {
                    new iIndex = g_nMenuPosition[id] * MAX_DISPLAY + key
                    client_print( id, print_chat, "%s", g_szOptions[iIndex] )
                }
      }

      return PLUGIN_HANDLED
}


public ShowMenu( id, pos )
{
    if( pos < 0 ) return

    new i, j = 0
    new nKeys, nStart, nEnd, nLen
    new szMenuBody[512]

    nStart = pos * MAX_DISPLAY

    if( nStart >= MAX_MENU )
        nStart = pos = g_nMenuPosition[id] = 0

    nLen = format( szMenuBody, 511, "\yOptions Menu:\R%d/%d^n\w^n", pos + 1, MAX_PAGES )
    nEnd = nStart + MAX_DISPLAY
    nKeys = (1<<9)

    if( nEnd > MAX_MENU ) nEnd = MAX_MENU

    for( i = nStart; i < nEnd; i++ )
    {
        nKeys |= (1<<j++)
        nLen += format( szMenuBody[nLen], (511-nLen), "\d%d. %s^n\w", j, g_szOptions[i] )
    }

    if( nEnd != MAX_MENU )
      {
        format( szMenuBody[nLen], (511-nLen), "^n9. More...^n0. %s", pos ? "Back" : "Exit" )
        nKeys |= (1<<8)
    }
      else format( szMenuBody[nLen], (511-nLen), "^n0. %s", pos ? "Back" : "Exit" )
    
    show_menu( id, nKeys, szMenuBody, -1 )
}


public DoShowMenu( id, lvl, cid )
{
    if( cmd_access( id, lvl, cid, 1 ) )
        ShowMenu( id, g_nMenuPosition[id] = 0 )

    return PLUGIN_HANDLED
}
case 8 and 9 is taken i don't know how to bind another option for second page 2/2 to another case
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-21-2010 , 13:27   Re: Old Menu Command
Reply With Quote #5

That code looks fine to me. You can look at plmenu.sma for examples. Also, if something is not working correctly you need to debug.
__________________
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 10:19.


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