core/PlayerManager.cpp
changeset 4217 4c87212c5817
parent 4188 89782d5fc91b
child 4277 7a4e68fa7c77
     1.1 --- a/core/PlayerManager.cpp	Wed Jan 29 13:07:50 2014 -0500
     1.2 +++ b/core/PlayerManager.cpp	Wed Jan 29 21:41:41 2014 -0700
     1.3 @@ -843,11 +843,13 @@
     1.4  		buffer[len] = '\0';
     1.5  	}
     1.6  
     1.7 -#if SOURCE_ENGINE == SE_DOTA
     1.8 -	engine->ClientPrintf(CEntityIndex(IndexOfEdict(e)), buffer);
     1.9 -#else
    1.10 -	engine->ClientPrintf(e, buffer);
    1.11 -#endif
    1.12 +	CPlayer *pPlayer = g_Players.GetPlayerByIndex(IndexOfEdict(e));
    1.13 +	if (!pPlayer)
    1.14 +	{
    1.15 +		return;
    1.16 +	}
    1.17 +	
    1.18 +	pPlayer->PrintToConsole(buffer);
    1.19  }
    1.20  
    1.21  void ListExtensionsToClient(CPlayer *player, const CCommand &args)
    1.22 @@ -2323,3 +2325,23 @@
    1.23  {
    1.24  	return m_Serial.value;
    1.25  }
    1.26 +
    1.27 +void CPlayer::PrintToConsole(const char *pMsg)
    1.28 +{
    1.29 +	if (m_IsConnected == false || m_bFakeClient == true)
    1.30 +	{
    1.31 +		return;
    1.32 +	}
    1.33 +
    1.34 +	INetChannel *pNetChan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(m_iIndex));
    1.35 +	if (pNetChan == NULL)
    1.36 +	{
    1.37 +		return;
    1.38 +	}
    1.39 +
    1.40 +#if SOURCE_ENGINE == SE_DOTA
    1.41 +	engine->ClientPrintf(m_iIndex, pMsg);
    1.42 +#else
    1.43 +	engine->ClientPrintf(m_pEdict, pMsg);
    1.44 +#endif
    1.45 +}