AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Player Menu (https://forums.alliedmods.net/showthread.php?t=9488)

Ced 01-20-2005 17:47

Player Menu
 
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 }

f1del1ty.oXi 01-20-2005 17:51

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.

Ced 01-20-2005 21:58

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.

XxAvalanchexX 01-21-2005 15:49

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

Ced 01-21-2005 20:01

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 01-21-2005 23:49

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?

XxAvalanchexX 01-21-2005 23:53

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"

Ced 01-22-2005 00:25

ya, i have searched already. Cant find anything relating to it.


All times are GMT -4. The time now is 19:28.

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