Permalink
Browse files

Show target's role overlay

This requires ttt_icon and ttt_dead_players_can_see_other_roles 1
  • Loading branch information...
Bara committed Jun 10, 2018
1 parent 736dbb5 commit 3e16b2a956779f2716d1f58dcc21ce7058fa39ae
Showing with 23 additions and 2 deletions.
  1. +23 −2 addons/sourcemod/scripting/ttt/ttt_overlay.sp
@@ -8,6 +8,9 @@
#define PLUGIN_NAME TTT_PLUGIN_NAME ... " - Overlays"
#define SPECMODE_FIRSTPERSON 4
#define SPECMODE_3RDPERSON 5
public Plugin myinfo =
{
name = PLUGIN_NAME,
@@ -304,12 +307,30 @@ public void AssignOverlay(int client, int role)
TTT_ShowOverlayToClient(client, " ");
}
if (!IsPlayerAlive(client))
if (!TTT_IsPlayerAlive(client))
{
TTT_ShowOverlayToClient(client, " ");
}
// ToDo Get Spec Mode and get Cvar ttt_dead_players_can_see_other_roles
ConVar cvar = FindConVar("ttt_dead_players_can_see_other_roles");

This comment has been minimized.

@c0rp3n

c0rp3n Jun 14, 2018

Would it not be better to keep this ConVar global as it is used very often, thus no point of fetching it every time this function is called.

This comment has been minimized.

@Bara

Bara Jun 14, 2018

Owner

You're right. I'll change it when I've more time.

if (cvar != null)
{
if (cvar.BoolValue && !TTT_IsPlayerAlive(client))
{
int iMode = GetEntProp(client, Prop_Send, "m_iObserverMode");
if (iMode == SPECMODE_FIRSTPERSON || iMode == SPECMODE_3RDPERSON)
{
int target = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
if (TTT_IsClientValid(target) && TTT_IsPlayerAlive(target))
{
role = TTT_GetClientRole(target);
}
}
}
}
char sBuffer[PLATFORM_MAX_PATH];
if (role == TTT_TEAM_DETECTIVE)

1 comment on commit 3e16b2a

@c0rp3n

This comment has been minimized.

c0rp3n commented on 3e16b2a Jun 15, 2018

I can sort it.

Please sign in to comment.