Raised This Month: $ Target: $400
 0% 

[CODE] Players menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-09-2012 , 14:28   [CODE] Players menu
Reply With Quote #1

Here is a function i wrote to put a list of players into a certain menu. Its just to get you somewhere if you need to put a player list into your menu. The data it puts to each item is [source];[playerID]
You can pass "" as the source to this function if you don't need it. Separate your data by the ; delimiter in whatever manner you see fit.

@RETURN: amount of players in the list
@ PARAMETER:
p_menu: pointer to the menu in which to put the list
source[]: data to pass to the item signifying where the menu came from
itemAccess: Admin access to utilize this menu
getPlayersFlags[]: Flags to use in the getPlayers() function
@NOTE: feel free to remove the semicolon from the formatex statement if you don't use the source parameter.

PHP Code:
    /*   THIS FUNCTION AUTOMATICALLY SETS THE EXIT (creates a useable menu)
       p_menu is a pointer to the menu that we're going to add the players list to
       source[] is the source menu to keep track of what's going on internally
       itemAccess is the "access" paramater for menu_additem
       getPlayersFlags[] is a string of flags for the get_players command 
       RETURNS: number of players in the list */
mhlp_getPlayerMenu(&p_menusource[]="fal"itemAccess=0getPlayersFlags[]="ch")
{
    new 
players[32], playerplyrCnt
    
new sz_name[32], sz_info[8]
    
get_players(playersplyrCntgetPlayersFlags)
    
    for(new 
i=0i<plyrCnti++)
    {
        
player players[i]
        
get_user_name(playersz_namecharsmax(sz_name) )
        
formatex(sz_infocharsmax(sz_info), "%s;%d"sourceplayer)
        
menu_additem(p_menusz_namesz_infoitemAccess)
    }
    
    
menu_setprop(p_menuMPROP_EXITMEXIT_ALL)
    return 
plyrCnt

__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz 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 05:49.


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