Skip to content

Commit

Permalink
SetClientUserInfoName: Add new CVar checks
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyShorokhov committed Sep 1, 2021
1 parent 098104f commit 987768a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion regamedll/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 987768a

Please sign in to comment.