add HUD_SPECTATORSDEAD

This commit is contained in:
rtldg 2022-05-17 02:37:41 +00:00
parent bc62b92983
commit 22a68b491b
3 changed files with 23 additions and 1 deletions

View File

@ -40,6 +40,7 @@
#define HUD_USP (1 << 13) // makes you spawn with a USP
#define HUD_GLOCK (1 << 14) // makes you spawn with a Glock
#define HUD_DEBUGTARGETNAME (1 << 15) // admin option to show current targetname & classname
#define HUD_SPECTATORSDEAD (1 << 16) // for only showing spectators list when you're dead/spectating.
// HUD2 - these settings will *disable* elements for the main hud
#define HUD2_TIME (1 << 0)

View File

@ -203,6 +203,7 @@ public void OnPluginStart()
..."HUD_NOPRACALERT 4096\n"
..."HUD_USP 8192\n"
..."HUD_GLOCK 16384\n"
..."HUD_SPECTATORSDEAD 65536\n"
);
IntToString(HUD_DEFAULT2, defaultHUD, 8);
@ -223,6 +224,7 @@ public void OnPluginStart()
..."HUD2_VELOCITYDIFFERENCE 8192\n"
..."HUD2_USPSILENCER 16384\n"
..."HUD2_GLOCKBURST 32768\n"
..."HUD2_CENTERKEYS 65536\n"
);
Convar.AutoExecConfig();
@ -688,6 +690,10 @@ Action ShowHUDMenu(int client, int item)
FormatEx(sHudItem, 64, "%T", "HudSpectators", client);
menu.AddItem(sInfo, sHudItem);
FormatEx(sInfo, 16, "!%d", HUD_SPECTATORSDEAD);
FormatEx(sHudItem, 64, "%T", "HudSpectatorsDead", client);
menu.AddItem(sInfo, sHudItem);
FormatEx(sInfo, 16, "!%d", HUD_KEYOVERLAY);
FormatEx(sHudItem, 64, "%T", "HudKeyOverlay", client);
menu.AddItem(sInfo, sHudItem);
@ -1154,6 +1160,11 @@ void TriggerHUDUpdate(int client, bool keysonly = false) // keysonly because CS:
&& (GetClientMenu(client, null) == MenuSource_None || GetClientMenu(client, null) == MenuSource_RawPanel)
)
{
if (gI_HUDSettings[client] & HUD_SPECTATORSDEAD && IsPlayerAlive(client))
{
return;
}
bool bShouldDraw = false;
Panel pHUD = new Panel();
@ -2046,6 +2057,12 @@ void UpdateSpectatorList(int client, Panel panel, bool &draw)
return;
}
if (gI_HUDSettings[client] & HUD_SPECTATORSDEAD && IsPlayerAlive(client))
{
return;
}
int target = GetSpectatorTarget(client, client);
if(((gI_HUDSettings[client] & HUD_OBSERVE) == 0 && client != target))
@ -2276,7 +2293,7 @@ void UpdateKeyHint(int client)
}
}
if((gI_HUDSettings[client] & HUD_SPECTATORS) > 0)
if ((gI_HUDSettings[client] & HUD_SPECTATORS) > 0 && (!(gI_HUDSettings[client] & HUD_SPECTATORSDEAD) || !IsPlayerAlive(client)))
{
int iSpectatorClients[MAXPLAYERS+1];
int iSpectators = 0;

View File

@ -129,6 +129,10 @@
{
"en" "Spectator list"
}
"HudSpectatorsDead"
{
"en" "Spectator list (only when dead)"
}
"HudKeyOverlay"
{
"en" "Key display"