AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [CSGO] New HTML Font supported hud element (https://forums.alliedmods.net/showthread.php?t=326935)

backwards 08-24-2020 05:51

[CSGO] New HTML Font supported hud element
 
Hello, while searching for a new hud element to display text to clients in csgo I found this

https://i.imgur.com/HVgh7DW.png

It's supports HTML Font flags as well and is part of the round end cs panel. Here's a snippet on how it works.

PHP Code:

Event newevent_message CreateEvent("cs_win_panel_round");
newevent_message.SetString("funfact_token""message here");

for(
int z 1<= MaxClientsz++)
  if(
IsClientInGame(z) && !IsFakeClient(z))
    
newevent_message.FireToClient(z);
                                
newevent_message.Cancel(); 

Sadly it has drawbacks of not rendering for 1 second when you send the message. So if you want to constantly update the text like surf\bhop timer, it will be invisible or delayed. Thought I would share this with the community.

Edit:
since people are sending me private messages about this, the way to clear the text is to send a fake round_start event to all clients (this will clear blood decals and particle effects)

PHP Code:

Event newevent_round CreateEvent("round_start");

    for(
int z 1<= MaxClientsz++)
      if(
IsClientInGame(z) && !IsFakeClient(z))
        
newevent_round.FireToClient(z);

    
newevent_round.Cancel(); 


Kubad 08-24-2020 07:26

Re: [CSGO] New HTML Font supported hud element
 
but you cant edit size but seems good

Russian85 08-24-2020 10:53

Re: [CSGO] New HTML Font supported hud element
 
Quote:

Originally Posted by backwards (Post 2715352)
Hello, while searching for a new hud element to display text to clients in csgo I found this

https://i.imgur.com/HVgh7DW.png

It's supports HTML Font flags as well and is part of the round end cs panel. Here's a snippet on how it works.

PHP Code:

Event newevent_message CreateEvent("cs_win_panel_round");
newevent_message.SetString("funfact_token""message here");

for(
int z 1<= MaxClientsz++)
  if(
IsClientInGame(z) && !IsFakeClient(z))
    
newevent_message.FireToClient(z);
                                
event_fake.Cancel(); 

Sadly it has drawbacks of not rendering for 1 second when you send the message. So if you want to constantly update the text like surf\bhop timer, it will be invisible or delayed. Thought I would share this with the community.

Not new.
https://media.discordapp.net/attachm...45/unknown.png
https://media.discordapp.net/attachm...84/unknown.png

backwards 08-24-2020 12:23

Re: [CSGO] New HTML Font supported hud element
 
what public plugin is it in then? also if you want to get technical, i did find this almost 2 years ago, just didn't try html tags

8guawong 08-24-2020 12:55

Re: [CSGO] New HTML Font supported hud element
 
Quote:

Originally Posted by backwards (Post 2715352)
Hello, while searching for a new hud element to display text to clients in csgo I found this

https://i.imgur.com/HVgh7DW.png

It's supports HTML Font flags as well and is part of the round end cs panel. Here's a snippet on how it works.

PHP Code:

Event newevent_message CreateEvent("cs_win_panel_round");
newevent_message.SetString("funfact_token""message here");

for(
int z 1<= MaxClientsz++)
  if(
IsClientInGame(z) && !IsFakeClient(z))
    
newevent_message.FireToClient(z);
                                
event_fake.Cancel(); 

Sadly it has drawbacks of not rendering for 1 second when you send the message. So if you want to constantly update the text like surf\bhop timer, it will be invisible or delayed. Thought I would share this with the community.

thanks for sharing this
any idea how to show pictures? like a few post above
and how to clear the message from screen?

digin 08-24-2020 13:11

Re: [CSGO] New HTML Font supported hud element
 
Quote:

Originally Posted by 8guawong (Post 2715394)
thanks for sharing this
any idea how to show pictures? like a few post above
and how to clear the message from screen?

it works for me
PHP Code:

newevent.SetString("funfact_token"" <img src='image_url'>"); 


MAGNET12 08-24-2020 20:02

Re: [CSGO] New HTML Font supported hud element
 
How did u manage to set up so many colors? new hud is limited to 128 characters only

as for clearing the message, simply send blank ("")

backwards 08-24-2020 23:21

Re: [CSGO] New HTML Font supported hud element
 
Quote:

Originally Posted by MAGNET12 (Post 2715421)
How did u manage to set up so many colors? new hud is limited to 128 characters only

as for clearing the message, simply send blank ("")

It's much larger than 128, i've had like 10000 char buffer pushed to it without any issue. Just need to use new lines \n if the text gets too wide

8guawong 08-25-2020 00:20

Re: [CSGO] New HTML Font supported hud element
 
Quote:

Originally Posted by digin (Post 2715395)
it works for me
PHP Code:

newevent.SetString("funfact_token"" <img src='image_url' width='500' height='600'>"); 


thx that's what i tried yesterday i'm not sure why it did not work for me yesterday but it's working now

Quote:

Originally Posted by MAGNET12 (Post 2715421)
How did u manage to set up so many colors? new hud is limited to 128 characters only

as for clearing the message, simply send blank ("")

thx!

MAGNET12 08-25-2020 04:45

Re: [CSGO] New HTML Font supported hud element
 
Quote:

Originally Posted by backwards (Post 2715431)
It's much larger than 128, i've had like 10000 char buffer pushed to it without any issue. Just need to use new lines \n if the text gets too wide

Strange...here's the most I could squeeze:

https://imgur.com/a/9pEsQ91

Also, did u manage to change the font size somehow? font size doesn't work for me

backwards 08-25-2020 06:43

Re: [CSGO] New HTML Font supported hud element
 
maybe its based on your game language? did you make any edits to the resource files for the green $ on hint text?

MAGNET12 08-25-2020 11:16

Re: [CSGO] New HTML Font supported hud element
 
Nah, I haven't modified any files. I might try to tamper in the language settings

Kubad 08-25-2020 12:53

Re: [CSGO] New HTML Font supported hud element
 
Quote:

Originally Posted by digin (Post 2715395)
it works for me
PHP Code:

newevent.SetString("funfact_token"" <img src='image_url'>"); 


i try use img but i have problem when i use it first time img is too small but when i used that second time img is okay maybe find some fix

MAGNET12 08-25-2020 15:49

Re: [CSGO] New HTML Font supported hud element
 
Quote:

Originally Posted by Kubad (Post 2715489)
i try use img but i have problem when i use it first time img is too small but when i used that second time img is okay maybe find some fix

Works exactly the same way on my server

Kubad 08-26-2020 07:42

Re: [CSGO] New HTML Font supported hud element
 
and i find 1 more bug with img when i used that its too small and text behind that doesnt show

OXYD 09-09-2020 21:30

Re: [CSGO] New HTML Font supported hud element
 
Quote:

Originally Posted by backwards (Post 2715462)
maybe its based on your game language? did you make any edits to the resource files for the green $ on hint text?

Which html tag u used to change the font size? cuz i can't edit it size too.

http://prntscr.com/uem0h3

PHP Code:

    Event text CreateEvent("cs_win_panel_round");
    
text.SetString("funfact_token"" <b><font size='15' color='#ffa500'>TEXT TEXT</font></b>"); 


bklol 09-18-2020 04:47

Re: [CSGO] New HTML Font supported hud element
 
Quote:

Originally Posted by OXYD (Post 2717325)
Which html tag u used to change the font size? cuz i can't edit it size too.

http://prntscr.com/uem0h3

PHP Code:

    Event text CreateEvent("cs_win_panel_round");
    
text.SetString("funfact_token"" <b><font size='15' color='#ffa500'>TEXT TEXT</font></b>"); 


PHP Code:

newevent_message.SetString("funfact_token""<u><span class='fontSize-xxl' color='#7FFF00'>(`ヮ´ )σ`∀´) ゚∀゚)σ</span></u> "); 


Oylsister 04-10-2021 00:14

Re: [CSGO] New HTML Font supported hud element
 
Is this possible for to make countdown timer on this HUD?

Ilusion9 08-27-2021 18:36

Re: [CSGO] New HTML Font supported hud element
 
Quote:

Originally Posted by Oylsister (Post 2743628)
Is this possible for to make countdown timer on this HUD?

yes, if you can override these variables:

PHP Code:

m_bShouldSetWinPanelExtraData true;
m_fSetWinPanelExtraDataTime gpGlobals->curtime 1.0f

from csgo code.

SHUFEN 08-30-2021 01:53

Re: [CSGO] New HTML Font supported hud element
 
Quote:

Originally Posted by Ilusion9 (Post 2756334)
yes, if you can override these variables:

PHP Code:

m_bShouldSetWinPanelExtraData true;
m_fSetWinPanelExtraDataTime gpGlobals->curtime 1.0f

from csgo code.

I was interested in that, but apparently that is on the client side, and cannot be changed from the server.

kratoss1812 02-03-2022 14:00

Re: [CSGO] New HTML Font supported hud element
 
Quote:

Originally Posted by backwards (Post 2715352)
Sadly it has drawbacks of not rendering for 1 second when you send the message. So if you want to constantly update the text like surf\bhop timer, it will be invisible or delayed. Thought I would share this with the community.

has anyone found a work-around for this?

bigborther 05-05-2022 07:14

Re: [CSGO] New HTML Font supported hud element
 
Quote:

Originally Posted by MAGNET12 (Post 2715507)
Works exactly the same way on my server

try add "<br>"

echocage 08-28-2022 21:19

Re: [CSGO] New HTML Font supported hud element
 
Hello! Is it possible to hide the cs_win_panel_round interface itself and at the same time display its contents?

iGANGNAM 10-15-2022 08:30

Re: [CSGO] New HTML Font supported hud element
 
In case you would like to overlap cs_win_panel_round :) (same text as warmup, match starting in.. etc)
Quote:

stock void PrintCenterTextHtml(int client, int iDuration, const char[] message, any ...) {
if(IsClientInGame(client) && !IsFakeClient(client))
{
char buffer[512];
SetGlobalTransTarget(client);
VFormat(buffer, sizeof(buffer), message, 4);
Event hEvent_html = CreateEvent("show_survival_respawn_status", true);
SetEventString(hEvent_html, "loc_token", buffer);
SetEventInt(hEvent_html, "duration", iDuration);
SetEventInt(hEvent_html, "userid", GetClientUserId(client));

hEvent_html.FireToClient(client);
CancelCreatedEvent(hEvent_html);
}
}
It does support font, image stuff as well


All times are GMT -4. The time now is 22:38.

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