View Single Post
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