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.0, TimerHudRefresh, _, TIMER_REPEAT);
}
public Action:TimerHudRefresh(Handle:timer)
{
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && !IsClientObserver(i))
{
SetHudTextParams(0.0, 0.0, 1.0, 255, 0, 0, 255, 0, 0.0, 0.25, 0.25);
ShowSyncHudText(i, hHudTextA, "THIS IS HUD A");
}
}
}
public Action:OnPlayerRunCmd(client, &iButtons, &Impulse, Float:fVelocity[3], Float:fAngles[3], &iWeapon)
{
if ((iButtons & IN_ATTACK) == IN_ATTACK)
{
SetHudTextParams(0.0, 0.5, 1.0, 0, 255, 0, 255, 0, 0.0, 0.25, 0.25);
ShowSyncHudText(client, hHudTextB, "THIS IS HUD B");
}
}
__________________