From 09b95aa6ab432a60b402e09a8851e46920616f32 Mon Sep 17 00:00:00 2001 From: Vincent Herbet Date: Thu, 11 Oct 2018 11:12:06 +0200 Subject: [PATCH] CS Miscstats: Fix enemy remaining option displaying the message to the wrong team (#611) --- plugins/cstrike/miscstats.sma | 76 +++++++++++------------------------ plugins/lang/miscstats.txt | 6 +++ 2 files changed, 29 insertions(+), 53 deletions(-) diff --git a/plugins/cstrike/miscstats.sma b/plugins/cstrike/miscstats.sma index 89ecb000..c3ac3db0 100755 --- a/plugins/cstrike/miscstats.sma +++ b/plugins/cstrike/miscstats.sma @@ -13,6 +13,7 @@ #include #include +#include #include public MultiKill @@ -81,9 +82,6 @@ new g_pcvar_mp_c4timer, g_c4timer_value const TASK_BOMB_TIMER = 8038 const TASK_DELAYED_NEW_ROUND = 98038 -const TEAM_T = 1 -const TEAM_CT = 2 - new g_connected[MAX_PLAYERS + 1] new g_msounds[MAX_PLAYERS + 1] new const _msound[] = "_msound" @@ -178,13 +176,7 @@ new g_HeadShots[7][] = "HS_MSG_7" } -new g_teamsNames[4][] = -{ - "TERRORIST", - "CT", - "TERRORISTS", - "CTS" -} +new const g_teamsNames[CsTeams][] = { "", "TERRORIST" , "CT", "" }; public plugin_init() { @@ -543,48 +535,26 @@ public client_death(killer, victim, wpnindex, hitplace, TK) } } - new team = get_user_team(victim) - if (EnemyRemaining && is_user_connected(victim)) + new const CsTeams:team = cs_get_user_team(victim); + + if (EnemyRemaining && CS_TEAM_T <= team <= CS_TEAM_CT && is_user_connected(victim)) { - if( TEAM_T <= team <= TEAM_CT ) + new const victimTeammatesCount = get_playersnum_ex(GetPlayers_ExcludeDead | GetPlayers_MatchTeam, g_teamsNames[team]); + + if (victimTeammatesCount) { - new ppl[MAX_PLAYERS], pplnum, epplnum, a - get_players(ppl, epplnum, "ae", team == TEAM_T ? "CT" : "TERRORIST") - get_players(ppl, pplnum, "ae", team == TEAM_T ? "TERRORIST" : "CT") - if( victim_alive ) - { - for(a=0; a 1 ? + ShowSyncHudMsg(killerTeammatesList[teammate], g_bottom_sync, "%l", "REMAINING_ENEMIES", victimTeammatesCount) : + ShowSyncHudMsg(killerTeammatesList[teammate], g_bottom_sync, "%l","REMAINING_ENEMY"); } } } @@ -600,7 +570,7 @@ public client_death(killer, victim, wpnindex, hitplace, TK) { switch( team ) { - case TEAM_T: + case CS_TEAM_T: { for(b=0; b 1) { g_LastAnnounce = cts[0] oposite = tsnum - _team = 0 + _team = CS_TEAM_T } else if (tsnum == 1 && ctsnum > 1) { g_LastAnnounce = ts[0] oposite = ctsnum - _team = 1 + _team = CS_TEAM_CT } if (g_LastAnnounce) @@ -818,7 +788,7 @@ public showStatus(id) get_user_name(pid, name, charsmax(name)) new color1 = 0, color2 = 0 - if (get_user_team(pid) == TEAM_T) + if (cs_get_user_team(pid) == CS_TEAM_T) color1 = 255 else color2 = 255 diff --git a/plugins/lang/miscstats.txt b/plugins/lang/miscstats.txt index 919fc884..1f09067e 100755 --- a/plugins/lang/miscstats.txt +++ b/plugins/lang/miscstats.txt @@ -42,6 +42,8 @@ CTS = CTS TERRORIST = TERRORIST TERRORISTS = TERRORISTS REMAINING = %d %s Remaining... +REMAINING_ENEMY = One enemy remaining... +REMAINING_ENEMIES = %d enemies remaining... KILLS = kills HS = hs @@ -136,6 +138,8 @@ CTS = CTS TERRORIST = TERORISTA TERRORISTS = TERORISTA REMAINING = %d %s Preostalo... +REMAINING_ENEMY = Jedan preostali protivnika... +REMAINING_ENEMIES = %d preostalih protivnika... KILLS = ubistava HS = hs @@ -230,6 +234,8 @@ CTS = CTS TERRORIST = TERRORISTE TERRORISTS = TERRORISTES REMAINING = %d %s Restant... +REMAINING_ENEMY = Dernier ennemi restant... +REMAINING_ENEMIES = %d ennemis restants... KILLS = frags HS = hs