Fix up OnClientSettingsChange logic order.
- Fixes bot name cache not getting updated (see #1579) - Fixes IClientListener::OnClientSettingsChanged not being called for bots.
This commit is contained in:
parent
88bdbf4866
commit
29c33bfcc9
@ -1339,29 +1339,13 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
|
|||||||
m_clinfochanged->PushCell(client);
|
m_clinfochanged->PushCell(client);
|
||||||
m_clinfochanged->Execute(&res, NULL);
|
m_clinfochanged->Execute(&res, NULL);
|
||||||
|
|
||||||
if (pPlayer->IsFakeClient())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPlayerInfo *info = pPlayer->GetPlayerInfo();
|
IPlayerInfo *info = pPlayer->GetPlayerInfo();
|
||||||
const char *new_name = info ? info->GetName() : engine->GetClientConVarValue(client, "name");
|
const char *new_name = info ? info->GetName() : engine->GetClientConVarValue(client, "name");
|
||||||
const char *old_name = pPlayer->m_Name.c_str();
|
const char *old_name = pPlayer->m_Name.c_str();
|
||||||
|
|
||||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
|
||||||
const char *networkid_force;
|
|
||||||
if ((networkid_force = engine->GetClientConVarValue(client, "networkid_force")) && networkid_force[0] != '\0')
|
|
||||||
{
|
|
||||||
unsigned int accountId = pPlayer->GetSteamAccountID();
|
|
||||||
logger->LogMessage("\"%s<%d><STEAM_1:%d:%d><>\" has bad networkid (id \"%s\") (ip \"%s\")",
|
|
||||||
new_name, pPlayer->GetUserId(), accountId & 1, accountId >> 1, networkid_force, pPlayer->GetIPAddress());
|
|
||||||
|
|
||||||
pPlayer->Kick("NetworkID spoofing detected.");
|
|
||||||
RETURN_META(MRES_IGNORED);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (strcmp(old_name, new_name) != 0)
|
if (strcmp(old_name, new_name) != 0)
|
||||||
|
{
|
||||||
|
if (!pPlayer->IsFakeClient())
|
||||||
{
|
{
|
||||||
AdminId id = adminsys->FindAdminByIdentity("name", new_name);
|
AdminId id = adminsys->FindAdminByIdentity("name", new_name);
|
||||||
if (id != INVALID_ADMIN_ID && pPlayer->GetAdminId() != id)
|
if (id != INVALID_ADMIN_ID && pPlayer->GetAdminId() != id)
|
||||||
@ -1373,16 +1357,21 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
|
|||||||
pPlayer->Kick(kickMsg);
|
pPlayer->Kick(kickMsg);
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
} else if ((id = adminsys->FindAdminByIdentity("name", old_name)) != INVALID_ADMIN_ID) {
|
}
|
||||||
|
else if ((id = adminsys->FindAdminByIdentity("name", old_name)) != INVALID_ADMIN_ID) {
|
||||||
if (id == pPlayer->GetAdminId())
|
if (id == pPlayer->GetAdminId())
|
||||||
{
|
{
|
||||||
/* This player is changing their name; force them to drop admin privileges! */
|
/* This player is changing their name; force them to drop admin privileges! */
|
||||||
pPlayer->SetAdminId(INVALID_ADMIN_ID, false);
|
pPlayer->SetAdminId(INVALID_ADMIN_ID, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pPlayer->SetName(new_name);
|
pPlayer->SetName(new_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!pPlayer->IsFakeClient())
|
||||||
|
{
|
||||||
if (m_PassInfoVar.size() > 0)
|
if (m_PassInfoVar.size() > 0)
|
||||||
{
|
{
|
||||||
/* Try for a password change */
|
/* Try for a password change */
|
||||||
@ -1398,6 +1387,21 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||||
|
const char* networkid_force;
|
||||||
|
if ((networkid_force = engine->GetClientConVarValue(client, "networkid_force")) && networkid_force[0] != '\0')
|
||||||
|
{
|
||||||
|
unsigned int accountId = pPlayer->GetSteamAccountID();
|
||||||
|
logger->LogMessage("\"%s<%d><STEAM_1:%d:%d><>\" has bad networkid (id \"%s\") (ip \"%s\")",
|
||||||
|
new_name, pPlayer->GetUserId(), accountId & 1, accountId >> 1, networkid_force, pPlayer->GetIPAddress());
|
||||||
|
|
||||||
|
pPlayer->Kick("NetworkID spoofing detected.");
|
||||||
|
RETURN_META(MRES_IGNORED);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Notify Extensions */
|
/* Notify Extensions */
|
||||||
List<IClientListener *>::iterator iter;
|
List<IClientListener *>::iterator iter;
|
||||||
IClientListener *pListener = NULL;
|
IClientListener *pListener = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user