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

CreateHudSynchronizer Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
scorpius2k1
Senior Member
Join Date: Feb 2016
Old 11-26-2017 , 13:29   CreateHudSynchronizer Help
Reply With Quote #1

What is the proper way to update existing HUD text created with CreateHudSynchronizer/ShowSyncHudText properties? For example, if I wanted to update the text to say "Goodbye" from "Hello", currently the only way I can do this is by calling the "ShowSyncHudText" function. My reason for asking this is it seems if you use another "ShowSyncHudText" before the last one completed via "SetHudTextParams" => fadein, hold, fadout times -- another one is created behind the scense and it sometimes can cause other HudSynchronizers to dissapear until the existing one finishes if they are fired too rapidly (say every 0.5 seconds). I am guessing this is the games limitations on channel usage for HUD messages, however, if there were a way to just update the HUD without creating a new one each time this wouldn't happen. Similiary how you can change a game_text entity 'text' property dynamically, without another being created.

Below is a compilable code example of how I have been using the function and will reproduce the issue I am referencing. Here, I create two separate HudSynchronizers, one fired OnGameFrame and another in a repeating timer. The issue will happen if you simply hold down primary fire, shortly after HUD B is shown, HUD A will dissappear until you release primary fire.


I am hoping that I am just improperly using the 'CreateHudSynchronizer' function and there is a solution to this.

Thanks for your help!

PHP Code:
#include <sourcemod>
#include <sdktools>

Handle hHudTextA;
Handle hHudTextB;

public 
OnPluginStart()
{
    
hHudTextA CreateHudSynchronizer();
    
hHudTextB CreateHudSynchronizer();
}

public 
OnMapStart()
{
    
CreateTimer(1.0TimerHudRefresh_TIMER_REPEAT);
}    

public 
Action:TimerHudRefresh(Handle:timer)
{
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && !IsClientObserver(i))
        {
            
SetHudTextParams(0.00.01.02550025500.00.250.25);
            
ShowSyncHudText(ihHudTextA"THIS IS HUD A");
        }
    }
}

public 
Action:OnPlayerRunCmd(client, &iButtons, &ImpulseFloat:fVelocity[3], Float:fAngles[3], &iWeapon)
{
    if ((
iButtons IN_ATTACK) == IN_ATTACK)
    {
        
SetHudTextParams(0.00.51.00255025500.00.250.25);
        
ShowSyncHudText(clienthHudTextB"THIS IS HUD B");
    }

__________________
{__ PIRATES COVE __} ● HIGH-KILL Community | Stats ●
Half-Life 2: Deathmatch
66.151.244.149:27016 => CONNECT
scorpius2k1 is offline
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 11-26-2017 , 18:21   Re: CreateHudSynchronizer Help
Reply With Quote #2

Use https://sm.alliedmods.net/new-api/halflife/ShowHudText As it comes with selectable channels from 1-6. Simply give A channel 1, and B channel 2, or whatever aslong as they're not on the same channel, once a channel is used its used and will get overwritten by any other plugin using the same channel.
__________________
xines is offline
psychonic

BAFFLED
Join Date: May 2008
Old 11-27-2017 , 08:05   Re: CreateHudSynchronizer Help
Reply With Quote #3

Quote:
Originally Posted by xines View Post
aslong as they're not on the same channel, once a channel is used its used and will get overwritten by any other plugin using the same channel.
That's exactly what the HudSynchronizer exists to prevents.
psychonic is offline
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 11-27-2017 , 10:31   Re: CreateHudSynchronizer Help
Reply With Quote #4

Quote:
Originally Posted by psychonic View Post
That's exactly what the HudSynchronizer exists to prevents.
Yes correct i felt it was important to state the above if he decides to go with ShowHudText, but aslong as you know what channels you are using then it should not be a problem.

In this case the two HudSynchronizers are conflicting each other being sent this rapidly. It is clearly eating up A's channel when B is being sent and reproduced this fast. I can't make up any other solution than having to sperate the channels.

- But feel free to post another solution psychonic if you happen to know.
__________________
xines 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 09:43.


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