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

Arrange huds under each other


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Deidara
Member
Join Date: Jul 2010
Location: Romania
Old 02-07-2016 , 13:09   Arrange huds under each other
Reply With Quote #1

Hello, I have this.
It's a hud message who appears left or right depends of the players team.
I put the up-down possition random but ocasionally they overwrite, I don't know how to explain it so I'll attach a screenshot.

The first image - 1 is what happend when two or more huds are displayed - look at the left side, up. [ http://steamcommunity.com/id/eliara/...74420292407965 ]
The second image is how I want them to be, when two or more messages are generated I want them under each other to look nice. [ http://steamcommunity.com/id/eliara/...74420292407965 ]

Screens are on steam cloud images gallery because I can't upload them, they are too large.

Code:

PHP Code:
announce(killerlevel)
{
    new 
streak get_streak()

    if (
streak&1)
    {
        new 
name[32];
        new 
PositionYforCT random_num(0.15,0.70)
        new 
PositionXforT random_num(0.15,0.70)

           
get_user_name(killername32);
          if ( 
cs_get_user_team(killer) == CS_TEAM_CT )
            {
                
set_dhudmessage(0801500.03PositionYforCT20.026.00.010.12);
                
show_dhudmessage(0stkmessages[level], name);
            }
        else
            {
                
set_dhudmessage(20592920.80PositionXforT20.026.00.010.12);
                
show_dhudmessage(0stkmessages[level], name);
            }
    }

    if (
streak&2)
    {
            
client_cmd(0"spk %s"stksounds[level]);
    }

Sorry if this topic doesn't look attractive but I'm not english and I don't know it very well.
I hope there's the right section to ask help.

Last edited by Deidara; 02-07-2016 at 13:11.
Deidara is offline
Send a message via Yahoo to Deidara Send a message via Skype™ to Deidara
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-07-2016 , 13:59   Re: Arrange huds under each other
Reply With Quote #2

You can use sync huds and clear it before you show
PHP Code:
//plugin_init()
g_HUDSyncObj CreateHudSyncObj();

//Show HUD
ClearSyncHudg_HUDSyncObj );
set_hudmessage255 255 , -1.0 0.25 , .holdtime=1.0 );
ShowSyncHudMsgg_HUDSyncObj "Test" ); 
__________________
Bugsy is offline
Deidara
Member
Join Date: Jul 2010
Location: Romania
Old 02-08-2016 , 18:31   Re: Arrange huds under each other
Reply With Quote #3

Hello.
Thanks for reply.
Is there a way to make them all show but one after each other instead of making them disappear? I want all of the to show but in order, I don't want to erase them when another is pop up.
Deidara is offline
Send a message via Yahoo to Deidara Send a message via Skype™ to Deidara
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-08-2016 , 18:34   Re: Arrange huds under each other
Reply With Quote #4

If you want them all there but not overwriting each other, change the X/Y coordinates in set_hudmessage().
__________________
Bugsy is offline
Deidara
Member
Join Date: Jul 2010
Location: Romania
Old 02-08-2016 , 18:48   Re: Arrange huds under each other
Reply With Quote #5

How can I put the conditions to not overwrite but in the same time the up-down possition to be random? Or manually set it to be under each other?

Last edited by Deidara; 02-08-2016 at 18:48.
Deidara is offline
Send a message via Yahoo to Deidara Send a message via Skype™ to Deidara
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-08-2016 , 19:29   Re: Arrange huds under each other
Reply With Quote #6

If you want random without one overlapping another you will need to do work to make sure one is not over another, whether partially or totaly.

Instead of random, I would define an array of 5-10 origins and loop through it. Make this set ones that you know will be ok if used one after the other.
__________________
Bugsy is offline
Deidara
Member
Join Date: Jul 2010
Location: Romania
Old 02-08-2016 , 19:31   Re: Arrange huds under each other
Reply With Quote #7

Can you show me an example of this array please? I'm gonna try it.
Deidara is offline
Send a message via Yahoo to Deidara Send a message via Skype™ to Deidara
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-08-2016 , 20:12   Re: Arrange huds under each other
Reply With Quote #8

You can make them go down in a line, a circle, random, or anything you want. You just need to fill the array with the X,Y coords.
PHP Code:
#include <amxmodx>

enum HUDPos
{
    
Float:HUD_X,
    
Float:HUD_Y
}

new const 
Float:HUDCoords[][ HUDPos ] = 
{
    { 
0.05 0.24 },
    { 
0.05 0.28 },
    { 
0.05 0.32 },
    { 
0.05 0.36 },
    { 
0.05 0.40 },                
    { 
0.05 0.44 },                
    { 
0.05 0.48 },    
    { 
0.05 0.52 }
}
    
public 
plugin_init()
{
    
register_clcmd"say test" "TestCmd" );
}

public 
TestCmdid )
{
    
set_task1.0 "ShowHUD" , .flags="b" );
}

public 
ShowHUD()
{
    static 
iHUDIndex;

    
set_hudmessage255 255 255 HUDCoordsiHUDIndex ][ HUD_X ] , HUDCoordsiHUDIndex ][ HUD_Y ] , .holdtime=1.0 );
    
show_hudmessage"Test hud #%d" iHUDIndex );
    
    if ( ++
iHUDIndex == sizeofHUDCoords ) )
        
iHUDIndex 0;

__________________

Last edited by Bugsy; 02-08-2016 at 20:14.
Bugsy is offline
Deidara
Member
Join Date: Jul 2010
Location: Romania
Old 02-08-2016 , 20:39   Re: Arrange huds under each other
Reply With Quote #9

Thanks for you time. That really helps me and I managed to make it work.
Deidara is offline
Send a message via Yahoo to Deidara Send a message via Skype™ to Deidara
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 16:09.


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