Raised This Month: $ Target: $400
 0% 

Generating Player Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TotalNoobScripter
Senior Member
Join Date: Aug 2004
Old 03-11-2005 , 21:58   Generating Player Menu
Reply With Quote #1

can someone please post a function(s) that will create a menu, with the options as player names; with a next page option if there are too many names to be displayed? I tried, but i just keep getting errors upon errors, do i got mad and deleted it.
TotalNoobScripter is offline
Send a message via AIM to TotalNoobScripter
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-12-2005 , 11:33  
Reply With Quote #2

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_MENU, "- Shows The Player Menu" ) } public ShowMenu( id, lvl, cid ) {     if( cmd_access( id, lvl, cid, 0 ) )         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 )         }     }     return PLUGIN_HANDLED }
xeroblood is offline
Send a message via MSN to xeroblood
xmcxasgx
Junior Member
Join Date: Feb 2005
Old 04-08-2005 , 18:29  
Reply With Quote #3

since u saved mine ill save urs.

ok what uv done is pressed enter twice and made a part of a command two lines down by accident i presume.

Code:
    new iLen = format( szMenuBody, MENU_SIZE-1, "Rate Checker:^n^n", pos+1, (iNum / MENU_PLAYERS + ((iNum % MENU_PLAYERS) ? 1 : 0 )) )


should be that

where u have done

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


thank you m8 u have hel;ped me. I have tested it out with that change i have told you and works 100%
xmcxasgx is offline
xmcxasgx
Junior Member
Join Date: Feb 2005
Old 04-08-2005 , 19:03  
Reply With Quote #4

ok that didnt help. ok all u need to do is check if it on the same line.
xmcxasgx is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-14-2005 , 00:29  
Reply With Quote #5

Xero, do you mind if I use this as a template for my player-based menus?
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
nightscreem
Veteran Member
Join Date: Jul 2004
Location: Belgium
Old 04-14-2005 , 10:42  
Reply With Quote #6

sry to post here
but what is the best way to open a menu
the thing I used in hookmenu or this one
__________________
- Bye bye!
nightscreem is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 04-14-2005 , 13:11  
Reply With Quote #7

There are much simpler ways to do it xeroblood.
That method is so very convoluted...
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-14-2005 , 14:55  
Reply With Quote #8

Quote:
Originally Posted by Twilight Suzuka
There are much simpler ways to do it xeroblood.
That method is so very convoluted...
I was wondering if there was an easier way.. Could you show an example?
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
slurpycof
Senior Member
Join Date: Nov 2004
Old 04-14-2005 , 14:57  
Reply With Quote #9

Quote:
Originally Posted by v3x
I was wondering if there was an easier way.. Could you show an example?
I would like to see one also please.
slurpycof is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-14-2005 , 16:48  
Reply With Quote #10

Quote:
Originally Posted by Twilight Suzuka
There are much simpler ways to do it xeroblood.
That method is so very convoluted...
Seriously, Suzuka, if you're going to tell us all there is a different method that we should/can use, then post it for damned sake. Next time you do this just don't post at all and let us go on using this method without wonder of what the other one is.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
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:10.


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