diff -r 2e6d9effa65e -r ecd2382ca37e core/PlayerManager.cpp --- a/core/PlayerManager.cpp Sat Mar 16 23:02:36 2013 -0400 +++ b/core/PlayerManager.cpp Sat Mar 16 23:12:40 2013 -0400 @@ -923,8 +923,7 @@ const char *networkid_force; if ((networkid_force = engine->GetClientConVarValue(client, "networkid_force")) && networkid_force[0] != '\0') { - unsigned long long *steamId = (unsigned long long *)engine->GetClientSteamID(pEntity); - unsigned int accountId = steamId ? (*steamId & 0xFFFFFFFF) : 0; + unsigned int accountId = pPlayer->GetSteamAccountID(); g_Logger.LogMessage("\"%s<%d><>\" has bad networkid (id \"%s\") (ip \"%s\")", new_name, pPlayer->GetUserId(), accountId & 1, accountId >> 1, networkid_force, pPlayer->GetIPAddress()); @@ -1586,6 +1585,7 @@ m_bIsSourceTV = false; m_bIsReplay = false; m_Serial.value = -1; + m_SteamAccountID = 0; } void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity) @@ -1665,6 +1665,7 @@ m_bIsSourceTV = false; m_bIsReplay = false; m_Serial.value = -1; + m_SteamAccountID = 0; } void CPlayer::SetName(const char *name) @@ -1697,6 +1698,35 @@ return m_AuthID.c_str(); } +unsigned int CPlayer::GetSteamAccountID(bool validated) +{ + if (IsFakeClient() || (validated && !IsAuthStringValidated())) + { + return 0; + } + + if (m_SteamAccountID != 0) + { + return m_SteamAccountID; + } + +#if SOURCE_ENGINE < SE_ORANGEBOX + const char * pAuth = GetAuthString(); + /* STEAM_0:1:123123 | STEAM_ID_LAN | STEAM_ID_PENDING */ + if (pAuth && (strlen(pAuth) > 10) && pAuth[8] != '_') + { + m_SteamAccountID = (atoi(&pAuth[8]) | (atoi(&pAuth[10]) << 1)); + } +#else + unsigned long long *steamId = (unsigned long long *)engine->GetClientSteamID(m_pEdict); + if (steamId) + { + m_SteamAccountID = (*steamId & 0xFFFFFFFF); + } +#endif + return m_SteamAccountID; +} + edict_t *CPlayer::GetEdict() { return m_pEdict;