UTIL GetLocalPlayer
< Ru
Jump to navigation
Jump to search

This article needs more
links to other articles to help
integrate it into the encyclopedia. Please help improve this article by adding links
that are relevant to the context within the existing text.
January 2024



January 2024
UTIL_GetLocalPlayer это UTIL , используемый в Source Engine для нахождения локального игрока. Если игра запущена в одиночном режиме, возвращается указатель на структуру локального игрока. Если нет, возвращается NULL.
Использование
//-----------------------------------------------------------------------------
// Цель: Возвращается указатель на игрока если игра запущена в одиночном режиме, если нет - NULL.
//
// Ввод :
// Вывод : CBasePlayer*
//-----------------------------------------------------------------------------
UTIL_GetLocalPlayer()
Пример
CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
if ( pPlayer )
{
// Любое действие
}
Vector vecPlayerCenter = UTIL_GetLocalPlayer()->WorldSpaceCenter();