Permalink
Browse files

Reset skin on player_death

  • Loading branch information...
Bara committed Dec 23, 2018
1 parent 32c54e0 commit 19c53dcb95e0aab6bf4f3ff421b3c0fac6639969
Showing with 29 additions and 0 deletions.
  1. +29 −0 addons/sourcemod/scripting/ttt/ttt_glow.sp
@@ -49,6 +49,8 @@ public void OnPluginStart()
TTT_EndConfig();

g_bCPS = LibraryExists("CustomPlayerSkins");

HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre);
}

public void TTT_OnLatestVersion(const char[] version)
@@ -95,6 +97,33 @@ public void OnConfigsExecuted()
}
}

public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));

if (TTT_IsClientValid(client))
{
int iSkin = CPS_GetSkin(client);

if (IsValidEntity(iSkin))
{
SetEntProp(iSkin, Prop_Send, "m_bShouldGlow", false, true);

int iOffset = -1;

if ((iOffset = GetEntSendPropOffs(iSkin, "m_clrGlow")) == -1)
{
return;
}

SetEntData(iSkin, iOffset, 0, _, true);
SetEntData(iSkin, iOffset + 1, 0, _, true);
SetEntData(iSkin, iOffset + 2, 0, _, true);
SetEntData(iSkin, iOffset + 3, 0, _, true);
}
}
}

public Action Timer_SetupGlow(Handle timer, any data)
{
if(!TTT_IsRoundActive())

0 comments on commit 19c53dc

Please sign in to comment.