Skip to content

Commit

Permalink
Replace IsPlayerAlive with TTT_IsPlayerAlive in talk override plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Bara committed Oct 19, 2018
1 parent f6e8577 commit 3c5a568
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions addons/sourcemod/scripting/ttt/ttt_talk_override.sp
Expand Up @@ -45,6 +45,16 @@ public void OnPluginStart()
LoadTranslations("ttt.phrases");
}

public void OnClientPutInServer(int client)
{
g_bTVoice[client] = false;
}

public void OnClientDisconnect(int client)
{
g_bTVoice[client] = false;
}

public void OnConfigsExecuted()
{
g_cPluginTag = FindConVar("ttt_plugin_tag");
Expand Down Expand Up @@ -72,7 +82,7 @@ public Action Command_TVoice(int client, int args)
return Plugin_Handled;
}

if (!IsPlayerAlive(client))
if (!TTT_IsPlayerAlive(client))
{
return Plugin_Handled;
}
Expand All @@ -85,10 +95,13 @@ public Action Command_TVoice(int client, int args)
if (g_bTVoice[client])
{
CPrintToChat(client, "%s %T", g_sPluginTag, "Traitor Voice Chat: Disabled!", client);

g_bTVoice[client] = false;

LoopValidClients(i)
{
SetListenOverride(i, client, Listen_Yes);

if (TTT_GetClientRole(i) == TTT_TEAM_TRAITOR)
{
CPrintToChat(i, "%s %T", g_sPluginTag, "stopped talking in Traitor Voice Chat", i, client);
Expand All @@ -98,7 +111,9 @@ public Action Command_TVoice(int client, int args)
else
{
g_bTVoice[client] = true;

CPrintToChat(client, "%s %T", g_sPluginTag, "Traitor Voice Chat: Enabled!", client);

LoopValidClients(i)
{
if (TTT_GetClientRole(i) != TTT_TEAM_TRAITOR)
Expand Down Expand Up @@ -146,7 +161,7 @@ public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadca
g_bTVoice[victim] = false;
LoopValidClients(i)
{
if (IsPlayerAlive(i))
if (TTT_IsPlayerAlive(i))
{
SetListenOverride(i, victim, Listen_No);
}
Expand Down Expand Up @@ -193,9 +208,9 @@ void SetListen(int client)
{
LoopValidClients(i)
{
if (!IsPlayerAlive(client))
if (!TTT_IsPlayerAlive(client))
{
if (IsPlayerAlive(i))
if (TTT_IsPlayerAlive(i))
{
SetListenOverride(i, client, Listen_No);
SetListenOverride(client, i, Listen_Yes);
Expand Down

0 comments on commit 3c5a568

Please sign in to comment.