From 136309ae6f9e2c35ff6f5f5ccc28396404b0d20c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Gr=C3=BCnbacher?= Date: Thu, 1 May 2014 14:41:23 +0200 Subject: [PATCH] StatsX: Move hudstats formatting to own function --- plugins/cstrike/statsx.sma | 56 +++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/plugins/cstrike/statsx.sma b/plugins/cstrike/statsx.sma index 4e3b4aa8..10d8f7ef 100755 --- a/plugins/cstrike/statsx.sma +++ b/plugins/cstrike/statsx.sma @@ -844,6 +844,36 @@ format_stats(id, sBuffer[MAX_BUFFER_LENGTH + 1]) } } +// Format round end stats +format_roundend_hudstats() +{ + g_sAwardAndScore[0] = 0 + + // Create round awards. + if (ShowMostDisruptive) + add_most_disruptive(0, g_sAwardAndScore) + if (ShowBestScore) + add_best_score(0, g_sAwardAndScore) + + // Create round score. + // Compensate HUD message if awards are disabled. + if (ShowTeamScore || ShowTotalStats) + { + if (ShowMostDisruptive && ShowBestScore) + add(g_sAwardAndScore, charsmax(g_sAwardAndScore), "^n^n") + else if (ShowMostDisruptive || ShowBestScore) + add(g_sAwardAndScore, charsmax(g_sAwardAndScore), "^n^n^n^n") + else + add(g_sAwardAndScore, charsmax(g_sAwardAndScore), "^n^n^n^n^n^n") + + if (ShowTeamScore) + add_team_score(0, g_sAwardAndScore) + + if (ShowTotalStats) + add_total_stats(0, g_sAwardAndScore) + } +} + // Show round end stats. If gametime is zero then use default duration time. show_roundend_hudstats(id, Float:fGameTime) { @@ -1567,31 +1597,7 @@ endround_stats() } } - g_sAwardAndScore[0] = 0 - - // Create round awards. - if (ShowMostDisruptive) - add_most_disruptive(0, g_sAwardAndScore) - if (ShowBestScore) - add_best_score(0, g_sAwardAndScore) - - // Create round score. - // Compensate HUD message if awards are disabled. - if (ShowTeamScore || ShowTotalStats) - { - if (ShowMostDisruptive && ShowBestScore) - add(g_sAwardAndScore, charsmax(g_sAwardAndScore), "^n^n") - else if (ShowMostDisruptive || ShowBestScore) - add(g_sAwardAndScore, charsmax(g_sAwardAndScore), "^n^n^n^n") - else - add(g_sAwardAndScore, charsmax(g_sAwardAndScore), "^n^n^n^n^n^n") - - if (ShowTeamScore) - add_team_score(0, g_sAwardAndScore) - - if (ShowTotalStats) - add_total_stats(0, g_sAwardAndScore) - } + format_roundend_hudstats() save_team_chatscore(0)