Raised This Month: $12 Target: $400
 3% 

team player names


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 01-14-2020 , 05:56   team player names
Reply With Quote #1

I want a plugin which shows specific team players in constant dhud.
Ex: CT Team Players

CT Team [%d]
Player1
Player2
Player3
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
Old 01-14-2020, 09:01
Napoleon_be
This message has been deleted by Napoleon_be.
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-14-2020 , 10:30   Re: team player names
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "ShowPlayersHud"
#define VERSION "1.1"
#define AUTHOR "NapoleoN#"

#define TASK_REPEAT 45780

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_putinserver(id)
{
        
set_task(2.0"ShowAlivePlayers"id+TASK_REPEAT__"b")
}

public 
ShowAlivePlayers(id
{
    
id -= TASK_REPEAT;
    new 
ctPlayers[32], ctNumszName[33], szHudNames[200];
    
get_players(ctPlayersctNum"e""CT");
    
    for(new 
ictNumi++)
    {
        
get_user_name(ctPlayers[i], szNamecharsmax(szName));
        
formatex(szHudNamescharsmax(szHudNames), "%s^n"szName[i]);
        
    }
    
    new 
tPlayers[32], tNum;
    
get_players(tPlayerstNum"e""TERRORIST");
        
    for(new 
itNumi++)
    {
        
get_user_name(tPlayers[i], szNamecharsmax(szName));
        
formatex(szHudNamescharsmax(szHudNames), "%s^n"szName[i]);
        
    }
    
    if(
get_user_team(id) == 2)
    {
        
set_hudmessage(002550.020.1502.01.10.00.0, -1);
        
show_hudmessage(id"[CT]: %i^n%s"ctNumszHudNames);
    }
    
    else if(
get_user_team(id) == 1)
    {
        
set_hudmessage(255000.020.1502.01.10.00.0, -1);
        
show_hudmessage(id"[TS]: %i^n%s"tNumszHudNames);
    }
}

public 
client_disconncet(idremove_task(TASK_REPEAT+id); 
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-14-2020 at 10:32.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-14-2020 , 09:07   Re: team player names
Reply With Quote #4

That will show 32 messages on top of each other at once on a full server. You don't put the actual hud message functions in the loop.
__________________

Last edited by OciXCrom; 01-14-2020 at 09:07.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-14-2020 , 09:19   Re: team player names
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
That will show 32 messages on top of each other at once on a full server. You don't put the actual hud message functions in the loop.
Can i fix this by setting a task in client_putinserver and use "id" to send the tasks to? something like this? Tested it again and seemed to work though. Updated code above
__________________

Last edited by Napoleon_be; 01-14-2020 at 09:37.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-14-2020 , 12:06   Re: team player names
Reply With Quote #6

Thanks Natsheh

EDIT: i tested it and the hudmessage disappears and appears again every time. Let's say it flashes lol

Second EDIT: Never mind, fixed it. Had to set float:seconds to 1.0 instead of 2.0 since my hudmessage holds for 1.1 seconds

Updated code can be found above. I have posted both with normal hudmessages and with dhudmessages. I would really not suggest to use the dhudmessage one since the font size is pretty big (no idea if this can get adjusted).

Third EDIT: Tested the plugin with someone and it appears it doesn't work as it should, will keep you guys uptodate
__________________

Last edited by Napoleon_be; 01-14-2020 at 13:14.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-14-2020 , 13:15   Re: team player names
Reply With Quote #7

Okay, so i've recoded some of the previous code and optimized it a bit. Hope it works now. My previous codes will be deleted as they don't work as intented.

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "ShowPlayersHud"
#define VERSION "1.1"
#define AUTHOR "NapoleoN#"

#define TASK_REPEAT 45780

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_putinserver(id)
{
    
set_task(1.0"ShowPlayers"id+TASK_REPEAT__"b");
}

public 
ShowPlayers(id
{
    
id -= TASK_REPEAT;
    new 
iPlayers[32], iNumszName[33], szHudNames[200], szHudNamesLen 0;
    
get_players(iPlayersiNum"e", (get_user_team(id) == 1) ? "TERRORIST" "CT");
    
    for(new 
iiNumi++)
    {
        
get_user_name(iPlayers[i], szNamecharsmax(szName));
        
szHudNamesLen += formatex(szHudNames[szHudNamesLen], (charsmax(szHudNames) - szHudNamesLen), "%s^n"szName);
        
    }
    
    if(
get_user_team(id) == 2)
    {
        
set_hudmessage(002550.020.1502.01.10.00.0, -1);
        
show_hudmessage(id"[CT]: %i^n%s"iNumszHudNames);
    }
    
    else if(
get_user_team(id) == 1)
    {
        
set_hudmessage(255000.020.1502.01.10.00.0, -1);
        
show_hudmessage(id"[TS]: %i^n%s"iNumszHudNames);
    }
}

public 
client_disconnected(id
{
    
remove_task(TASK_REPEAT+id); 

__________________

Last edited by Napoleon_be; 01-16-2020 at 11:24.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 01-14-2020 , 13:54   Re: team player names
Reply With Quote #8

Or Maybe

PHP Code:
#include <amxmodx>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Bruno"

#define TASK_HUD    1000

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
}

public 
client_putinserver(id)
{
    
set_task(0.5"HudList"TASK_HUD, .flags "b")
}

public 
HudList()
{
    if(
get_playersnum() < 1)
    {
        
remove_task(TASK_HUD)
        return 
1
    
}
        
    new 
iPlayersCT[32], iPlayersTR[32], iNumCTiNumTRid, List[2][512], szName[33][32]
    
get_players(iPlayersCTiNumCT"e""CT")        
    
get_players(iPlayersTRiNumTR"e""TERRORIST")
    
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum)
    for(new 
iiNumi++)
    {
        
id iPlayers[i]
        
        
get_user_name(idszName[id], charsmax(szName[]))
        
        if(
get_user_team(id) == 2)
        {    
            
formatex(List[0], charsmax(List[]), "%s%s^n",List[0], szName[id])
        }
        else if(
get_user_team(id) == 1)
        {
            
formatex(List[1], charsmax(List[]), "%s%s^n",List[1], szName[id])
        }
    }
    
    
set_hudmessage(2552552550.00.1, .effects 0, .fxtime 0.1, .holdtime 0.5, .fadeintime 0.1, .fadeouttime 0.2, .channel = -1)
    
show_hudmessage(0,"TR's (%i)"iNumCT)

    
set_hudmessage(2552552550.00.5, .effects 0, .fxtime 0.1, .holdtime 0.5, .fadeintime 0.1, .fadeouttime 0.2, .channel = -1)
    
show_hudmessage(0,"CT's (%i)"iNumTR)

    
set_hudmessage(025500.750.51, .effects 0, .fxtime 0.1, .holdtime 0.5, .fadeintime 0.1, .fadeouttime 0.2, .channel = -1)
    
show_hudmessage(0,"^n%s",List[0])

    
set_hudmessage(255000.750.11, .effects 0, .fxtime 0.1, .holdtime 0.5, .fadeintime 0.1, .fadeouttime 0.2, .channel = -1)
    
show_hudmessage(0,"^n%s",List[1])
    
    return 
0

__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 01-14-2020 at 13:57.
iceeedr is offline
Send a message via Skype™ to iceeedr
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-17-2020 , 07:39   Re: team player names
Reply With Quote #9

For people who are still interested, i've optimized my code a bit.

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "ShowPlayersHud"
#define VERSION "1.1"
#define AUTHOR "NapoleoN#"

#define TASK_REPEAT 45780

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_putinserver(id)
{
    
set_task(1.0"ShowPlayers"id+TASK_REPEAT__"b");
}

public 
ShowPlayers(id
{
    
id -= TASK_REPEAT;
    new 
iPlayers[32], iNumszName[33], szHudNames[200], szHudNamesLen 0;
    
get_players(iPlayersiNum"e", (get_user_team(id) == 1) ? "TERRORIST" "CT");
    
    for(new 
iiNumi++)
    {
        
get_user_name(iPlayers[i], szNamecharsmax(szName));
        
szHudNamesLen += formatex(szHudNames[szHudNamesLen], (charsmax(szHudNames) - szHudNamesLen), "%s^n"szName);
        
    }
    
    
set_hudmessage(2552552550.020.1502.01.10.00.0, -1);
    
    switch(
get_user_team(id))
    {
        case 
1show_hudmessage(id"[TS]: %i^n%s"iNumszHudNames);
        case 
2show_hudmessage(id"[CT]: %i^n%s"iNumszHudNames);
        default: return;
    }
}

public 
client_disconnected(id
{
    
remove_task(TASK_REPEAT+id); 

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Reply


Thread Tools
Display Modes

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 08:40.


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