Difference between revisions of "UTIL HudMessage"

From Valve Developer Community
Jump to: navigation, search
(Created Page)
 
Line 1: Line 1:
 
{{wrongtitle|UTIL_HudMessage}}
 
{{wrongtitle|UTIL_HudMessage}}
 
'''UTIL_HudMessage''' is a [[UTIL]] provided to send a message to a specific player. It is only used for [[debugging]] purposes.
 
'''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 ==
 
== Usage ==

Revision as of 20:55, 10 April 2011

Template:Wrongtitle 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() );
}