Raised This Month: $ Target: $400
 0% 

Solved HUD Fading & Overwriting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 06-29-2018 , 12:55   HUD Fading & Overwriting
Reply With Quote #1

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?
__________________

Last edited by edon1337; 07-17-2018 at 08:31.
edon1337 is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-29-2018 , 12:59   Re: HUD Fading & Overwriting
Reply With Quote #2

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
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 06-29-2018 , 13:15   Re: HUD Fading & Overwriting
Reply With Quote #3

Quote:
Originally Posted by ^SmileY View Post
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 View Post
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 View Post
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.
__________________
edon1337 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-29-2018 , 13:55   Re: HUD Fading & Overwriting
Reply With Quote #4

Quote:
Originally Posted by ^SmileY View Post
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.
__________________
HamletEagle is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-29-2018 , 14:02   Re: HUD Fading & Overwriting
Reply With Quote #5

Quote:
Originally Posted by HamletEagle View Post
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
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 06-29-2018 , 15:18   Re: HUD Fading & Overwriting
Reply With Quote #6

Quote:
Originally Posted by ^SmileY View Post
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 View Post
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.
__________________

Last edited by edon1337; 06-29-2018 at 15:27.
edon1337 is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 06-29-2018 , 13:40   Re: HUD Fading & Overwriting
Reply With Quote #7

Idk if this will be main issue but there's bug in engine hud dissapears some times which can not be fixed. [AFAIK]
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-29-2018 , 13:43   Re: HUD Fading & Overwriting
Reply With Quote #8

Quote:
Originally Posted by Ghosted View Post
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?
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 06-29-2018 at 13:48.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Old 06-29-2018, 14:17
Ghosted
This message has been deleted by Ghosted.
SomewhereLost
AlliedModders Donor
Join Date: Mar 2014
Location: Tomorrowland
Old 06-29-2018 , 15:38   Re: HUD Fading & Overwriting
Reply With Quote #10

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.
__________________

Last edited by SomewhereLost; 06-29-2018 at 15:42.
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
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 12:47.


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