AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Player Menu... (https://forums.alliedmods.net/showthread.php?t=19998)

Zenith77 10-30-2005 09:13

Player Menu...
 
Ok I have added these to parts to the code...

Code:
switch(Action[id]) {                 case 1: {             iKeys |= (1<<iCurrKey++)                         iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. Tryout")         }         case 2: {                         iKeys |= (1<<iCurrKey++)                     format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. Accept")         }                 default: {                         Action[id] = ACTION_TRYOUT                         iKeys |= (1<<iCurrKey++)                         iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. Tryout")         }     }

and


Code:
case 7: {             client_print(id, print_chat, "***CASE 7 ACTIVATED! ********" )             switch(Action[id]) {                                 case 1: {                                         Action[id] = ACTION_ACCEPT                                         ShowtryoutSelMenu(id, g_iMenuPosition)                 }                                 case 2: {                                         Action[id] = ACTION_TRYOUT                                         ShowtryoutSelMenu(id, g_iMenuPosition)                 }             }         }

and added it to this

Code:
public ShowtryoutSelMenu( id, pos ) {         if( pos < 0 ) return         new i, j     new szMenuBody[MENU_SIZE]     new iCurrKey = 0     new szUserName[32]     new iStart = pos * MENU_PLAYERS     new iNum         get_players( g_iMenuPlayers, iNum )         if( iStart >= iNum )         iStart = pos = g_iMenuPosition = 0         new iLen = format( szMenuBody, MENU_SIZE-1, "\rTryout | Accept Menu \R%d/%d^n\w^n", pos+1, (iNum / MENU_PLAYERS + ((iNum % MENU_PLAYERS) ? 1 : 0 )) )     new iEnd = iStart + MENU_PLAYERS     new iKeys = (1<<9|1<<7)         if( iEnd > iNum )         iEnd = iNum         for( i = iStart; i < iEnd; i++ )         {         j = g_iMenuPlayers[i]         get_user_name( j, szUserName, 31 )                 if( is_user_admin(j) )             {             iCurrKey++             iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "\d%d. %s^n\w", iCurrKey, szUserName )         }else         {             iKeys |= (1<<iCurrKey++)             iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "%d. %s^n", iCurrKey, szUserName )         }     }         switch(Action[id]) {                 case 1: {             iKeys |= (1<<iCurrKey++)                         iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. Tryout")         }         case 2: {                         iKeys |= (1<<iCurrKey++)                     format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. Accept")         }                 default: {                         Action[id] = ACTION_TRYOUT                         iKeys |= (1<<iCurrKey++)                         iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. Tryout")         }     }         if( iEnd != iNum )         {         format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n9. More...^n0. %s", pos ? "Back" : "Exit" )         iKeys |= (1<<8)     }     else     format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n0. %s", pos ? "Back" : "Exit" )         show_menu( id, iKeys, szMenuBody, -1 )         return } public PressedtryoutSelMenu( id, key ) {         switch( key ) {                         case 8: ShowtryoutSelMenu( id, ++g_iMenuPosition ) // More Option         case 9: ShowtryoutSelMenu( id, --g_iMenuPosition ) // Back Option                 case 7: {             client_print(id, print_chat, "***CASE 7 ACTIVATED! ********" )             switch(Action[id]) {                                 case 1: {                                         Action[id] = ACTION_ACCEPT                                         ShowtryoutSelMenu(id, g_iMenuPosition)                 }                                 case 2: {                                         Action[id] = ACTION_TRYOUT                                         ShowtryoutSelMenu(id, g_iMenuPosition)                 }             }         }                 // Chose a Player         default:         {             new iPlayerID = g_iMenuPlayers[g_iMenuPosition * MENU_PLAYERS + key]                                     switch(Action[id]) {                                 case 1: ShowTryOutMenu(iPlayerID)                 case 2: AcceptTarget(id, iPlayerID)             }                     }     }     return PLUGIN_HANDLED }

But when i press 8 nothing happens, i mean nothing, the menu just sits there, it doesnt even exit? Anybody have any idea why ?

[ --<-@ ] Black Rose 10-30-2005 10:37

this works... use this somehow i dont get ur whole script so i wont go in it and change stuff :wink:

i think the prob was something in init like this :
Code:
register_menucmd(register_menuid("menu11"),1023,"menu_handler")
i guess u forgot the "menu_handler" thing or something
Code:
#include <amxmodx> #include <amxmisc> #include <fun> new arg1[32] public plugin_init() {     register_plugin("Menutest", "1.0.0", "[ --<-@ ]")     register_menucmd(register_menuid("menu11"),1023,"menu_handler")     register_concmd("amx_menutest", "menu22", ADMIN_MENU, "amx_menutest <player> to show menu to player") } public menu22(id)     {         read_argv( 1, arg1, 31 )         if ( equal( arg1, "" ) ) {         client_print( id, print_console, "[ --<-@ ] Wich player to show the menu?" )         client_print( id, print_console, "[ --<-@ ] Usage: amx_menutest <player>" )         return PLUGIN_HANDLED     }         new menubody[128], keys     format(menubody, 127, "Menu_Name^n^n1. 200 Health^n2. Half Gravity^n8. Exit")     keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_8         new player = cmd_target( id, arg1, 0 )     show_menu( player, keys, menubody, 6, "menu11" )     return PLUGIN_HANDLED } public menu_handler(id, key) {     if( key == 0 )         {         set_user_health( id, 200 )     }     if( key == 1 )         {         set_user_gravity( id, 0.5 )     }     if( key == 7 )         {         return PLUGIN_HANDLED     }     new username[32]     get_user_name( id, username,31 )     client_print( 0, print_chat, "%s choosed #%i", username, key+1 ) // To se if it calls anything     return PLUGIN_HANDLED }

broertje 10-30-2005 10:58

Maybe You HaveTo Do Something So It Goes To The Case After It,I Dont Get It :?

[ --<-@ ] Black Rose 10-30-2005 11:01

Quote:

Originally Posted by broertje
Maybe You HaveTo Do Something So It Goes To The Case After It,I Dont Get It :?

Stop With Your Capitalizing Letters All The Time. Its Annoying!

Hawk552 10-30-2005 11:03

Quote:

Originally Posted by [ --<-@
Black Rose]
Quote:

Originally Posted by broertje
Maybe You HaveTo Do Something So It Goes To The Case After It,I Dont Get It :?

Stop With Your Capitalizing Letters All The Time. Its Annoying!

Agreed.

broertje 10-30-2005 11:03

Delete Pls

Hawk552 10-30-2005 11:03

Sounds fine by me, from now on I'll just ignore anything you have to say.

Zenith77 10-30-2005 11:04

I dont think the menu handler is the problem...


but what i do think the problem is this

Quote:

show_menu( player, keys, menubody, 6, "menu11" )
In the bold.


I used a template if you will for my menu which amxx default plugins use...i noticed it didnt have the "call function", it stil worked so i dismissed it, but i try adding one and see if it works...

broertje 10-30-2005 11:04

Delete Pls

Hawk552 10-30-2005 11:06

what


All times are GMT -4. The time now is 23:42.

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