Raised This Month: $ Target: $400
 0% 

Player Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ced
Member
Join Date: Oct 2004
Old 01-20-2005 , 17:47   Player Menu
Reply With Quote #1

Can anyone help me with making and how the player showing menu's work. Like the kick menu amxx comes with. Just the ones that show all the names of players in your server at the time. I have already looked at the code for them, but i don't understand the multilingual parts and some other things.

For all you people that don't want to find it, here is just the kick menu

Code:
/* Kick */ public actionKickMenu(id,key) {   switch (key) {     case 8: displayKickMenu(id,++g_menuPosition[id])     case 9: displayKickMenu(id,--g_menuPosition[id])     default: {       new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]       new authid[32],authid2[32], name[32], name2[32]       get_user_authid(id,authid,31)       get_user_authid(player,authid2,31)       get_user_name(id,name,31)       get_user_name(player,name2,31)             new userid2 = get_user_userid(player)       log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"",           name,get_user_userid(id),authid, name2,userid2,authid2 )       switch (get_cvar_num("amx_show_activity")) {         case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_KICK_2",name,name2)         case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_KICK_1",name2)       }       server_cmd("kick #%d",userid2)       server_exec()                   displayKickMenu(id,g_menuPosition[id])     }   }   return PLUGIN_HANDLED } displayKickMenu(id,pos) {   if (pos < 0)  return   get_players(g_menuPlayers[id],g_menuPlayersNum[id])   new menuBody[512]   new b = 0   new i   new name[32]   new start = pos * 8   if (start >= g_menuPlayersNum[id])     start = pos = g_menuPosition[id] = 0   new len = format(menuBody,511, g_coloredMenus ?     "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",     id,"KICK_MENU",pos+1,(  g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0 )) )   new end = start + 8   new keys = MENU_KEY_0   if (end > g_menuPlayersNum[id])     end = g_menuPlayersNum[id]   for (new a = start; a < end; ++a) {     i = g_menuPlayers[id][a]     get_user_name(i,name,31)         if ( access(i,ADMIN_IMMUNITY) ) {       ++b         if ( g_coloredMenus )         len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)       else         len += format(menuBody[len],511-len,"#. %s^n",name)     }     else {       keys |= (1<<b)       len += format(menuBody[len],511-len,"%d. %s^n",++b,name)     }   }   if (end != g_menuPlayersNum[id]) {     format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")     keys |= MENU_KEY_9   }   else  format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")   show_menu(id,keys,menuBody,-1,"Kick Menu") } public cmdKickMenu(id,level,cid) {   if (cmd_access(id,level,cid,1))     displayKickMenu(id,g_menuPosition[id] = 0)   return PLUGIN_HANDLED }
Ced is offline
f1del1ty.oXi
Veteran Member
Join Date: Nov 2004
Old 01-20-2005 , 17:51  
Reply With Quote #2

Your asking for the code to get the players in your server?

You could look in the include files, but you may not like that, because, well, no one ever does. =\

If that's the case, I'd think it's:

Code:
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
From amxmisc.inc

/* Returns number of players put in server.
* If flag is set then also connecting are counted. */
native get_playersnum(flag=0);

/* Sets indexes of players.
* Flags:
* "a" - don't collect dead players.
* "b" - don't collect alive players.
* "c" - skip bots.
* "d" - skip real players.
* "e" - match with team.
* "f" - match with part of name.
* "g" - ignore case sensitivity.
* Example: Get all alive CTs: get_players(players,num,"ae","CT") */
native get_players(players[32], &num ,const flags[]="", const team[]="");

I think that's what you need.
__________________
f1del1ty.oXi is offline
Ced
Member
Join Date: Oct 2004
Old 01-20-2005 , 21:58  
Reply With Quote #3

No, i know how to do that. I dont really understand a lot of the extra stuff in the menu above. I want to make a menu that shows all players and can do commands to them. Like the amx_kickmenu. I do not know what is part of the multilanguage part of the menu either. All I need help with is the displaying part really, I understand the other parts.
Ced is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-21-2005 , 15:49  
Reply With Quote #4

I learned it from the AMX(not x) scripting forums when I first started:

http://djeyl.net/forum/index.php?showtopic=27288

You could also check out what the website has to say about the functions associated with the menus:

http://www.amxmodx.org/funcwiki.php?go=inc&id=1
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Ced
Member
Join Date: Oct 2004
Old 01-21-2005 , 20:01  
Reply With Quote #5

I already know the functions and how to make a regular menu, but like when you use the %L or the color part, I am confused a little. I would like to make a normal menu that shows all the players in the server and when pressing the button corresponding to their name, a command would be done to them. So basically the kick menu but without multilinguall stuff and colored menu's. I already copied it and made a menu but it doesn't seem to work and it says ML_not found or something next to the title. I found out that means you r missing part of the dictionary.
Ced is offline
Ced
Member
Join Date: Oct 2004
Old 01-21-2005 , 23:49  
Reply With Quote #6

well, i got the menu working, but it still says the thing next to the title. If somebody doesn't want to explain something, can you just rewrite the display part of the menu in my first post, but with no multilingual or color stuff in it?
Ced is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-21-2005 , 23:53  
Reply With Quote #7

Search the forums for %L (if the search will accept % characters) to figure out how to use language files, although it might be somewhere on the website. There are a few colors, like \w (white) \y (yellow) \r (red), and probably others, but I've never tried. You would use them like: "\yYellow Part - \rRed Part"
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Ced
Member
Join Date: Oct 2004
Old 01-22-2005 , 00:25  
Reply With Quote #8

ya, i have searched already. Cant find anything relating to it.
Ced is offline
Reply


Thread Tools
Display Modes

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