PHP Code:
/* Formatright © 2010, ConnorMcLeod
This plugin is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this plugin; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <amxmodx>
#include <amxmisc>
#define VERSION "0.0.1"
#define PLUGIN "Players Menu Generic"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, "ConnorMcLeod")
register_clcmd("say /players", "ClCmd_Menu", ADMIN_RCON)
}
public ClCmd_Menu(id, lvl, cid)
{
if( cmd_access(id, lvl, cid, 0) )
{
return PLUGIN_HANDLED
}
new bool:bIsSuperAdmin = !!(get_user_flags(id) & ADMIN_RCON)
new iPlayers[32], iNum, iPlayer, szPlayerName[32], szAuthid[32]
get_players(iPlayers, iNum)
new iMenu = menu_create("Players Menu Misc", "PlayersMenuHandler")
menu_setprop(iMenu, MPROP_NUMBER_COLOR, "\y")
for(new i; i<iNum; i++)
{
iPlayer = iPlayers[i]
if( !bIsSuperAdmin && get_user_flags(iPlayer) & ADMIN_IMMUNITY )
{
menu_addtext(iMenu, szPlayerName)
}
else
{
get_user_name(iPlayer, szPlayerName, charsmax(szPlayerName))
get_user_authid(iPlayer, szAuthid, charsmax(szAuthid))
menu_additem(iMenu, szPlayerName, szAuthid, 0)
}
}
menu_display(id, iMenu)
return PLUGIN_HANDLED
}
public PlayersMenuHandler(id, iMenu, iItem)
{
if( iItem < 0 )
{
menu_destroy(iMenu)
return PLUGIN_HANDLED
}
new szAuthid[32], szPlayerName[32], iCRAP
menu_item_getinfo(iMenu, iItem, iCRAP, szAuthid, charsmax(szAuthid), szPlayerName, charsmax(szPlayerName), iCRAP)
new iPlayer = find_player("c", szAuthid)
if( iPlayer )
{
new szName[32]
get_user_name(iPlayer, szName, charsmax(szName))
client_print(id, print_chat, "You have chosen %s %s %s", szAuthid, szPlayerName, szName)
}
else
{
client_print(id, print_chat, "Player %s<%s> seems to be disconnected", szPlayerName, szAuthid)
}
menu_destroy(iMenu)
return PLUGIN_HANDLED
}