mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-06 18:08:26 +00:00
Added shavit_hud_speclist for HUD's spectator list.
Who to show in the spectators list? * 0 - everyone * 1 - all admins (admin_speclisthide override shavit_misc_speclist to bypass) * 2 - players you can target
This commit is contained in:
parent
7e5f9c7c85
commit
cc6b622d54
@ -64,10 +64,12 @@ Handle gH_HUD = null;
|
||||
// plugin cvars
|
||||
ConVar gCV_GradientStepSize = null;
|
||||
ConVar gCV_TicksPerUpdate = null;
|
||||
ConVar gCV_SpectatorList = null;
|
||||
|
||||
// cached cvars
|
||||
int gI_GradientStepSize = 5;
|
||||
int gI_TicksPerUpdate = 5;
|
||||
int gI_SpectatorList = 1;
|
||||
|
||||
// timer settings
|
||||
char gS_StyleStrings[STYLE_LIMIT][STYLESTRINGS_SIZE][128];
|
||||
@ -133,9 +135,11 @@ public void OnPluginStart()
|
||||
// plugin convars
|
||||
gCV_GradientStepSize = CreateConVar("shavit_hud_gradientstepsize", "15", "How fast should the start/end HUD gradient be?\nThe number is the amount of color change per 0.1 seconds.\nThe higher the number the faster the gradient.", 0, true, 1.0, true, 255.0);
|
||||
gCV_TicksPerUpdate = CreateConVar("shavit_hud_ticksperupdate", "5", "How often (in ticks) should the HUD update?\nPlay around with this value until you find the best for your server.\nThe maximum value is your tickrate.", 0, true, 1.0, true, (1.0 / GetTickInterval()));
|
||||
gCV_SpectatorList = CreateConVar("shavit_hud_speclist", "1", "Who to show in the specators list?\n0 - everyone\n1 - all admins (admin_speclisthide override to bypass)\n2 - players you can target", 0, true, 0.0, true, 2.0);
|
||||
|
||||
gCV_GradientStepSize.AddChangeHook(OnConVarChanged);
|
||||
gCV_TicksPerUpdate.AddChangeHook(OnConVarChanged);
|
||||
gCV_SpectatorList.AddChangeHook(OnConVarChanged);
|
||||
|
||||
AutoExecConfig();
|
||||
|
||||
@ -167,6 +171,7 @@ public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] n
|
||||
{
|
||||
gI_GradientStepSize = gCV_GradientStepSize.IntValue;
|
||||
gI_TicksPerUpdate = gCV_TicksPerUpdate.IntValue;
|
||||
gI_SpectatorList = gCV_SpectatorList.IntValue;
|
||||
}
|
||||
|
||||
public void OnMapStart()
|
||||
@ -972,18 +977,18 @@ void UpdateSpectatorList(int client, Panel panel, bool &draw)
|
||||
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if(i == client || !IsValidClient(i) || IsFakeClient(i) || !IsClientObserver(i) || GetEntPropEnt(i, Prop_Send, "m_hObserverTarget") != target || GetClientTeam(i) < 1
|
||||
|| (!bIsAdmin && CheckCommandAccess(i, "admin_speclisthide", ADMFLAG_KICK)))
|
||||
if(!IsValidClient(i) || IsFakeClient(i) || !IsClientObserver(i) || GetClientTeam(i) < 1 || GetHUDTarget(i) != client)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int iObserverMode = GetEntProp(i, Prop_Send, "m_iObserverMode");
|
||||
|
||||
if(iObserverMode >= 3 && iObserverMode <= 5)
|
||||
if((gI_SpectatorList == 1 && !bIsAdmin && CheckCommandAccess(i, "admin_speclisthide", ADMFLAG_KICK)) ||
|
||||
(gI_SpectatorList == 2 && !CanUserTarget(client, i)))
|
||||
{
|
||||
iSpectatorClients[iSpectators++] = i;
|
||||
continue;
|
||||
}
|
||||
|
||||
iSpectatorClients[iSpectators++] = i;
|
||||
}
|
||||
|
||||
if(iSpectators > 0)
|
||||
|
||||
@ -321,7 +321,7 @@ public void OnPluginStart()
|
||||
gCV_ResetTargetname = CreateConVar("shavit_misc_resettargetname", "0", "Reset the player's targetname upon timer start?\nRecommended to leave disabled. Enable via per-map configs when necessary.\n0 - Disabled\n1 - Enabled", 0, true, 0.0, true, 1.0);
|
||||
gCV_RestoreStates = CreateConVar("shavit_misc_restorestates", "0", "Save the players' timer/position etc.. when they die/change teams,\nand load the data when they spawn?\n0 - Disabled\n1 - Enabled", 0, true, 0.0, true, 1.0);
|
||||
gCV_JointeamHook = CreateConVar("shavit_misc_jointeamhook", "1", "Hook `jointeam`?\n0 - Disabled\n1 - Enabled, players can instantly change teams.", 0, true, 0.0, true, 1.0);
|
||||
gCV_SpectatorList = CreateConVar("shavit_misc_speclist", "1", "Who to show in !specs?\n0 - everyone\n1 - all admins (admin_speclisthide override shavit_misc_speclist to bypass)\n2 - players you can target", 0, true, 0.0, true, 2.0);
|
||||
gCV_SpectatorList = CreateConVar("shavit_misc_speclist", "1", "Who to show in !specs?\n0 - everyone\n1 - all admins (admin_speclisthide override to bypass)\n2 - players you can target", 0, true, 0.0, true, 2.0);
|
||||
|
||||
gCV_GodMode.AddChangeHook(OnConVarChanged);
|
||||
gCV_PreSpeed.AddChangeHook(OnConVarChanged);
|
||||
@ -2150,7 +2150,7 @@ public Action Command_Specs(int client, int args)
|
||||
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if(!IsValidClient(i) || IsFakeClient(i) || !IsClientObserver(i))
|
||||
if(!IsValidClient(i) || IsFakeClient(i) || !IsClientObserver(i) || GetClientTeam(i) < 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user