本文整理汇总了C++中CBasePlayer::CanHearAndReadChatFrom方法的典型用法代码示例。如果您正苦于以下问题:C++ CBasePlayer::CanHearAndReadChatFrom方法的具体用法?C++ CBasePlayer::CanHearAndReadChatFrom怎么用?C++ CBasePlayer::CanHearAndReadChatFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBasePlayer
的用法示例。
在下文中一共展示了CBasePlayer::CanHearAndReadChatFrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Host_Say
//.........这里部分代码省略.........
else
{
Q_snprintf( text, sizeof(text), "%s: ", pszPlayerName );
}
j = sizeof(text) - 2 - strlen(text); // -2 for /n and null terminator
if ( (int)strlen(p) > j )
p[j] = 0;
Q_strncat( text, p, sizeof( text ), COPY_ALL_CHARACTERS );
Q_strncat( text, "\n", sizeof( text ), COPY_ALL_CHARACTERS );
// loop through all players
// Start with the first player.
// This may return the world in single player if the client types something between levels or during spawn
// so check it, or it will infinite loop
client = NULL;
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
client = ToBaseMultiplayerPlayer( UTIL_PlayerByIndex( i ) );
if ( !client || !client->edict() )
continue;
if ( client->edict() == pEdict )
continue;
if ( !(client->IsNetClient()) ) // Not a client ? (should never be true)
continue;
if ( teamonly && g_pGameRules->PlayerCanHearChat( client, pPlayer ) != GR_TEAMMATE )
continue;
if ( pPlayer && !client->CanHearAndReadChatFrom( pPlayer ) )
continue;
if ( pPlayer && GetVoiceGameMgr() && GetVoiceGameMgr()->IsPlayerIgnoringPlayer( pPlayer->entindex(), i ) )
continue;
CSingleUserRecipientFilter user( client );
user.MakeReliable();
if ( pszFormat )
{
UTIL_SayText2Filter( user, pPlayer, true, pszFormat, pszPlayerName, p, pszLocation );
}
else
{
UTIL_SayTextFilter( user, text, pPlayer, true );
}
}
if ( pPlayer )
{
// print to the sending client
CSingleUserRecipientFilter user( pPlayer );
user.MakeReliable();
if ( pszFormat )
{
UTIL_SayText2Filter( user, pPlayer, true, pszFormat, pszPlayerName, p, pszLocation );
}
else
{
UTIL_SayTextFilter( user, text, pPlayer, true );
}