AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu Page 2 Help~ (https://forums.alliedmods.net/showthread.php?t=13297)

lucky109 05-11-2005 13:20

Menu Page 2 Help~
 
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 05-11-2005 20:15

help><

lucky109 05-12-2005 12:37

anyone can help me please><

Lazarus Long 05-12-2005 13:17

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,

v3x 05-12-2005 13:51

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 }
:D

xeroblood 05-12-2005 21:52

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!

cTn 10-31-2005 12:36

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..

Zenith77 10-31-2005 12:41

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!

cTn 10-31-2005 12:44

i still dont now 8)

cTn 10-31-2005 17:13

just help me someoneeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee


All times are GMT -4. The time now is 16:37.

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