UTIL GetLocalPlayer: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (otherlang2, -whitespace)
Line 1: Line 1:
{{otherlang2
{{otherlang2
|title=UTIL_GetLocalPlayer
|ru=UTIL_GetLocalPlayer:ru
|ru=UTIL_GetLocalPlayer:ru
}}
}}
{{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.
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.



Revision as of 23:21, 21 December 2012

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