Code: Select all
public ShowHUD(taskid)
{
static id
id = ID_SHOWHUD;
// Player died?
if (!g_isalive[id])
{
// Get spectating target
id = pev(id, PEV_SPEC_TARGET)
// Target not alive
if (!g_isalive[id]) return;
}
// Format classname
static class[32], red, green, blue
if (g_zombie[id]) // zombies
{
red = 255
green = 0
blue = 0
if (g_nemesis[id])
formatex(class, charsmax(class), "%L", ID_SHOWHUD, "CLASS_NEMESIS")
else if (g_assassin[id])
formatex(class, charsmax(class), "%L", ID_SHOWHUD, "CLASS_ASSASSIN")
else
copy(class, charsmax(class), g_zombie_classname[id])
}
else // humans
{
red = 255
green = 0
blue = 0
if (g_survivor[id])
formatex(class, charsmax(class), "%L", ID_SHOWHUD, "CLASS_SURVIVOR")
else if (g_sniper[id])
formatex(class, charsmax(class), "%L", ID_SHOWHUD, "CLASS_SNIPER")
else
formatex(class, charsmax(class), "%L", ID_SHOWHUD, "CLASS_HUMAN")
}
// Spectating someone else?
if (id != ID_SHOWHUD)
{
// Show name, mode, health, class and ammo packs
set_hudmessage(255, 255, 255, HUD_SPECT_X, HUD_SPECT_Y, 1, 6.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync2, "[ %L %s | Mode: %s ]^n[ HP: %d | %L %s | %L %d | %L %d ]", ID_SHOWHUD, "SPECTATING", g_playername[id], g_mode_names[g_currentmode], pev(id, pev_health), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[id], ID_SHOWHUD, "ARMOR", pev(id, pev_armorvalue))
}
else
{
// Show health, class and ammo packs
switch(get_pcvar_num(cvar_huddisplaytype))
{
case 1:
{
set_hudmessage(red, green, blue, 0.02, 0.9, 0, 0.1, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync2, "[ %L: %d | %L %s | %L %d | %L: %d ]", id, "ZOMBIE_ATTRIB1", pev(ID_SHOWHUD, pev_health), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[ID_SHOWHUD], ID_SHOWHUD, "ARMOR", pev(id, pev_armorvalue))
}
case 2:
{
set_dhudmessage(random_num(0, 0), random_num(255, 0), random_num(0, 0), -1.0, -0.06, 0, 6.0, 1.1, 0.0, 0.0)
show_dhudmessage(ID_SHOWHUD, "%L: %d | %L %s | %L %d | %L: %d", id, "ZOMBIE_ATTRIB1", pev(ID_SHOWHUD, pev_health), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[ID_SHOWHUD], ID_SHOWHUD, "ARMOR", pev(id, pev_armorvalue))
}
}
}
}