Raised This Month: $ Target: $400
 0% 

Using connected players menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-28-2011 , 16:47   Re: Using connected players menu
Reply With Quote #2

I'm using this when i have to make a player menu :

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(PLUGINVERSION"ConnorMcLeod")
    
register_clcmd("say /players""ClCmd_Menu"ADMIN_RCON)
}

public 
ClCmd_Menu(idlvlcid)
{
    if( 
cmd_access(idlvlcid0) )
    {
        return 
PLUGIN_HANDLED
    
}

    new 
bool:bIsSuperAdmin = !!(get_user_flags(id) & ADMIN_RCON)
    new 
iPlayers[32], iNumiPlayerszPlayerName[32], szAuthid[32]
    
get_players(iPlayersiNum)
    new 
iMenu menu_create("Players Menu Misc""PlayersMenuHandler")
    
menu_setprop(iMenuMPROP_NUMBER_COLOR"\y")
    for(new 
ii<iNumi++)
    {
        
iPlayer iPlayers[i]
        if( !
bIsSuperAdmin && get_user_flags(iPlayer) & ADMIN_IMMUNITY )
        {
            
menu_addtext(iMenuszPlayerName)
        }
        else
        {
            
get_user_name(iPlayerszPlayerNamecharsmax(szPlayerName))
            
get_user_authid(iPlayerszAuthidcharsmax(szAuthid))
            
menu_additem(iMenuszPlayerNameszAuthid0)
        }
    }
    
menu_display(idiMenu)
    return 
PLUGIN_HANDLED
}

public 
PlayersMenuHandler(idiMenuiItem)
{
    if( 
iItem )
    {
        
menu_destroy(iMenu)
        return 
PLUGIN_HANDLED
    
}

    new 
szAuthid[32], szPlayerName[32], iCRAP
    menu_item_getinfo
(iMenuiItemiCRAPszAuthidcharsmax(szAuthid), szPlayerNamecharsmax(szPlayerName), iCRAP)
    new 
iPlayer find_player("c"szAuthid)

    if( 
iPlayer )
    {
        new 
szName[32]
        
get_user_name(iPlayerszNamecharsmax(szName))
        
client_print(idprint_chat"You have chosen %s %s %s"szAuthidszPlayerNameszName)
    }
    else
    {
        
client_print(idprint_chat"Player %s<%s> seems to be disconnected"szPlayerNameszAuthid)
    }
    
menu_destroy(iMenu)
    return 
PLUGIN_HANDLED

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
 



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:39.


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