From ffb59ecca33b5b4186957644f6d6e6bc05c4ad1e Mon Sep 17 00:00:00 2001 From: zaCade Date: Wed, 29 Aug 2018 18:19:28 +0200 Subject: [PATCH] TopDefenders: Add a loop that compares deaths. So it only modifies the deaths when ever thats needed, the csgo scoreboard seems to flip the fuck out otherwise. --- TopDefenders/scripting/TopDefenders.sp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/TopDefenders/scripting/TopDefenders.sp b/TopDefenders/scripting/TopDefenders.sp index 2d6f09f5..b9b9af6a 100644 --- a/TopDefenders/scripting/TopDefenders.sp +++ b/TopDefenders/scripting/TopDefenders.sp @@ -299,6 +299,7 @@ public int SortDefendersList(int[] elem1, int[] elem2, const int[][] array, Hand //---------------------------------------------------------------------------------------------------- public Action UpdateScoreboard(Handle timer) { + int iDeathsList[MAXPLAYERS+1]; int iSortedList[MAXPLAYERS+1][2]; int iSortedCount; @@ -307,7 +308,7 @@ public Action UpdateScoreboard(Handle timer) if (!IsClientInGame(client)) continue; - SetEntProp(client, Prop_Data, "m_iDeaths", 0); + iDeathsList[client] = 0; if (!g_iPlayerDamage[client]) continue; @@ -321,7 +322,18 @@ public Action UpdateScoreboard(Handle timer) for (int rank = 0; rank < iSortedCount; rank++) { - SetEntProp(iSortedList[rank][0], Prop_Data, "m_iDeaths", rank + 1); + iDeathsList[iSortedList[rank][0]] = rank + 1; + } + + for (int client = 1; client <= MaxClients; client++) + { + if (!IsClientInGame(client)) + continue; + + if (GetEntProp(client, Prop_Data, "m_iDeaths") != iDeathsList[client]) + { + SetEntProp(client, Prop_Data, "m_iDeaths", iDeathsList[client]); + } } }