public static RequestUserInformation ( CSteamID steamIDUser, bool bRequireNameOnly ) : bool | ||
steamIDUser | CSteamID | |
bRequireNameOnly | bool | |
return | bool |
internal static async Task CacheUserInformationAsync(SteamId steamid, bool nameonly) { if (SteamFriends.RequestUserInformation(steamid, nameonly)) { await Task.Delay(100); while (SteamFriends.RequestUserInformation(steamid, nameonly)) { await Task.Delay(50); } await Task.Delay(500); } }
/// <summary> /// Works also for players that aren't friends /// </summary> public static void RequestName(this Friend player, Action <string> onRetrived) { if (!SteamFriends.RequestUserInformation(player.Id, true)) { onRetrived?.Invoke(player.Name); } else { var playerId = player.Id; SteamFriends.OnPersonaStateChange += SteamFriends_OnPersonaStateChange; void SteamFriends_OnPersonaStateChange(Friend friendChanged) { if (playerId == friendChanged.Id) { SteamFriends.OnPersonaStateChange -= SteamFriends_OnPersonaStateChange; onRetrived?.Invoke(friendChanged.Name); } } } }