AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved HUD Fading & Overwriting (https://forums.alliedmods.net/showthread.php?t=308669)

edon1337 06-29-2018 12:55

HUD Fading & Overwriting
 
Hi,

Why do some HUD messages fade away? In my case this code creates a HUD and you can only see it for a few seconds, such as:

'Round starts in: 15 seconds'
'Round starts in: 14 seconds'
*fades away*
'Round starts in: 1 second'

PHP Code:

public OnNewRound( )
{    
    
g_iTime get_pcvar_numg_iCvar );
    
set_task1.0"OnTaskCountDown", .flags "a", .repeat g_iTime );
}

public 
OnTaskCountDown( )
{
    
set_hudmessage025500.350.3500.01.0 )
    
ShowSyncHudMsg0g_iSyncHud"Round starts in %d second%s"g_iTime--, ( g_iTime ) ? "s" "" );
    
    if( 
g_iTime <= )
    {
            
// un-needed code
    
}


Also, can a HUD from a different plugin overwrite another HUD in another plugin?

^SmileY 06-29-2018 12:59

Re: HUD Fading & Overwriting
 
Is not really good to use set_task, but the problem is hold time param

1.0, need to be 1.1 since will fade out when task is not being restarted.

Also you can just use .flags="b" and remove the task when clicle end instead of flag A

edon1337 06-29-2018 13:15

Re: HUD Fading & Overwriting
 
Quote:

Originally Posted by ^SmileY (Post 2599900)
Is not really good to use set_task

I know, but I used this method and it made the HUD appear and disappear, I need a constant HUD.

Quote:

Originally Posted by ^SmileY (Post 2599900)
the problem is hold time param 1.0, need to be 1.1 since will fade out when task is not being restarted.

I tried and got the same result..

Quote:

Originally Posted by ^SmileY (Post 2599900)
Also you can just use .flags="b" and remove the task when clicle end instead of flag A

Yeah, but it doesn't really matter.

Ghosted 06-29-2018 13:40

Re: HUD Fading & Overwriting
 
Idk if this will be main issue but there's bug in engine hud dissapears some times which can not be fixed. [AFAIK]

^SmileY 06-29-2018 13:43

Re: HUD Fading & Overwriting
 
Quote:

Originally Posted by Ghosted (Post 2599907)
Idk if this will be main issue but there's bug in engine hud dissapears some times which can not be fixed. [AFAIK]

Is not true, i used hudmessages on my pugmod, and do not have this problem using set_task (Except when ResetHUD envet is called)

Edit: You need a plugin to display a timeleft of freezetime?

HamletEagle 06-29-2018 13:55

Re: HUD Fading & Overwriting
 
Quote:

Originally Posted by ^SmileY (Post 2599900)
Is not really good to use set_task, but the problem is hold time param

1.0, need to be 1.1 since will fade out when task is not being restarted.

Also you can just use .flags="b" and remove the task when clicle end instead of flag A


Not true, set_task is fine.

^SmileY 06-29-2018 14:02

Re: HUD Fading & Overwriting
 
Quote:

Originally Posted by HamletEagle (Post 2599911)
Not true, set_task is fine.

This is why i asked him, it can be hooked on Hud Events do not need a task to do the job

edon1337 06-29-2018 15:18

Re: HUD Fading & Overwriting
 
Quote:

Originally Posted by ^SmileY (Post 2599913)
This is why i asked him, it can be hooked on Hud Events do not need a task to do the job

I need a countdown from 15 to 0 when round starts..

Quote:

Originally Posted by ^SmileY (Post 2599908)
Is not true, i used hudmessages on my pugmod, and do not have this problem using set_task (Except when ResetHUD envet is called)

It doesn't happen if hold time is 0.1 because I already have 2 constant HUDs who never fade.

SomewhereLost 06-29-2018 15:38

Re: HUD Fading & Overwriting
 
Quote:

Also, can a HUD from a different plugin overwrite another HUD in another plugin?
Yes it can if they have the same channel.

If you are already using other HUD messages, especially when they are constant ones, maybe change the channel of the message since it might be busy.

edon1337 06-29-2018 15:41

Re: HUD Fading & Overwriting
 
Quote:

Originally Posted by SomewhereLost (Post 2599926)
If you are already using other HUD messages, especially when they are constant ones, maybe change the channel of the message since it might be busy.

I did, I tried -1 which automatically finds a free channel but nothing happened.


All times are GMT -4. The time now is 12:47.

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