4

I have been following the Steam documentation to a t, but I have gotten to the point where I need to retrieve player names based on the steam ID, and Steam has a function for this in their documentation:

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

However Visual Studio says that there is no function with that number of arguments. The only acceptable function is

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

Which is supposed to return the local player's persona name (which it does). I can make a way to get this from every user and store it on my server on login, but it sure seems like this should work. How am I supposed to get the persona name for a friend's uint64 SteamID? Did they change this function recently?

I am using Unreal Engine 4.7.6 from source with Steam API 1.30.

4

1 回答 1

3

Apparently Steam is bad at updating their documentation. I opened up the isteamfriends.h header and found this function that is never mentioned in the Steam docs:

// 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;

Come on, Steam... I literally pulled this line directly from their live docs about 30 minutes ago, and it doesn't work.

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

So the correct way then is:

const char *pchName = SteamFriends()->GetFriendsPersonaName(steamID);
于 2015-05-19T18:46:26.947 回答