UTIL GetLocalPlayer: Difference between revisions
Jump to navigation
Jump to search
m (otherlang2, -whitespace) |
m (Added lang.) |
||
Line 1: | Line 1: | ||
{{ | {{lang|UTIL GetLocalPlayer|title=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. | ||
| | |||
}} | |||
'''See: '''[[GetLocalPlayer]] for Multiplayer games. | '''See: '''[[GetLocalPlayer]] for Multiplayer games. |
Revision as of 07:38, 6 January 2022
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();