Solved Scripting Help: Hud message

XTreme killer

Active member
RIS Admin
Content Writer
PHP:
public void OnPluginStart()
{
    RegConsoleCmd("sm_hud", Hud, "Hud check");
}

public Action Hud(client, args)
{
    for(new i = 1; i <= MaxClients; i++)
    {
        SetHudTextParams(0.37, -0.60, 1.0, 255, 0, 0, 200, 1);
        ShowHudText(i, 3, "MVP :");
        SetHudTextParams(0.55, -0.60, 1.0, 255, 255, 255, 200, 1);
        ShowHudText(i, 4, "Playername");
    }
}
For some reason, This code doesn't run at all.
Please help me @Vertigo.
 

Vertigo

⍥????
Staff member
Administrator
Any errors ?
 

Vertigo

⍥????
Staff member
Administrator
It does show up.
But for a fraction of milliseconds.
 

Vertigo

⍥????
Staff member
Administrator
Try increasing the timer value.
 

Vertigo

⍥????
Staff member
Administrator
Do you test this when there are bots on server ?
 

Vertigo

⍥????
Staff member
Administrator
Then 100% this plugin will throw errors. And you said there are no errors.
 

Vertigo

⍥????
Staff member
Administrator
You need to check if client is in game and is not a bot before printing the text.
C++:
for(new i = 1; i <= MaxClients; i++)
{
    if(IsClientInGame(i) && !IsFakeClient(i))
    {    
        SetHudTextParams(0.37, -0.60, 1.0, 255, 0, 0, 200, 1);
        ShowHudText(i, 3, "MVP :");
        SetHudTextParams(0.55, -0.60, 1.0, 255, 255, 255, 200, 1);
        ShowHudText(i, 4, "Playername");
    }
}
 

XTreme killer

Active member
RIS Admin
Content Writer
Then 100% this plugin will throw errors. And you said there are no errors.
There were errors.

You need to check if client is in game and is not a bot before printing the text.
C++:
for(new i = 1; i <= MaxClients; i++)
{
    if(IsClientInGame(i) && !IsFakeClient(i))
    {   
        SetHudTextParams(0.37, -0.60, 1.0, 255, 0, 0, 200, 1);
        ShowHudText(i, 3, "MVP :");
        SetHudTextParams(0.55, -0.60, 1.0, 255, 255, 255, 200, 1);
        ShowHudText(i, 4, "Playername");
    }
}
Now it working FINE. Thanks
 
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock