UTIL HudMessage: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (→‎top: Unicodifying, replaced: See Also → See also)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{wrongtitle|UTIL_HudMessage}}
{{DISPLAYTITLE: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]]
'''See also:''' [[UTIL_HudMessageAll]]


== Usage ==
== Usage ==

Latest revision as of 02:08, 9 January 2024

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