UTIL GetLocalPlayer: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (→‎top: clean up, added underlinked tag)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{otherlang2
{{Underlinked|date=January 2024}}
|ru=UTIL_GetLocalPlayer:ru
{{lang|UTIL GetLocalPlayer|title=UTIL_GetLocalPlayer}}
}}
{{ent|UTIL_GetLocalPlayer}} is a [[UTIL]] provided in the Source code for finding the local player. If it is a single player game, it returns the local player. Otherwise, it returns NULL.
 
{{DISPLAYTITLE:UTIL_GetLocalPlayer}}
UTIL_GetLocalPlayer is a [[UTIL]] provided in the Source code for finding the local player. If it is a single player game, it returns the local player. Otherwise, it returns NULL.


'''See: '''[[GetLocalPlayer]] for Multiplayer games.
'''See: '''[[GetLocalPlayer]] for Multiplayer games.

Latest revision as of 01:22, 6 January 2024

Underlinked - Logo.png
This article needs more Wikipedia icon links to other articles to help Wikipedia icon integrate it into the encyclopedia. Please help improve this article by adding links Wikipedia icon that are relevant to the context within the existing text.
January 2024
English (en)Русский (ru)Translate (Translate)

UTIL_GetLocalPlayer is a UTIL provided in the Source code for finding the local player. If it is a single player game, it returns the local player. Otherwise, it returns NULL.

See: GetLocalPlayer for Multiplayer games.

Usage

//-----------------------------------------------------------------------------
// Purpose: Returns the local player if in Single player, otherwise NULL.
//          
// Input  : 
// Output : CBasePlayer*
//-----------------------------------------------------------------------------
UTIL_GetLocalPlayer()

Examples

CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
if ( pPlayer )
{
    //Do something
}
Vector vecPlayerCenter = UTIL_GetLocalPlayer()->WorldSpaceCenter();