Another fix for friendsID

This commit is contained in:
BenCat07 2021-08-06 22:07:01 +02:00
parent a6f3641c00
commit 1359e37131

View File

@ -1952,8 +1952,19 @@ bool GetPlayerInfo(int idx, player_info_s *info)
bool res = g_IEngine->GetPlayerInfo(idx, info);
if (!res)
return res;
// Fix friends ID
info->friendsID = g_pPlayerResource->GetAccountID(idx);
// First try parsing GUID, should always work unless a server is being malicious
try
{
std::string guid = info->guid;
guid = guid.substr(5, guid.length() - 6);
info->friendsID = std::stoul(guid.c_str());
}
catch (...)
{
// Fix friends ID with player resource
info->friendsID = g_pPlayerResource->GetAccountID(idx);
}
return res;
}