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

[CS:GO] HUD colors - Solved


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 01-23-2015 , 18:31   [CS:GO] HUD colors - Solved
Reply With Quote #1

Ciao guys,

is there any way, how to color text in HUD (function PrintHintText() and UserMessage KeyHintText) ?
I mean, in native CS:GO messages are colors (like red Alert)...
I tried escapes \x01, \x02 etc. but it didn't work...

Does anyone please know, how to do that?
KissLick is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 01-23-2015 , 18:33   Re: [CS:GO] HUD colors
Reply With Quote #2

Jeez, I didn't see this topic Hint Text color O:-) Well, I am gonna try that tomorow.

Last edited by KissLick; 01-23-2015 at 18:34.
KissLick is offline
EngHell
Member
Join Date: Jul 2013
Location: Guatemala
Old 01-23-2015 , 19:17   Re: [CS:GO] HUD colors
Reply With Quote #3

Quote:
Originally Posted by KissLick View Post
Jeez, I didn't see this topic Hint Text color O:-) Well, I am gonna try that tomorow.
Give me a shot if it works as this:
PHP Code:
PrintHintText(attacker,"<span style='color:red;'>Damage</span> : %i",damage
I would like to try, but im working on something else, thanks ;D

Last edited by EngHell; 01-23-2015 at 19:18.
EngHell is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-23-2015 , 23:40   Re: [CS:GO] HUD colors
Reply With Quote #4

you could just used <font color="#ff0000"> </font>
which is sort of smaller.
Small parts of the hud supports basic html. You can also change the size and alignment.
Also the team names can be changed to support colors also:
http://cloud-2.steamusercontent.com/...917CBA996757E/

Last edited by Mitchell; 01-23-2015 at 23:42.
Mitchell is offline
buzzace
Member
Join Date: Feb 2011
Old 01-23-2015 , 23:59   Re: [CS:GO] HUD colors
Reply With Quote #5

Quote:
Originally Posted by Mitchell View Post
you could just used <font color="#ff0000"> </font>
which is sort of smaller.
Small parts of the hud supports basic html. You can also change the size and alignment.
Also the team names can be changed to support colors also:
http://cloud-2.steamusercontent.com/...917CBA996757E/
That would actually be not working. Instead of using "" simply use single quotes ''. So <font color='#FFFFFF'>hello</font>
buzzace is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 01-24-2015 , 11:08   Re: [CS:GO] HUD colors
Reply With Quote #6

So... I did some testing and HTML seems to be partialy working in PrintHintText() and UserMessage KeyHintText.

Some points I made:
  1. PrintHintText and KeyHintText seems to be working exactly the same way...
  2. CSS is not working...
  3. Only a few HTML tags are working (<font>, <b>, <i>, <u> and <br>)
  4. You can create new line with both <br> or \n
  5. HUD has only three lines (with default font size)
  6. Font
    1. Color could be set only via HEX RGB code and not names... I use this color mixer
    2. Default font size seems to be 20, but I am not sure about that...
    3. Smaller font means more lines
    4. Any custom font I tried to use with <font> gave me the same result
  7. And of course, you can combine tags...
Here is my test plugin I made:
PHP Code:
#include <sourcemod>

public Plugin:myinfo =
{
    
name "CSGO_ColorHudTest",
    
author "Raska",
    
description "",
    
version "0.1",
    
url ""
}

public 
OnClientSayCommand_Post(iClient, const String:sCommand[], const String:sArgs[])
{
    if (
StrEqual(sArgs"!1")) {
        
PrintHintText(iClient,"normal <font color='#ff0000'>red</font> normal <font color='#006699'>color #006699</font> normal");
    } else if (
StrEqual(sArgs"!2")) {
        
PrintHintText(iClient,"normal <font size='30'>size 30</font> normal");
    } else if (
StrEqual(sArgs"!3")) {
        
PrintHintText(iClient,"normal <font face='Arial'>custom font</font> normal");
    } else if (
StrEqual(sArgs"!4")) {
        
PrintHintText(iClient,"normal <b>bold</b> normal");
    } else if (
StrEqual(sArgs"!5")) {
        
PrintHintText(iClient,"normal <i>italica</i> normal");
    } else if (
StrEqual(sArgs"!6")) {
        
PrintHintText(iClient,"normal <u>underline</u> normal");
    } else if (
StrEqual(sArgs"!7")) {
        
PrintHintText(iClient,"line1\nline2<br/>line3");
    } else if (
StrEqual(sArgs"!8")) {
        
PrintHintText(iClient,"<font color='#006699'><b><u>PLAYER INFO</u></b></font>\n<font color='#990033'>PlayerName:</font> %N\n<font color='#666699'>PlayerUserID:</font> #%d"iClientGetClientUserId(iClient));
    } else if (
StrEqual(sArgs"!9")) {
        
PrintHintText(iClient,"<font size='10'>line1\nline2\nline3\nline4\nline5\nline6</font>");
    }
}

stock bool:PrintKeyHintText(client, const String:format[], any:...)
{
    new 
Handle:userMessage StartMessageOne("KeyHintText"client);
    if (
userMessage == INVALID_HANDLE) {
        return 
false;
    }

    
decl String:buffer[1024];
    
SetGlobalTransTarget(client);
    
VFormat(buffersizeof(buffer), format3);
    
    if (
GetUserMessageType() == UM_Protobuf)
    {
        
PbAddString(userMessage"hints"buffer);
    }
    else
    {
        
BfWriteByte(userMessage1);
        
BfWriteString(userMessagebuffer);
    }
    
    
EndMessage();
    return 
true;

And some images:
!1 !2 !3 !4 !5 !6 !7 !8 !9
KissLick is offline
EngHell
Member
Join Date: Jul 2013
Location: Guatemala
Old 01-24-2015 , 12:23   Re: [CS:GO] HUD colors
Reply With Quote #7

Quote:
Originally Posted by KissLick View Post
So... I did some testing and HTML seems to be partialy working in PrintHintText() and UserMessage KeyHintText.

Some points I made:
  1. PrintHintText and KeyHintText seems to be working exactly the same way...
  2. CSS is not working...
  3. Only a few HTML tags are working (<font>, <b>, <i>, <u> and <br>)
  4. You can create new line with both <br> or \n
  5. HUD has only three lines (with default font size)
  6. Font
    1. Color could be set only via HEX RGB code and not names... I use this color mixer
    2. Default font size seems to be 20, but I am not sure about that...
    3. Smaller font means more lines
    4. Any custom font I tried to use with <font> gave me the same result
  7. And of course, you can combine tags...
Here is my test plugin I made:
PHP Code:
#include <sourcemod>

public Plugin:myinfo =
{
    
name "CSGO_ColorHudTest",
    
author "Raska",
    
description "",
    
version "0.1",
    
url ""
}

public 
OnClientSayCommand_Post(iClient, const String:sCommand[], const String:sArgs[])
{
    if (
StrEqual(sArgs"!1")) {
        
PrintHintText(iClient,"normal <font color='#ff0000'>red</font> normal <font color='#006699'>color #006699</font> normal");
    } else if (
StrEqual(sArgs"!2")) {
        
PrintHintText(iClient,"normal <font size='30'>size 30</font> normal");
    } else if (
StrEqual(sArgs"!3")) {
        
PrintHintText(iClient,"normal <font face='Arial'>custom font</font> normal");
    } else if (
StrEqual(sArgs"!4")) {
        
PrintHintText(iClient,"normal <b>bold</b> normal");
    } else if (
StrEqual(sArgs"!5")) {
        
PrintHintText(iClient,"normal <i>italica</i> normal");
    } else if (
StrEqual(sArgs"!6")) {
        
PrintHintText(iClient,"normal <u>underline</u> normal");
    } else if (
StrEqual(sArgs"!7")) {
        
PrintHintText(iClient,"line1\nline2<br/>line3");
    } else if (
StrEqual(sArgs"!8")) {
        
PrintHintText(iClient,"<font color='#006699'><b><u>PLAYER INFO</u></b></font>\n<font color='#990033'>PlayerName:</font> %N\n<font color='#666699'>PlayerUserID:</font> #%d"iClientGetClientUserId(iClient));
    } else if (
StrEqual(sArgs"!9")) {
        
PrintHintText(iClient,"<font size='10'>line1\nline2\nline3\nline4\nline5\nline6</font>");
    }
}

stock bool:PrintKeyHintText(client, const String:format[], any:...)
{
    new 
Handle:userMessage StartMessageOne("KeyHintText"client);
    if (
userMessage == INVALID_HANDLE) {
        return 
false;
    }

    
decl String:buffer[1024];
    
SetGlobalTransTarget(client);
    
VFormat(buffersizeof(buffer), format3);
    
    if (
GetUserMessageType() == UM_Protobuf)
    {
        
PbAddString(userMessage"hints"buffer);
    }
    else
    {
        
BfWriteByte(userMessage1);
        
BfWriteString(userMessagebuffer);
    }
    
    
EndMessage();
    return 
true;

And some images:
!1 !2 !3 !4 !5 !6 !7 !8 !9
I was having this doubt about the hint text, cause I researched and there is not much info about it, I think we should start to update the wiki with some new info ;D
EngHell is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 01-24-2015 , 12:31   Re: [CS:GO] HUD colors
Reply With Quote #8

Quote:
Originally Posted by EngHell View Post
I think we should start to update the wiki with some new info ;D
Totally! :-D For example: removing weapon in event weapon_fire will crash the server or editing player score in event player_death wouldn't work... Both must be at least one frame delayed.

P.S.: In CS:GO

Last edited by KissLick; 01-24-2015 at 12:32.
KissLick is offline
EngHell
Member
Join Date: Jul 2013
Location: Guatemala
Old 01-24-2015 , 21:31   Re: [CS:GO] HUD colors
Reply With Quote #9

Quote:
Originally Posted by KissLick View Post
Totally! :-D For example: removing weapon in event weapon_fire will crash the server or editing player score in event player_death wouldn't work... Both must be at least one frame delayed.

P.S.: In CS:GO
I'm going to update and make some new articles on the wiki, but i think as much of us, we don't cause we think we are going to get something like "you are too newbie to update this and this" from the sourcemods developers but anyways the wiki mode is always open to new ones who want to contribute, then i think there is not problem about it, and if i ask, may there is any one who can confirm we can modify and update it? it will make learn sourcepawn easier faster and better with more resources ;D

Edit:
For example check this page of the wiki https://wiki.alliedmods.net/index.ph...&days=30&from= and tell me if is it not bad a wiki looks like it, now watch this live and healty wiki http://terraria.wikia.com/wiki/Special:WikiActivity , do you got it? we have to put hands on to update it ;D

Last edited by EngHell; 01-24-2015 at 21:46.
EngHell is offline
lingzhidiyu
Senior Member
Join Date: Mar 2014
Old 01-25-2015 , 01:44   Re: [CS:GO] HUD colors - Solved
Reply With Quote #10

the hinttext only can show 4 colors,how can i show more colors?
lingzhidiyu is offline
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 03:39.


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