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

ShowHudText Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Skippy
Senior Member
Join Date: Nov 2011
Old 02-18-2013 , 03:30   ShowHudText Help
Reply With Quote #1

I'm trying to get everyone's name in the server to show in the show hud text but it keep showing all of the names in one place. Here is the coding.

PHP Code:
public Action:Command_Huds(clientargs)
{
    
decl String:Buffer[MAX_NAME_LENGTH];
    for(new 
1<= MaxClientsi++)
    {    
        
Format(Buffersizeof(Buffer), "\n%N\n"i);
    
        
SetHudTextParams(0.010.013.0025551240);
        
ShowHudText(client, -1Buffer);
    }    
    return 
Plugin_Handled;

But then if I do this, it works fine.

PHP Code:
public Action:Command_Huds(clientargs)
{
    
SetHudTextParams(0.010.013.0025551240);
    
ShowHudText(client, -1"Hey\nHey2\nHey3\nHey4\nHey5\nHey6);
    
    return Plugin_Handled;

__________________
Plugins:
[Any] Aim Menu

Want a TF2 plugin? Feel free to pm me to discuss it.
Skippy is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 02-18-2013 , 03:35   Re: ShowHudText Help
Reply With Quote #2

PHP Code:
public Action:Command_Huds(clientargs)
{
    new 
String:Buffer[2146];
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i)) {
            
Format(Buffersizeof(Buffer), "%s%N\n"Bufferi);
        }
    }

    
SetHudTextParams(0.010.013.0025551240);
    
ShowHudText(client, -1Buffer);

    return 
Plugin_Handled;


Last edited by bl4nk; 02-18-2013 at 03:36. Reason: missing brace
bl4nk is offline
Skippy
Senior Member
Join Date: Nov 2011
Old 02-18-2013 , 03:47   Re: ShowHudText Help
Reply With Quote #3

Quote:
Originally Posted by bl4nk View Post
PHP Code:
public Action:Command_Huds(clientargs)
{
    new 
String:Buffer[2146];
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i)) {
            
Format(Buffersizeof(Buffer), "%s%N\n"Bufferi);
        }
    }

    
SetHudTextParams(0.010.013.0025551240);
    
ShowHudText(client, -1Buffer);

    return 
Plugin_Handled;

Thanks!!!!

Also if I set the timer of the hud to be infinite how can I get it to auto update as people join so they show up on the list?
__________________
Plugins:
[Any] Aim Menu

Want a TF2 plugin? Feel free to pm me to discuss it.

Last edited by Skippy; 02-18-2013 at 04:11. Reason: Question
Skippy is offline
Skippy
Senior Member
Join Date: Nov 2011
Old 02-18-2013 , 14:09   Re: ShowHudText Help
Reply With Quote #4

Okay so in my code it keeps repeating the Buffer format. Like when the timer is called again it shows names twice. Is there a way to clear the format of buffer and then have it set again.

Format(Buffer, sizeof(Buffer), " "); ????

This is part of the code that calls the hud.

PHP Code:
new String:Buffer[2146];

public 
Action:Timer(Handle:timer)
{                                                        
    
CreateTimer(0.1Timer_Check);
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i)) 
        {            
            if(
counter[i]>=0)
            {
                
Format(Buffersizeof(Buffer), "%s%N: %d\n"Buffericounter[i]);
            }    
            if (
hasHud[i])
            {        
                
SetHudTextParams(0.010.013.0025551240);
                
ShowHudText(i, -1Buffer);
            }
        }
    }

The code just has three timers repeating until I insert a command to stop them.
__________________
Plugins:
[Any] Aim Menu

Want a TF2 plugin? Feel free to pm me to discuss it.
Skippy is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 02-18-2013 , 14:31   Re: ShowHudText Help
Reply With Quote #5

Quote:
Originally Posted by Skippy View Post
Okay so in my code it keeps repeating the Buffer format. Like when the timer is called again it shows names twice. Is there a way to clear the format of buffer and then have it set again.

At the top of Command_Huds(), clear the string by using:
Code:
Buffer[0] = '\0';
Alternatively, if you're not going to use Buffer in any other functions, then you don't need it to be global and can just move the variable declaration inside of Command_Huds() which will obviously be empty each time the function is run.
__________________
11530 is offline
Skippy
Senior Member
Join Date: Nov 2011
Old 02-18-2013 , 14:43   Re: ShowHudText Help
Reply With Quote #6

Fixed

Used Buffer[0] = '\0'; at the end of the function
__________________
Plugins:
[Any] Aim Menu

Want a TF2 plugin? Feel free to pm me to discuss it.

Last edited by Skippy; 02-18-2013 at 21:21. Reason: Fixed
Skippy is offline
Skippy
Senior Member
Join Date: Nov 2011
Old 02-18-2013 , 21:20   Re: ShowHudText Help
Reply With Quote #7

I'm having a problem with it now showing the whole server. The most I was able to get was twelve names. It won't show all of them. This is the coding.

PHP Code:
#pragma semicolon 1

#include <sourcemod>

new Handle:huddy;

public 
OnPluginStart()
{
    
RegConsoleCmd("sm_huddy"Command_Huddy);

    
huddy CreateHudSynchronizer();
}

public 
Action:Command_Huddy(clientargs)
{
    new 
String:Bufferr[2146];
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i)) 
        {            
            
Format(Bufferrsizeof(Bufferr), "%s%N\n"Bufferri);        
        }
    }
    
SetHudTextParams(0.010.0113.0025551240);
    
ShowSyncHudText(clienthuddyBufferr);
    return 
Plugin_Handled;

__________________
Plugins:
[Any] Aim Menu

Want a TF2 plugin? Feel free to pm me to discuss it.
Skippy is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 02-18-2013 , 21:21   Re: ShowHudText Help
Reply With Quote #8

PHP Code:
    Buffer[0] = '\0';
    new 
bool:bFirst true;
    for (new 
1<= MaxClientsi++) 
    { 
        if (
IsClientInGame(i))  
        {             
            if(
counter[i]>=0
            { 
                if (
bFirst) {
                    
Format(Buffersizeof(Buffer), "%N: %d\n"icounter[i]);
                    
bFirst false;
                } else {
                    
Format(Buffersizeof(Buffer), "%s%N: %d\n"Buffericounter[i]); 
                }
            }     
            if (
hasHud[i]) 
            {         
                
SetHudTextParams(0.010.013.0025551240); 
                
ShowHudText(i, -1Buffer); 
            } 
        } 
    } 
[edit]

Quote:
Originally Posted by Skippy View Post
I'm having a problem with it now showing the whole server. The most I was able to get was twelve names. It won't show all of them.
You might be reaching the max limit of characters allowed. I'm not sure exactly what that is.

Last edited by bl4nk; 02-18-2013 at 21:23.
bl4nk is offline
Skippy
Senior Member
Join Date: Nov 2011
Old 02-18-2013 , 21:33   Re: ShowHudText Help
Reply With Quote #9

It looks like 13 is the limit. Do you know if ShowHudText or ShowSyncHudText has more of a limit
__________________
Plugins:
[Any] Aim Menu

Want a TF2 plugin? Feel free to pm me to discuss it.
Skippy is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 02-19-2013 , 07:50   Re: ShowHudText Help
Reply With Quote #10

I'm pretty sure their limits are the same since they both just display Hud Text.
bl4nk 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 22:12.


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