Raised This Month: $ Target: $400
 0% 

Dynamic Data HudMessage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-21-2017 , 05:35   Dynamic Data HudMessage
Reply With Quote #1

Hi. So i wanted to make a hud message that will display current weapon name. So the problem is that if player changes weapon then hud message must be changed too. In this case i made a task with interval 0.2 seconds and every time it loops all players and sets hud message with current weapon name.

But i think this is not pretty efficient because if players holds a gun much time and doesnt change it often then the loop will have no sense.

I just wonder is there any method to overlap current hud by reseting the previous one or something like this?

Or maybe i can reset channel on curweapon event and set hud message back with modified message?

Last edited by siriusmd99; 07-21-2017 at 05:36.
siriusmd99 is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 07-21-2017 , 06:14   Re: Dynamic Data HudMessage
Reply With Quote #2

show your current code,
curweapon to change weapon name + hud sync (hud message hold time = 99 ) + clear hud on client death.
__________________
JusTGo is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-21-2017 , 06:58   Re: Dynamic Data HudMessage
Reply With Quote #3

Quote:
Originally Posted by JusTGo View Post
show your current code,
curweapon to change weapon name + hud sync (hud message hold time = 99 ) + clear hud on client death.
Ham_Item_Deploy, not CurWeapon.
__________________
HamletEagle is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-21-2017 , 10:44   Re: Dynamic Data HudMessage
Reply With Quote #4

I did that but every time i change weapon it looks like clearsync doesnt work and hud is overlapping . It's green and if i switch the weapons fast then hud message starts to become white and ugly.
It looks like previous message didn't dissapear and new one is overlaping it.
tried fadeout 0.0 - no result. It's not logic, i don't understand how the hell such thing can happen.

PHP Code:
#define HUD_TIME 6.0

public plugin_init()
{
    
set_task(HUD_TIME"HudDisplay", .flags"b")
}

public 
OnItemDeployPost(ent)
{
    new 
id get_pdata_cbase(ent414
   

    
ClearSyncHud(id,g_NewSyncObj)
   
        
g_curKills[id] = get_weapon_kills(id);
        
set_hudmessage(34139340.020.890, .holdtime =  HUD_TIME);
        
ShowSyncHudMsg(idg_NewSyncObj"Current Kills: %d"g_curKills[id]);
    
}

public 
HudDisplay()
{
    new 
iPlayers[32]
    new 
iNumid;
    
get_players(iPlayersiNum"a")
    for (new 
iiNumi++)
    {
        
id iPlayers[i];
        
        
ClearSyncHud(id,g_NewSyncObj)

        
set_hudmessage(34139340.020.8900.0, .holdtime =  HUD_TIME);
        
ShowSyncHudMsg(idg_NewSyncObj"Current Kills: %d"g_curKills[id]);
    }


Last edited by siriusmd99; 07-21-2017 at 10:48.
siriusmd99 is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 07-21-2017 , 11:25   Re: Dynamic Data HudMessage
Reply With Quote #5

remove the task and ClearSync only at client death.

PHP Code:
#define HUD_TIME 6.0

public OnItemDeployPost(ent)
{
    new 
id get_pdata_cbase(ent414
   

   
        
g_curKills[id] = get_weapon_kills(id);
        
set_hudmessage(34139340.020.890, .holdtime =  HUD_TIME);
        
ShowSyncHudMsg(idg_NewSyncObj"Current Kills: %d"g_curKills[id]);
    

__________________
JusTGo is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-21-2017 , 11:38   Re: Dynamic Data HudMessage
Reply With Quote #6

Quote:
Originally Posted by JusTGo View Post
remove the task and ClearSync only at client death.

PHP Code:
#define HUD_TIME 6.0

public OnItemDeployPost(ent)
{
    new 
id get_pdata_cbase(ent414
   

   
        
g_curKills[id] = get_weapon_kills(id);
        
set_hudmessage(34139340.020.890, .holdtime =  HUD_TIME);
        
ShowSyncHudMsg(idg_NewSyncObj"Current Kills: %d"g_curKills[id]);
    

Doesn't work anyway.
+ i can't remove task because if player doesnt change weapon then hud will dissapear after 6 seconds.

I managed to make a global task and loop all players every 0.5 seconds but i think it's not efficient and even if i do this way then hud will blink akward and it's anoying.

Last edited by siriusmd99; 07-21-2017 at 11:41.
siriusmd99 is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 07-21-2017 , 11:47   Re: Dynamic Data HudMessage
Reply With Quote #7

change HUD_TIME to 600.0 for example and it will not dissapear and use clearsync to remove it at client death.
__________________
JusTGo is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-21-2017 , 11:54   Re: Dynamic Data HudMessage
Reply With Quote #8

Quote:
Originally Posted by JusTGo View Post
change HUD_TIME to 600.0 for example and it will not dissapear and use clearsync to remove it at client death.
Yes, but if i change weapon i must reset hud message because points are different.
So i must reset task in ham deploy every time weapon changes.
siriusmd99 is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 07-21-2017 , 12:32   Re: Dynamic Data HudMessage
Reply With Quote #9

Quote:
Originally Posted by siriusmd99 View Post
Yes, but if i change weapon i must reset hud message because points are different.
So i must reset task in ham deploy every time weapon changes.
we need full code, you may not need the task, what are points ?
__________________
JusTGo is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-21-2017 , 15:02   Re: Dynamic Data HudMessage
Reply With Quote #10

I understand now. The problem is that if i use smaller task like 1.0 or 0.5 then the fade in effect (that cannot be changed) is repeating at least 1 time per second and it makes illusion that text is blinking.

But if I set a task with longer time like 30 seconds then it's ok.
But when i try to clear synchud at item deploy and start a new message with modified string then it starts to overlap and text becomes white and messy.
siriusmd99 is offline
Reply


Thread Tools
Display Modes

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 22:56.


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