UTIL_HudMessage

From Valve Developer Community
Jump to: navigation, search

UTIL_HudMessage is a UTIL provided to send a message to a specific player. It is only used for debugging purposes.


See also: UTIL_HudMessageAll

Usage

//-----------------------------------------------------------------------------
// Purpose: Calls UTIL_HudMessage for every player
// Input  : pToPlayer - CBasePlayer that will be used as a filter for CRecipientFilter.
// Input  : hudtextparmas_t - Text Parameters, size, location, color, etc. 
// Input  : pMessage - Message to send
// Output : 
//-----------------------------------------------------------------------------
void UTIL_HudMessage( CBasePlayer *pToPlayer, const hudtextparms_t &textparms, const char *pMessage )

Examples

// If we're in singleplayer, show the message to the player.
if ( gpGlobals->maxClients == 1 )
{
	CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
	UTIL_HudMessage( pPlayer, m_textParms, MessageGet() );
}
//Show the message to the player that triggered us.
else if ( pActivator && pActivator->IsNetClient() )
{
	UTIL_HudMessage( ToBasePlayer( pActivator ), m_textParms, MessageGet() );
}