Steam API获取角色名称

Steam API getting persona name

本文关键字:角色 获取 API Steam      更新时间:2023-10-16

我一直在遵循Steam文档,但我已经到了我需要根据Steam ID检索玩家名称的地步,Steam在他们的文档中有一个功能:

const char *pchName = SteamFriends()->GetPersonaName(steamID);

但是Visual Studio说没有函数有那么多的参数。唯一可以接受的函数是

const char *pchName = SteamFriends()->GetPersonaName();

应该返回本地玩家的角色名称(它确实如此)。我可以让每个用户得到这个方法,并在登录时将其存储在我的服务器上,但这似乎应该起作用。我怎么能得到一个朋友的uint64 SteamID的角色名?他们最近改变这个功能了吗?

我使用虚幻引擎4.7.6从源与Steam API 1.30。

显然Steam不擅长更新他们的文件。我打开了isteamfriends.h头文件,发现了这个在Steam文档中从未提到的函数:

// returns the name another user - guaranteed to not be NULL.
// same rules as GetFriendPersonaState() apply as to whether or not the user knowns the name of the other user
// note that on first joining a lobby, chat room or game server the local user will not known the name of the other users automatically; that information will arrive asyncronously
// 
virtual const char *GetFriendPersonaName( CSteamID steamIDFriend ) = 0;

拜托,Steam…大约30分钟前,我直接从他们的实时文档中引用了这句话,但它不起作用。

const char *pchName = SteamFriends()->GetPersonaName(steamID);

所以正确的方法是:

const char *pchName = SteamFriends()->GetFriendsPersonaName(steamID);