Raised This Month: $12 Target: $400
 3% 

Make a menu that shows up names


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-16-2005 , 15:22   Make a menu that shows up names
Reply With Quote #1

I made a plugin that changes a players team in counter-strike.
And i want to add a menu on it too. (called amx_team_menu)
Like the first menu shows all names on the server, and when you choose a player you can choose if you want him to go on ct, terror or spectate.
Ive read the menu help in amxmodx doc a lot of times, but i just dont get this menu to work.
Can somebody help me make this menu?
And here is the plugin that i want to add a menu on if that helps...
Attached Files
File Type: sma Get Plugin or Get Source (amx_team.sma - 546 views - 1.8 KB)
XunTric is offline
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 02-16-2005 , 17:18  
Reply With Quote #2

Would this AMX(X) Menu Tutorial by Xeroblood help?
Peli is offline
Send a message via MSN to Peli
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-17-2005 , 10:23  
Reply With Quote #3

Thats for amx? And ive read somewhere that the "add" thing is really waste of code. You can make it with much less code and and "add" maybe crashes the server. am i right?
-----------------------------------
EDIT:
Thats just a one page menu. What im looking for is a multi-menu tutorial. Like the first page shows all the name on the server, and when you choose a name you get a new menu where you can choose to set the player in counter-terrorists, terrorists or spectate. Thanks for the help anyway peli.
----------------------------------
EDIT AGAIN:
Ok i found a multi-menu tutorial there too, but its still for amx and it doesnt stand anything about how to make the menu show up all the names on the server...
XunTric is offline
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
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-17-2005 , 14:00  
Reply With Quote #5

It works thanks
It shows up the names and when you click on it nothing happends.
Can you help me add that too?
Here is the command lines to change team if that helps:

Terror:
Code:
cs_set_user_team(player, CS_TEAM_T, CS_T_TERROR)
CT:
Code:
cs_set_user_team(player, CS_TEAM_CT, CS_CT_SAS)
Spectate:
Code:
cs_set_user_team(player, CS_TEAM_SPECTATOR, CS_DONTCHANGE)
-------------------------------------
EDIT:
And make the player die when the command is used.
XunTric is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-19-2005 , 04:37  
Reply With Quote #6

...xeroblood?
XunTric is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 02-19-2005 , 10:52  
Reply With Quote #7

It should print the name of the player you chose..

To make it change a players team, you would edit this function:

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

Where iIndex is the ID of the chosen player...

Now, you want the player to be changed to a different team?? Which team?? Are you gonna pick the team for them, or just put them on opposite team?
xeroblood is offline
Send a message via MSN to xeroblood
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-19-2005 , 11:51  
Reply With Quote #8

I want to choose a team for them. I want to choose Counter-Terrorists, Terrorists or Spectate. The commands to do that did i say in other post...

Quote:
Originally Posted by XunTric
Terror:
Code:
cs_set_user_team(player, CS_TEAM_T, CS_T_TERROR)
CT:
Code:
cs_set_user_team(player, CS_TEAM_CT, CS_CT_SAS)
Spectate:
Code:
cs_set_user_team(player, CS_TEAM_SPECTATOR, CS_DONTCHANGE)
XunTric is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-21-2005 , 04:52  
Reply With Quote #9

...xeroblood????
XunTric is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 02-21-2005 , 10:19  
Reply With Quote #10

You will need a secondary menu for that... After choosing a player, you should open a second menu to display the choices of teams..

I will whip something together for ya later on, but you will be happier if you're able to figure it out yourself...

Either way, I'm kinda busy ATM, so I will throw something together later on...
xeroblood is offline
Send a message via MSN to xeroblood
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 08:27.


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