Raised This Month: $ Target: $400
 0% 

Make a menu that shows up names


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 02-17-2005 , 11:22  
Reply With Quote #4

Just an example, I didnt actually test this, but it is pretty straight-forward:

Code:
#include <amxmodx> #include <amxmisc> #define MAX_DISPLAY 8   //  This is the number of Options per page (Dont change) // Tracks what page in menu admin is on.. new g_nMenuPosition[33] public plugin_init() {     register_menucmd( register_menuid("\yPlayer Menu:"), 1023, "MenuCommand" )     register_clcmd( "player_menu", "DoShowMenu", ADMIN_MENU, "Shows The Player menu" ) } public MenuCommand( id, key ) {     switch( key )     {         case 8: PlayerMenu( id, ++g_nMenuPosition[id] )         case 9: PlayerMenu( id, --g_nMenuPosition[id] )         default:         {             // This is the Chosen Player Index             new iIndex = g_nMenuPosition[id] * MAX_DISPLAY + key             // Get the Chosen Players Name             new szUsername[32]             get_user_name( iIndex, szUsername, 31 )             // Print Username to Admin who called Menu             client_print( id, print_chat, "You Selected: %s", szUsername )         }     }     return PLUGIN_HANDLED } public PlayerMenu( id, pos ) {     if( pos < 0 ) return     new iMenuPlayers[32], iNum     get_players( iMenuPlayers, iNum )     new i, j, nCurrKey = 0     new szUserName[32]     new szMenuBody[256]     new nStart = pos * MAX_DISPLAY     if( nStart >= iNum )         nStart = pos = g_nMenuPosition[id-1] = 0     new nLen = format( szMenuBody, 255, "\yPlayer Menu:\R%d/%d^n\w^n", (pos+1), (iNum / MAX_DISPLAY + ((iNum % MAX_DISPLAY) ? 1 : 0 )) )     new nEnd = nStart + MAX_DISPLAY     new nKeys = (1<<9)     if( nEnd > iNum ) nEnd = iNum     for( i = nStart; i < nEnd; i++ )     {         j = iMenuPlayers[i]         get_user_name( j, szUserName, 31 )         if( access( j, ADMIN_IMMUNITY ) )         {             nCurrKey++             nLen += format( szMenuBody[nLen], (255-nLen), "\d%d. %s^n\w", nCurrKey, szUserName )         }else         {             nKeys |= (1<<nCurrKey++)             nLen += format( szMenuBody[nLen], (255-nLen), "%d. %s^n", nCurrKey, szUserName )         }     }     if( nEnd != iNum )     {         format( szMenuBody[nLen], (255-nLen), "^n9. More...^n0. Back" )         nKeys |= (1<<8)     }     else     {         format( szMenuBody[nLen], (255-nLen), "^n0. Back" )     }     show_menu( id, nKeys, szMenuBody )     return } public DoShowMenu( id, lvl, cid ) {     if( cmd_access( id, lvl, cid, 0 ) )         PlayerMenu( id, g_nMenuPosition[id] = 0 )     return PLUGIN_HANDLED }

I hope that helps!
xeroblood is offline
Send a message via MSN to xeroblood
 



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 19:28.


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