From 987768abbf2f83933435175a3b2bdeeb0c5630f1 Mon Sep 17 00:00:00 2001 From: Sergey Shorokhov Date: Wed, 1 Sep 2021 09:38:42 +0300 Subject: [PATCH] SetClientUserInfoName: Add new CVar checks --- regamedll/dlls/player.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 8c595776a..21037f5aa 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -173,7 +173,11 @@ bool EXT_FUNC CBasePlayer::__API_HOOK(SetClientUserInfoName)(char *infobuffer, c } #endif - if (pev->deadflag != DEAD_NO) + if (IsAlive() +#ifdef REGAMEDLL_ADD + || CSPlayer()->CanChangeNickname() +#endif + ) { m_bHasChangedName = true; Q_snprintf(m_szNewName, sizeof(m_szNewName), "%s", szNewName); @@ -191,6 +195,10 @@ bool EXT_FUNC CBasePlayer::__API_HOOK(SetClientUserInfoName)(char *infobuffer, c WRITE_STRING(szNewName); MESSAGE_END(); +#ifdef REGAMEDLL_ADD + CSPlayer()->OnNicknameChanged(); +#endif + UTIL_LogPrintf("\"%s<%i><%s><%s>\" changed name to \"%s\"\n", STRING(pev->netname), GETPLAYERUSERID(edict()), GETPLAYERAUTHID(edict()), GetTeam(m_iTeam), szNewName); return true; } @@ -3842,6 +3850,10 @@ void EXT_FUNC CBasePlayer::__API_HOOK(RoundRespawn)() #endif } +#ifdef REGAMEDLL_ADD + CSPlayer()->OnRoundRespawn(); +#endif + if (m_iMenu != Menu_ChooseAppearance) { respawn(pev);