Raised This Month: $32 Target: $400
 8% 

Solved Players Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Theodore Bagwell
Member
Join Date: Jan 2021
Location: USA
Old 01-23-2021 , 14:40   Players Menu
Reply With Quote #1

Hi. I found this code that shows the players. Is it possible to write something in the menu in front of the name of each player?
Example:
Player Name [Health Number]
PHP Code:
public test(id)
{
    new 
menu menu_create ("\wPlayers:""Handler")
    
    new 
numplayers[32], tempidszTempID [10], tempname [32]
    
get_players (playersnum"a")
    
    for (new 
0numi++)
    {
        
tempid players ]
        
        
get_user_name(tempidtempname31)
        
num_to_str(tempidszTempID9)
        
menu_additem(menutempnameszTempID0)
    }
    
    
menu_display (idmenu)
    return 
PLUGIN_HANDLED


Last edited by Theodore Bagwell; 01-23-2021 at 16:16.
Theodore Bagwell is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-23-2021 , 14:54   Re: Players Menu
Reply With Quote #2

Of course.
"tempname" holds your player name, so simply modify it before using it in "menu_additem".

E.g.

Code:
format(tempname, charsmax(tempname), "%s [%i]", tempname, get_user_health(tempid))

You'll also want to increase the size of the "tempname" buffer since it can now store more than just the player's name.
__________________

Last edited by OciXCrom; 01-23-2021 at 14:54.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Theodore Bagwell
Member
Join Date: Jan 2021
Location: USA
Old 01-23-2021 , 15:20   Re: Players Menu
Reply With Quote #3

thank you sir.

Last edited by Theodore Bagwell; 01-23-2021 at 16:15.
Theodore Bagwell is offline
Reply



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 15:51.


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