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

Help with HUD


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jugule
AlliedModders Donor
Join Date: Apr 2020
Old 05-04-2020 , 14:00   Help with HUD
Reply With Quote #1

Use this code to display the name of the player who is "Simon". (Jailbreak)
only I only see the name in hud, the others don't see it. what would be the problem?

PHP Code:

for(new client 1client <= MaxClientsclient++)  
    {
        if(
IsClientInGame(client))
        {
            
                if(
Warden == 1)
                {
    
                    
SetHudTextParams(-1.00.05.074255255100.10.10.1);  
                    
ShowHudText(client1"%N is Simon"Warden);
                }
                else 
                {
                    
SetHudTextParams(-1.00.05.074255255100.10.10.1);  
                    
ShowHudText(client1"No simon"]);
                }
            } 
Warden = it's "Simon." I mention again that only I see that they are "Simon", the other players, no.

Last edited by jugule; 05-04-2020 at 14:00.
jugule is offline
drespy
Member
Join Date: Jul 2018
Old 05-05-2020 , 04:08   Re: Help with HUD
Reply With Quote #2

Try to change HUD channel param, use automatic (-1).
PHP Code:
                {
    
                    
SetHudTextParams(-1.00.05.074255255100.10.10.1);  
                    
ShowHudText(client, -1"%N is Simon"Warden);
                }
                else 
                {
                    
SetHudTextParams(-1.00.05.074255255100.10.10.1);  
                    
ShowHudText(client, -1"No simon");
                } 
__________________
|Contact me via Steam|

drespy is offline
jugule
AlliedModders Donor
Join Date: Apr 2020
Old 05-08-2020 , 11:06   Re: Help with HUD
Reply With Quote #3

Quote:
Originally Posted by drespy View Post
Try to change HUD channel param, use automatic (-1).
PHP Code:
                {
    
                    
SetHudTextParams(-1.00.05.074255255100.10.10.1);  
                    
ShowHudText(client, -1"%N is Simon"Warden);
                }
                else 
                {
                    
SetHudTextParams(-1.00.05.074255255100.10.10.1);  
                    
ShowHudText(client, -1"No simon");
                } 
don't work

Full code:
PHP Code:
int Warden -1;

public 
void OnPluginStart()
{    
    
RegConsoleCmd("sm_warden"Command_Warden);
}

public 
Action Command_Warden(int client
{
Warden client;
PrintToChat(client"you are simon!")
}

public 
Action Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)  
{
CreateTimer(1.0HudInfoJB_TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}

public 
Action HudInfoJB(Handle timer)
{

    for(
int client 1client <= MaxClientsclient++)
    {
        if(
IsValidClient(client))
        {
            if(
Warden == 1)
            {
                
                   
SetHudTextParams(-1.00.05.074255255500.10.10.1);  
                   
ShowHudText(client1"Simon is: %N"Warden);
            }
            else
            {
                    
SetHudTextParams(-1.00.05.074255255500.10.10.1);  
                    
ShowHudText(client1"No Simon!");
             }
        }
    }

Simon's name does not appear. what do you think would be the solution? can you help me?

Last edited by DarkDeviL; 05-10-2020 at 19:06. Reason: Restore to previous version.
jugule is offline
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 05-08-2020 , 15:16   Re: Help with HUD
Reply With Quote #4

You can also replace ShowHudText with ShowSyncHudText but you need to CreateHudSynchronizer first.
__________________

Last edited by MAGNAT2645; 05-08-2020 at 15:17.
MAGNAT2645 is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 05-24-2020 , 01:07   Re: Help with HUD
Reply With Quote #5

Try this:
PHP Code:
int
    Warden 
= -1;
Handle
    hHUD
;

public 
void OnPluginStart()
{
    
hHUD CreateHudSynchronizer();

    
RegConsoleCmd("sm_warden"Command_Warden);
}

public 
void OnMapStart()
{
    
Warden = -1;
    
CreateTimer(1.0HudInfoJB_TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}

public 
Action Command_Warden(int clientint args)
{
    if(!
client || Warden != -1) return Plugin_Handled;

    
Warden client;
    
PrintToChat(client"You are Simon!")

    return 
Plugin_Handled;
}

public 
void OnClientDisconnect(int client)
{
    if(
client == WardenWarden = -1;
}

public 
Action HudInfoJB(Handle timer)
{
    
SetHudTextParams(-1.00.01.174255255500.10.10.1);
    for(
int i 1<= MaxClientsi++) if(IsValidClient(i))
    {
        if(
Warden != -1)
            
ShowSyncHudText(ihHUD"Simon is: %N"Warden);
        else 
ShowSyncHudText(ihHUD"No Simon!");
    }
}

stock bool IsValidClient(int client)
{
    return 
IsClientInGame(client) && !IsFakeClient(client);

__________________
Grey83 is offline
Reply



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 10:21.


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