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

DHUD Overlapping


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nG_getwreck
Senior Member
Join Date: Oct 2020
Location: Philippines from South K
Old 12-29-2020 , 21:50   DHUD Overlapping
Reply With Quote #1

Hello, I want to fix dhud overlapping when switching dhud messages.

I'm using Display current mode by Driss and I modify it to hud scoreboard with displaying current mode.

When I'm switching messages, it overlaps.

PHP Code:
#include <amxmodx>
#include <zombieplague>

#if AMXX_VERSION_NUM < 183
    #include <dhudmessage>
#endif 

new const hud_tag[] = ""
 
new mode_names[][] =
{
    
"-[Waiting...]-",        // No mode Started
    
"[Normal Infection]",        // Normal Infection, single round
    
"-[Human VS Nemesis]-",            // Nemesis Mode
    
"[Survivor]",        // Survivor Mode 
    
"[Swarm]",            // Swarm round 
    
"-[Human VS Zombies]-",        // Multiple Infection 
}

const 
Float:START_TIME 3.0
const Float:START_TIME 6.0

/*================================================================================

=================================================================================*/

new const rgb_hud_colors[sizeof(mode_names)][3] =
{
//    R    G    B
    
{255,     255,     255},        // 
    
{0,     255,     0},         // 
    
{255,     0,     0},        // 
    
{255,     70,     0},        // 
    
{0,     0,     255},        // 
    
{0,     255,     255},        //    
}

/* Initialization */

new ZombieWins
new HumanWins
new g_Mode

// Cvar pointers
new cvar_enablecvar_central

public plugin_init() 
{
    
// Plugin Info
    
register_plugin("Addon: Display the Current Mode""0.1.6""driss")
    
    
// Round Start Event
    
register_event("HLTV""event_RoundStart""a""1=0""2=0")
    
    
// Enable Cvar
    
cvar_enable register_cvar("zp_display_mode""5")
    
    
// Set task Hud
    
set_task(START_TIME"HUDUpdate"0,"",0,"b")
    
    
// Server Cvar
    
register_cvar("zp_addon_dtcm""v0.1.6 by meTaLiCroSS"FCVAR_SERVER|FCVAR_SPONLY)
    
    
// Getting "zp_on" cvar
    
if(cvar_exists("zp_on"))
        
cvar_central get_cvar_pointer("zp_on")
    
    
// If Zombie Plague is not running (bugfix)
    
if(!get_pcvar_num(cvar_central))
        
pause("e"
}

public 
event_RoundStart()
{
    
// Update var (no mode started / in delay)
    
g_Mode 0
}

public 
zp_round_started(modeid)
{
    
// Update var with Mode num
    
g_Mode mode
    
    
// An unofficial mode
    
if(!(<= mode < (sizeof(mode_names) - 1)))
        
g_Mode sizeof(mode_names) - 1


public 
zp_round_ended(WinTeam)
{
    switch(
WinTeam
    {
        case 
ZP_TEAM_ZOMBIE: {
            
ZombieWins ZombieWins 1
        
}
        case 
ZP_TEAM_HUMAN: {
            
HumanWins HumanWins 1
        
}
    }
}

public 
HUDUpdate()
{          
    new 
zombies zp_get_zombie_count()
    new 
humans zp_get_human_count()
    
        if(!
get_pcvar_num(cvar_enable))
        return;
    
        
set_dhudmessage(rgb_hud_colors[g_Mode][0], rgb_hud_colors[g_Mode][1], rgb_hud_colors[g_Mode][2], -1.00.006.00.50.10.0)
        
show_dhudmessage(0"%s %s^n-[ Human (%i) / Escapes (%i) ]- -[ Zombies (%i) / Wins (%i) ]-"g_Mode == "" hud_tagmode_names[g_Mode], humansHumanWinszombiesZombieWins)

        if(
zp_is_nemesis_round() & 1) {
    
set_dhudmessage(rgb_hud_colors[g_Mode][0], rgb_hud_colors[g_Mode][1], rgb_hud_colors[g_Mode][2], -1.00.006.00.50.10.0)
    
show_dhudmessage(0"%s %s^n-[ Human (%i) / Escapes (%i) ]- -[ Nemesis (%i) / Wins (%i) ]-", (g_Mode == "" hud_tag), mode_names[g_Mode], humansHumanWinszombiesZombieWins)
    }

VIDEO:
CLICK THIS VIDEO
__________________

Last edited by nG_getwreck; 12-29-2020 at 22:04.
nG_getwreck is offline
nG_getwreck
Senior Member
Join Date: Oct 2020
Location: Philippines from South K
Old 12-29-2020 , 22:06   Re: DHUD Overlapping
Reply With Quote #2

As seen on video, it overlaps between zombies and nemesis text.
__________________
nG_getwreck is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-30-2020 , 07:03   Re: DHUD Overlapping
Reply With Quote #3

What do you expect it do to when it uses 2 messages at once? There is no "elseif" check anywhere, it justs puts another one on top of if it's Nemesis round.

Replace:

Code:
set_dhudmessage(rgb_hud_colors[g_Mode][0], rgb_hud_colors[g_Mode][1], rgb_hud_colors[g_Mode][2], -1.0, 0.0, 0, 6.0, 0.5, 0.1, 0.0) show_dhudmessage(0, "%s %s^n-[ Human (%i) / Escapes (%i) ]- -[ Zombies (%i) / Wins (%i) ]-", g_Mode == 0 ? "" : hud_tag, mode_names[g_Mode], humans, HumanWins, zombies, ZombieWins) if(zp_is_nemesis_round() & 1) {     set_dhudmessage(rgb_hud_colors[g_Mode][0], rgb_hud_colors[g_Mode][1], rgb_hud_colors[g_Mode][2], -1.0, 0.0, 0, 6.0, 0.5, 0.1, 0.0)     show_dhudmessage(0, "%s %s^n-[ Human (%i) / Escapes (%i) ]- -[ Nemesis (%i) / Wins (%i) ]-", (g_Mode == 0 ? "" : hud_tag), mode_names[g_Mode], humans, HumanWins, zombies, ZombieWins) }

With:

Code:
if(zp_is_nemesis_round() & 1) {     set_dhudmessage(rgb_hud_colors[g_Mode][0], rgb_hud_colors[g_Mode][1], rgb_hud_colors[g_Mode][2], -1.0, 0.0, 0, 6.0, 0.5, 0.1, 0.0)     show_dhudmessage(0, "%s %s^n-[ Human (%i) / Escapes (%i) ]- -[ Nemesis (%i) / Wins (%i) ]-", (g_Mode == 0 ? "" : hud_tag), mode_names[g_Mode], humans, HumanWins, zombies, ZombieWins) } else {     set_dhudmessage(rgb_hud_colors[g_Mode][0], rgb_hud_colors[g_Mode][1], rgb_hud_colors[g_Mode][2], -1.0, 0.0, 0, 6.0, 0.5, 0.1, 0.0)     show_dhudmessage(0, "%s %s^n-[ Human (%i) / Escapes (%i) ]- -[ Zombies (%i) / Wins (%i) ]-", g_Mode == 0 ? "" : hud_tag, mode_names[g_Mode], humans, HumanWins, zombies, ZombieWins) }
__________________

Last edited by OciXCrom; 12-30-2020 at 07:04.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
nG_getwreck
Senior Member
Join Date: Oct 2020
Location: Philippines from South K
Old 12-30-2020 , 11:42   Re: DHUD Overlapping
Reply With Quote #4

Thanks, it doesn't happen now.
__________________
nG_getwreck 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 03:11.


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