Raised This Month: $ Target: $400
 0% 

Menu Page 2 Help~


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lucky109
Senior Member
Join Date: Jan 2005
Old 05-11-2005 , 13:20   Menu Page 2 Help~
Reply With Quote #1

how to add page 2 in my menu ?

help...

Quote:
#include <amxmod>


public plugin_init()
{
register_clcmd( "say /menu","ShowMenu", -1, "Shows The menu" )
register_menucmd(register_menuid("\yFirst Menu:"), 1023, "MenuCommand" )

return PLUGIN_CONTINUE
}

public ShowMenu( id )
{
new szMenuBody[256]
new keys

new nLen = format( szMenuBody, 255, "\yFirst Menu:^n" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w1. First Option" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w2. Second Option" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w3. Third Option" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w4. Fourth Option" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w5. Fifth Option" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w6. Sixth Option" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w7. Seventh Option" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w8. Eighth Option" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n\w9. Ninth Option" )
nLen += format( szMenuBody[nLen], 255-nLen, "^n^n\w0. Exit" )

keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8 |1<<9)

show_menu( id, keys, szMenuBody, -1 )

return PLUGIN_CONTINUE
}

public MenuCommand( id, key )
{
switch( key )
{
case 0: client_print( id, print_chat, "Menu Option #1" )

case 1: client_print( id, print_chat, "Menu Option #2" )

case 2: client_print( id, print_chat, "Menu Option #3" )

case 3: client_print( id, print_chat, "Menu Option #4" )

case 4: client_print( id, print_chat, "Menu Option #5" )

case 5: client_print( id, print_chat, "Menu Option #6" )

case 6: client_print( id, print_chat, "Menu Option #7" )

case 7: client_print( id, print_chat, "Menu Option #8" )

case 8: client_print( id, print_chat, "Menu Option #9" )

case 9: client_print( id, print_chat, "Menu Option EXIT" )
}

return PLUGIN_HANDLED
}
lucky109 is offline
lucky109
Senior Member
Join Date: Jan 2005
Old 05-11-2005 , 20:15  
Reply With Quote #2

help><
lucky109 is offline
lucky109
Senior Member
Join Date: Jan 2005
Old 05-12-2005 , 12:37  
Reply With Quote #3

anyone can help me please><
lucky109 is offline
Lazarus Long
Senior Member
Join Date: Oct 2004
Old 05-12-2005 , 13:17  
Reply With Quote #4

Hello, lucky109:

I'm just as new to scripting as you but from what I understood from the docs, simply create a second menu and link one of your options to a call to it.

I hope this helps, regards,
__________________
Lazarus Long is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-12-2005 , 13:51  
Reply With Quote #5

Like this:
Code:
#include <amxmod> public plugin_init() {     register_clcmd( "say /menu","ShowMenu", -1, "Shows The menu" )     register_menucmd(register_menuid("\yFirst Menu:"), 1023, "MenuCommand" )     register_menucmd(register_menuid("\ySecond Menu:"), 1023, "MenuCommand2" )     return PLUGIN_CONTINUE } public ShowMenu( id ) {     new szMenuBody[256]     new keys     new nLen = format( szMenuBody, 255, "\yFirst Menu:^n" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w1. First Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w2. Second Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w3. Third Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w4. Fourth Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w5. Fifth Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w6. Sixth Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w7. Seventh Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w8. Eighth Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w9. Next" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n^n\w0. Exit" )     keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)     show_menu( id, keys, szMenuBody, -1 )     return PLUGIN_CONTINUE } public MenuCommand( id, key ) {     switch( key ) {         case 0: client_print( id, print_chat, "Menu Option #1" )         case 1: client_print( id, print_chat, "Menu Option #2" )         case 2: client_print( id, print_chat, "Menu Option #3" )         case 3: client_print( id, print_chat, "Menu Option #4" )         case 4: client_print( id, print_chat, "Menu Option #5" )         case 5: client_print( id, print_chat, "Menu Option #6" )         case 6: client_print( id, print_chat, "Menu Option #7" )         case 7: client_print( id, print_chat, "Menu Option #8" )         case 8: ShowMenu2(id)         //case 9: client_print( id, print_chat, "Menu Option EXIT" )     }     return PLUGIN_HANDLED } // Menu 2 public ShowMenu2( id ) {     new szMenuBody[256]     new keys     new nLen = format( szMenuBody, 255, "\ySecond Menu:^n" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w1. First Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w2. Second Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w3. Third Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w4. Fourth Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w5. Fifth Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w6. Sixth Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w7. Seventh Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w8. Eighth Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w9. Back" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n^n\w0. Exit" )     keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)     show_menu( id, keys, szMenuBody, -1 )     return PLUGIN_CONTINUE } public MenuCommand2( id, key ) {     switch( key ) {         case 0: client_print( id, print_chat, "Menu Option #1" )         case 1: client_print( id, print_chat, "Menu Option #2" )         case 2: client_print( id, print_chat, "Menu Option #3" )         case 3: client_print( id, print_chat, "Menu Option #4" )         case 4: client_print( id, print_chat, "Menu Option #5" )         case 5: client_print( id, print_chat, "Menu Option #6" )         case 6: client_print( id, print_chat, "Menu Option #7" )         case 7: client_print( id, print_chat, "Menu Option #8" )         case 8: ShowMenu(id)         //case 9: client_print( id, print_chat, "Menu Option EXIT" )     }     return PLUGIN_HANDLED }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 05-12-2005 , 21:52  
Reply With Quote #6

Or like this, for less code but added complexity using arrays:

Code:
/* Multi-page menu */ #include <amxmodx> #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" ) } 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             DoAction( id, iIndex )             // If you dont want to keep the menu Open after selecting a command,             // then simply remove the following line:             ShowMenu( id, g_nMenuPosition[id] )         }     }     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 } public DoAction( nAdminID, nIndex ) {     // Do something to the selected option here using nIndex....     // nAdminID will be the ID of the Admin/User who ran the menu...     return PLUGIN_HANDLED }

I hope that helps!
xeroblood is offline
Send a message via MSN to xeroblood
cTn
Senior Member
Join Date: Oct 2005
Old 10-31-2005 , 12:36  
Reply With Quote #7

can u make example for doo this? i mea

Code:
public DoAction( nAdminID, nIndex )
{

    // Do something to the selected option here using nIndex....

    // nAdminID will be the ID of the Admin/User who ran the menu...

    return PLUGIN_HANDLED
i just trying to make menu for glow .. using ultra glow plugin what code i need to past colors asign for this ? or any another example .. pls just show me..
cTn is offline
Send a message via ICQ to cTn Send a message via MSN to cTn
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-31-2005 , 12:41  
Reply With Quote #8

omg, why do people bump topics that are so fricking old its not even funny...



Quote:
Posted: Wed May 11, 2005 2:20 pm

if you have to go 5 million pages back to find a topic, you know what that means, ITS OLD!
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
cTn
Senior Member
Join Date: Oct 2005
Old 10-31-2005 , 12:44  
Reply With Quote #9

i still dont now
__________________
cTn is offline
Send a message via ICQ to cTn Send a message via MSN to cTn
cTn
Senior Member
Join Date: Oct 2005
Old 10-31-2005 , 17:13  
Reply With Quote #10

just help me someoneeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
__________________
cTn is offline
Send a message via ICQ to cTn Send a message via MSN to cTn
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 16:37.


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