SteamKit2.SteamFriends.GetFriendPersonaName C# (CSharp) Method

GetFriendPersonaName() public method

Gets the persona name of a friend.
public GetFriendPersonaName ( SteamID steamId ) : string
steamId SteamID The steam id.
return string
        public string GetFriendPersonaName( SteamID steamId )
        {
            return cache.GetUser( steamId ).Name;
        }
        /// <summary>

Usage Example

Example #1
0
        void OnCommunityLoaded(SK.SteamFriends.FriendsListCallback callback)
        {
            foreach (SteamFriend friend in callback.FriendList)
            {
                SteamUser friendUser = new SteamUser
                {
                    AvatarHash = community.GetFriendAvatar(friend.SteamID),
                    SteamId    = new SteamUserId(friend.SteamID),
                    Name       = community.GetFriendPersonaName(friend.SteamID),
                    IsOnline   = community.GetFriendPersonaState(friend.SteamID) != 0,
                    IsScammer  = GetScammerStatus(friend.SteamID.ToString())
                };

                if (friendUser.Name == "[unknown]")
                {
                    continue;
                }

                Friends.Add(friendUser);

                if (friend.Relationship == SK.EFriendRelationship.RequestRecipient)
                {
                    Console.WriteLine($"Pending friend request: {friendUser.Name}");
                }
            }

            int onlineFriendsCount = Friends.Count(f => f.IsOnline);

            CommunityLoaded?.Invoke(this, null);
        }
All Usage Examples Of SteamKit2.SteamFriends::GetFriendPersonaName