CS Miscstats: Fix enemy remaining option displaying the message to the wrong team (#611)

This commit is contained in:
Vincent Herbet 2018-10-11 11:12:06 +02:00 committed by Arkshine
parent a0ea98da35
commit 09b95aa6ab
2 changed files with 29 additions and 53 deletions

View File

@ -13,6 +13,7 @@
#include <amxmodx> #include <amxmodx>
#include <amxmisc> #include <amxmisc>
#include <cstrike>
#include <csx> #include <csx>
public MultiKill public MultiKill
@ -81,9 +82,6 @@ new g_pcvar_mp_c4timer, g_c4timer_value
const TASK_BOMB_TIMER = 8038 const TASK_BOMB_TIMER = 8038
const TASK_DELAYED_NEW_ROUND = 98038 const TASK_DELAYED_NEW_ROUND = 98038
const TEAM_T = 1
const TEAM_CT = 2
new g_connected[MAX_PLAYERS + 1] new g_connected[MAX_PLAYERS + 1]
new g_msounds[MAX_PLAYERS + 1] new g_msounds[MAX_PLAYERS + 1]
new const _msound[] = "_msound" new const _msound[] = "_msound"
@ -178,13 +176,7 @@ new g_HeadShots[7][] =
"HS_MSG_7" "HS_MSG_7"
} }
new g_teamsNames[4][] = new const g_teamsNames[CsTeams][] = { "", "TERRORIST" , "CT", "" };
{
"TERRORIST",
"CT",
"TERRORISTS",
"CTS"
}
public plugin_init() public plugin_init()
{ {
@ -543,48 +535,26 @@ public client_death(killer, victim, wpnindex, hitplace, TK)
} }
} }
new team = get_user_team(victim) new const CsTeams:team = cs_get_user_team(victim);
if (EnemyRemaining && is_user_connected(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 new killerTeammatesList[MAX_PLAYERS], killerTeammatesCount;
get_players(ppl, epplnum, "ae", team == TEAM_T ? "CT" : "TERRORIST") get_players_ex(killerTeammatesList, killerTeammatesCount, GetPlayers_ExcludeDead | GetPlayers_MatchTeam, g_teamsNames[CsTeams:(any:team % 2 + 1)]);
get_players(ppl, pplnum, "ae", team == TEAM_T ? "TERRORIST" : "CT")
if( victim_alive ) if (killerTeammatesCount)
{ {
for(a=0; a<pplnum; a++) set_hudmessage(255, 255, 255, 0.02, 0.85, 2, 0.05, 0.1, 0.02, 3.0, -1);
for (new teammate; teammate < killerTeammatesCount; ++teammate)
{ {
if( ppl[a] == victim ) victimTeammatesCount > 1 ?
{ ShowSyncHudMsg(killerTeammatesList[teammate], g_bottom_sync, "%l", "REMAINING_ENEMIES", victimTeammatesCount) :
ppl[a] = ppl[--pplnum] ShowSyncHudMsg(killerTeammatesList[teammate], g_bottom_sync, "%l","REMAINING_ENEMY");
break
}
}
}
if (pplnum && epplnum)
{
new message[128], team_name[32]
set_hudmessage(255, 255, 255, 0.02, 0.85, 2, 0.05, 0.1, 0.02, 3.0, -1)
/* This is a pretty stupid thing to translate, but whatever */
new _teamname[32]
if (team == TEAM_T)
{
formatex(_teamname, charsmax(_teamname), "TERRORIST%s", (epplnum == 1) ? "" : "S")
} else {
formatex(_teamname, charsmax(_teamname), "CT%s", (epplnum == 1) ? "" : "S")
}
new id
for (a = 0; a < pplnum; ++a)
{
id = ppl[a]
formatex(team_name, charsmax(team_name), "%L", id, _teamname)
formatex(message, charsmax(message), "%L", id, "REMAINING", epplnum, team_name)
ShowSyncHudMsg(id, g_bottom_sync, "%s", message)
} }
} }
} }
@ -600,7 +570,7 @@ public client_death(killer, victim, wpnindex, hitplace, TK)
{ {
switch( team ) switch( team )
{ {
case TEAM_T: case CS_TEAM_T:
{ {
for(b=0; b<tsnum; b++) for(b=0; b<tsnum; b++)
{ {
@ -611,7 +581,7 @@ public client_death(killer, victim, wpnindex, hitplace, TK)
} }
} }
} }
case TEAM_CT: case CS_TEAM_CT:
{ {
for(b=0; b<ctsnum; b++) for(b=0; b<ctsnum; b++)
{ {
@ -653,19 +623,19 @@ public client_death(killer, victim, wpnindex, hitplace, TK)
} }
else if (!g_LastAnnounce) else if (!g_LastAnnounce)
{ {
new oposite = 0, _team = 0 new oposite = 0, CsTeams:_team
if (ctsnum == 1 && tsnum > 1) if (ctsnum == 1 && tsnum > 1)
{ {
g_LastAnnounce = cts[0] g_LastAnnounce = cts[0]
oposite = tsnum oposite = tsnum
_team = 0 _team = CS_TEAM_T
} }
else if (tsnum == 1 && ctsnum > 1) else if (tsnum == 1 && ctsnum > 1)
{ {
g_LastAnnounce = ts[0] g_LastAnnounce = ts[0]
oposite = ctsnum oposite = ctsnum
_team = 1 _team = CS_TEAM_CT
} }
if (g_LastAnnounce) if (g_LastAnnounce)
@ -818,7 +788,7 @@ public showStatus(id)
get_user_name(pid, name, charsmax(name)) get_user_name(pid, name, charsmax(name))
new color1 = 0, color2 = 0 new color1 = 0, color2 = 0
if (get_user_team(pid) == TEAM_T) if (cs_get_user_team(pid) == CS_TEAM_T)
color1 = 255 color1 = 255
else else
color2 = 255 color2 = 255

View File

@ -42,6 +42,8 @@ CTS = CTS
TERRORIST = TERRORIST TERRORIST = TERRORIST
TERRORISTS = TERRORISTS TERRORISTS = TERRORISTS
REMAINING = %d %s Remaining... REMAINING = %d %s Remaining...
REMAINING_ENEMY = One enemy remaining...
REMAINING_ENEMIES = %d enemies remaining...
KILLS = kills KILLS = kills
HS = hs HS = hs
@ -136,6 +138,8 @@ CTS = CTS
TERRORIST = TERORISTA TERRORIST = TERORISTA
TERRORISTS = TERORISTA TERRORISTS = TERORISTA
REMAINING = %d %s Preostalo... REMAINING = %d %s Preostalo...
REMAINING_ENEMY = Jedan preostali protivnika...
REMAINING_ENEMIES = %d preostalih protivnika...
KILLS = ubistava KILLS = ubistava
HS = hs HS = hs
@ -230,6 +234,8 @@ CTS = CTS
TERRORIST = TERRORISTE TERRORIST = TERRORISTE
TERRORISTS = TERRORISTES TERRORISTS = TERRORISTES
REMAINING = %d %s Restant... REMAINING = %d %s Restant...
REMAINING_ENEMY = Dernier ennemi restant...
REMAINING_ENEMIES = %d ennemis restants...
KILLS = frags KILLS = frags
HS = hs HS = hs