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.
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_enable, cvar_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(mode, id)
{
// Update var with Mode num
g_Mode = mode
// An unofficial mode
if(!(1 <= 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.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)
}
}