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.
This commit is contained in:
zaCade 2018-08-29 18:19:28 +02:00
parent eb16062d6a
commit ffb59ecca3

View File

@ -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]);
}
}
}