Raised This Month: $ Target: $400
 0% 

menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
21
Junior Member
Join Date: Mar 2005
Old 03-12-2005 , 20:04   menu
Reply With Quote #1

cany some1 show me the small for a menu that would have all the players on your server on the menu and, and when you selected one, it would carry out a command on them, and use "//... [whatever].." so i know what it all means. also tell me weir i can edit what command would be executed.

and i have been wondering if you can have a non-amxx/amx menu and have it show all players on the server, just a regular menu script not for any admin mods.
21 is offline
Send a message via AIM to 21
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-13-2005 , 01:09  
Reply With Quote #2

This will work for an AMX or AMXX plugin:

Code:
#include <amxmodx> #include <amxmisc> #define MENU_SIZE    256 #define MENU_PLAYERS 8 new g_iMenuPosition new g_iMenuPlayers[32] public plugin_init() {     register_menucmd( register_menuid("\rPlayer Menu:"), 1023, "MenuAction" )     register_clcmd( "amx_showmenu", "ShowMenu", ADMIN_KICK, "- Shows The Player Menu" ) } public ShowMenu( id, lvl, cid ) {     if( cmd_access( id, lvl, cid, 1 ) )         ShowPlayerMenu( id, g_iMenuPosition = 0 )     return PLUGIN_HANDLED } public ShowPlayerMenu( 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, "\rPlayer 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( (get_user_flags(j) & ADMIN_IMMUNITY) || !is_user_alive(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 )         }     }     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 MenuAction( id, key ) {     switch( key )     {         case 8: ShowPlayerMenu( id, ++g_iMenuPosition ) // More Option         case 9: ShowPlayerMenu( id, --g_iMenuPosition ) // Back Option         // Chose a Player         default:         {             new iPlayerID = g_iMenuPlayers[g_iMenuPosition * MENU_PLAYERS + key]             new szUsername[32]             get_user_name( iPlayerID, szUsername, 31 )             client_print( id, print_chat, "You Picked Player: '%s'!", szUsername )             // do any command on iPlayerID, like:             set_user_noclip( iPlayerID, 1 )         }     }     return PLUGIN_HANDLED }

Pretty self-explanitory if you read the code..
xeroblood is offline
Send a message via MSN to xeroblood
west
Member
Join Date: Feb 2005
Old 03-13-2005 , 02:01  
Reply With Quote #3

weir do you put the cammand that wil be exicuted on the client you choose?
west is offline
Send a message via AIM to west
west
Member
Join Date: Feb 2005
Old 03-13-2005 , 03:30  
Reply With Quote #4

and hey xeroblood, member me, i was playin sw3 with you b4 you relesed it
west is offline
Send a message via AIM to west
LynX
Veteran Member
Join Date: Oct 2004
Old 03-13-2005 , 03:39  
Reply With Quote #5

Or you can do menu like this if you want:
Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("Menu","0.1","LynX")     register_clcmd( "Menu","NewMenu", -1, "Show the selection menu" )     register_menucmd( register_menuid("Choose option:"), 1023, "MenuCommand" )     return PLUGIN_HANDLED } public NewMenu( id ) {     new szMenuBody[256]     new keys     format( szMenuBody, 255, "Choose :^n1. Option 1^n2  Option 2^n3. Option 3^n^n0. Exit" )     keys = (1<<0|1<<1|1<<2|1<<9)           show_menu( id, keys, szMenuBody, -1 )     return PLUGIN_HANDLED } public MenuCommand( id , key ) {     switch( key )     {         case 0:  {                                    client_print(id, print_chat,"Option 1")                  }         case 1:  {                  client_print(id, print_chat, "Option2")                  }         case 2:  {                  client_print(id, print_chat, "Option 3")                  }         case 3: client_print( id, print_chat, "Closed the selection menu" )     }     return PLUGIN_HANDLED }

Works 100%
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
21
Junior Member
Join Date: Mar 2005
Old 03-13-2005 , 04:16  
Reply With Quote #6

does that menu show players? and when you select a player will it execute a cammand tward/on them?
if so what parts do i change for the cammand?
and i dont see anything about players :/
21 is offline
Send a message via AIM to 21
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-13-2005 , 09:42  
Reply With Quote #7

Read the example I posted.. the very last function has what you are looking for..
Code:
new iPlayerID = g_iMenuPlayers[g_iMenuPosition * MENU_PLAYERS + key] new szUsername[32] get_user_name( iPlayerID, szUsername, 31 ) client_print( id, print_chat, "You Picked Player: '%s'!", szUsername ) // do any command on iPlayerID, like: set_user_noclip( iPlayerID, 1 )

@west: Sup man, I remember you.. starwars3 was fun, but now you gotta check out my ka_hockey!!
xeroblood is offline
Send a message via MSN to xeroblood
west
Member
Join Date: Feb 2005
Old 03-13-2005 , 13:56  
Reply With Quote #8

telk on aim zero, and ty 4 the menu help
west is offline
Send a message via AIM to west
21
Junior Member
Join Date: Mar 2005
Old 03-13-2005 , 13:58  
Reply With Quote #9

Yes thank you everyone and hey agen west
21 is offline
Send a message via AIM to 21
west
Member
Join Date: Feb 2005
Old 03-13-2005 , 16:16  
Reply With Quote #10

ok this isnt working

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define MENU_SIZE    256 #define MENU_PLAYERS 8 new g_iMenuPosition new g_iMenuPlayers[32] public plugin_init() {     register_menucmd( register_menuid("\rheal menu - 255 health:"), 1023, "MenuAction" )     register_clcmd( "amx_healmenu", "healMenu", ADMIN_KICK, "- Shows The Player Menu" ) } public ShowMenu( id, lvl, cid ) {     if( cmd_access( id, lvl, cid, 1 ) )         ShowPlayerMenu( id, g_iMenuPosition = 0 )     return PLUGIN_HANDLED } public ShowPlayerMenu( 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, "\rPlayer 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( (get_user_flags(j)) || !is_user_alive(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 )         }     }     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 MenuAction( id, key ) {     switch( key )     {         case 8: ShowPlayerMenu( id, ++g_iMenuPosition ) // More Option         case 9: ShowPlayerMenu( id, --g_iMenuPosition ) // Back Option         // Chose a Player         default:         {             new iPlayerID = g_iMenuPlayers[g_iMenuPosition * MENU_PLAYERS + key]             new szUsername[32]             get_user_name( iPlayerID, szUsername, 31 )             client_print( id, print_chat, "You Picked Player: '%s'!", szUsername )             // do any command on iPlayerID, like:             set_user_health ( 32, 255 )           }     }     return PLUGIN_HANDLED } === compiled with no warnings/errors but when i type "amx_healmenu" into console i get "unknowncammand" and the plugin is loaded as well, i cheked that. whats wrong?
west is offline
Send a message via AIM to west
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 14:06.


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