UTIL_GetLocalPlayer
Jump to navigation
Jump to search
This article needs more links to other pages (since January 2024). You can help improve navigation by adding links to related documentation, such as entities or tools.
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();