Skip to content

Commit e11a744

Browse files
committed
Fix exact name matching being unreliable with clan tags
1 parent a901534 commit e11a744

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/playermanager.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,13 @@ ETargetError CPlayerManager::GetPlayersFromString(CCSPlayerController* pPlayer,
15901590
if (!pTarget || !pTarget->IsController() || !pTarget->IsConnected() || pTarget->m_bIsHLTV)
15911591
continue;
15921592

1593-
if ((!bExactName && V_stristr(pTarget->GetPlayerName(), pszTarget)) || !V_strcmp(pTarget->GetPlayerName(), pszTarget))
1593+
std::string strName = pTarget->GetPlayerName();
1594+
1595+
// Ignore space that might be added by clan tag name swap trick
1596+
if (!strName.empty() && strName.back() == ' ')
1597+
strName.pop_back();
1598+
1599+
if ((!bExactName && V_stristr(strName.c_str(), pszTarget)) || !V_strcmp(strName.c_str(), pszTarget))
15941600
{
15951601
nType = ETargetType::PLAYER;
15961602
if (iNumClients == 1)

0 commit comments

Comments
 (0)