Interface to access information about individual users and interact with the
Steam Overlay.
Member Functions
Member functions for
ISteamFriends
are called through the global accessor function
SteamFriends()
.
ActivateGameOverlay
void ActivateGameOverlay( const char *pchDialog );
Name | Type | Description |
pchDialog | const char * | The dialog to open. Valid options are: "friends", "community", "players", "settings", "officialgamegroup", "stats", "achievements". |
Activates the
Steam Overlay to a specific dialog.
This is equivalent to calling
ActivateGameOverlayToUser with
steamID
set to
ISteamUser::GetSteamID.
Example:SteamFriends()->ActivateGameOverlay( "friends" );
ActivateGameOverlayInviteDialog
void ActivateGameOverlayInviteDialog( CSteamID steamIDLobby );
Name | Type | Description |
steamIDLobby | CSteamID | The Steam ID of the lobby that selected users will be invited to. |
Activates the
Steam Overlay to open the invite dialog. Invitations sent from this dialog will be for the provided lobby.
ActivateGameOverlayToStore
void ActivateGameOverlayToStore( AppId_t nAppID, EOverlayToStoreFlag eFlag );
Name | Type | Description |
nAppID | AppId_t | The app ID to show the store page of. |
eFlag | EOverlayToStoreFlag | Flags to modify the behavior when the page opens. |
Activates the
Steam Overlay to the Steam store page for the provided app.
Using
k_uAppIdInvalid brings the user to the front page of the Steam store.
ActivateGameOverlayToUser
void ActivateGameOverlayToUser( const char *pchDialog, CSteamID steamID );
Name | Type | Description |
pchDialog | const char * | The dialog to open. |
steamID | CSteamID | The Steam ID of the context to open this dialog to. |
Activates
Steam Overlay to a specific dialog.
Valid
pchDialog
options are:
- "steamid" - Opens the overlay web browser to the specified user or groups profile.
- "chat" - Opens a chat window to the specified user, or joins the group chat.
- "jointrade" - Opens a window to a Steam Trading session that was started with the ISteamEconomy/StartTrade Web API.
- "stats" - Opens the overlay web browser to the specified user's stats.
- "achievements" - Opens the overlay web browser to the specified user's achievements.
- "friendadd" - Opens the overlay in minimal mode prompting the user to add the target user as a friend.
- "friendremove" - Opens the overlay in minimal mode prompting the user to remove the target friend.
- "friendrequestaccept" - Opens the overlay in minimal mode prompting the user to accept an incoming friend invite.
- "friendrequestignore" - Opens the overlay in minimal mode prompting the user to ignore an incoming friend invite.
ActivateGameOverlayToWebPage
void ActivateGameOverlayToWebPage( const char *pchURL );
Activates
Steam Overlay web browser directly to the specified URL.
ClearRichPresence
void ClearRichPresence();
Clears all of the current user's Rich Presence key/values.
CloseClanChatWindowInSteam
bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat );
Name | Type | Description |
steamIDClanChat | CSteamID | The Steam ID of the Steam group chat room to close. |
Closes the specified Steam group chat room in the Steam UI.
Returns: bool
true if the user successfully left the Steam group chat room.
false if the user is not in the provided Steam group chat room.
See Also: IsClanChatWindowOpenInSteam,
OpenClanChatWindowInSteamDownloadClanActivityCounts
SteamAPICall_t DownloadClanActivityCounts( CSteamID *psteamIDClans, int cClansToRequest );
Name | Type | Description |
psteamIDClans | CSteamID * | A list of steam groups to get the updated data for. |
cClansToRequest | int | This MUST be the number of groups in psteamIDClans . |
Refresh the Steam Group activity data or get the data from groups other than one that the current user is a member.
After receiving the callback you can then use
GetClanActivityCounts to get the up to date user counts.
Returns: SteamAPICall_t to be used with a
DownloadClanActivityCountsResult_t call result.
EnumerateFollowingList
SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex );
Name | Type | Description |
unStartIndex | uint32 | The index to start receiving followers from. This should be 0 on the initial call. |
Gets the list of users that the current user is following.
You can be following people that are not your friends. Following allows you to receive updates when the person does things like post a new piece of content to the Steam Workshop.
NOTE: This returns up to
k_cEnumerateFollowersMax users at once. If the current user is following more than that, you will need to call this repeatedly, with
unStartIndex
set to the total number of followers that you have received so far.
I.E. If you have received 50 followers, and the user is following 105, you will need to call this again with
unStartIndex
= 50 to get the next 50, and then again with
unStartIndex
= 100 to get the remaining 5 users.
Returns: SteamAPICall_t to be used with a
FriendsEnumerateFollowingList_t call result.
Example:class CEnumerateFollowingListExample
{
public:
void GetWhoWeFollow();
private:
void OnFriendsEnumerateFollowingList( FriendsEnumerateFollowingList_t *pCallback, bool bIOFailure );
CCallResult< CEnumerateFollowingListExample, FriendsEnumerateFollowingList_t > m_SteamCallResultFriendsEnumerateFollowingList;
int m_nFollowersParsed;
};
void CEnumerateFollowingListExample::GetWhoWeFollow()
{
m_nFollowersParsed = 0;
printf( "Getting the list of users that we follow.\n" );
SteamAPICall_t handle = SteamFriends()->EnumerateFollowingList( 0 );
m_SteamCallResultFriendsEnumerateFollowingList.Set( handle, this, &CEnumerateFollowingListExample::OnFriendsEnumerateFollowingList );
}
void CEnumerateFollowingListExample::OnFriendsEnumerateFollowingList( FriendsEnumerateFollowingList_t *pCallback, bool bIOFailure )
{
if ( pCallback->m_eResult != k_EResultOK || bIOFailure )
{
printf( "OnFriendsEnumerateFollowingList failed with m_eResult: %d and bIOFailure: %d!", pCallback->m_eResult, bIOFailure );
return;
}
printf( "FriendsEnumerateFollowingList retrieved %d of %d people that we follow.\n", pCallback->m_nResultsReturned, pCallback->m_nTotalResultCount );
for ( int i = 0; i < pCallback->m_nResultsReturned; ++i )
{
printf( " %d: %lld\n", i, pCallback->m_rgSteamID[i].ConvertToUint64() );
}
m_nFollowersParsed += pCallback->m_nResultsReturned;
// There are more followers! Gets the next set of them!
if ( m_nFollowersParsed < pCallback->m_nTotalResultCount )
{
SteamAPICall_t handle = SteamFriends()->EnumerateFollowingList( pCallback->m_nResultsReturned );
m_SteamCallResultFriendsEnumerateFollowingList.Set( handle, this, &CEnumerateFollowingListExample::OnFriendsEnumerateFollowingList );
}
}
GetChatMemberByIndex
CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser );
Gets the Steam ID at the given index in a Steam group chat.
NOTE: You must call
GetClanChatMemberCount before calling this.
Returns: CSteamIDInvalid indices return
k_steamIDNil.
GetClanActivityCounts
bool GetClanActivityCounts( CSteamID steamIDClan, int *pnOnline, int *pnInGame, int *pnChatting );
Name | Type | Description |
steamIDClan | CSteamID | The Steam group to get the activity of. |
pnOnline | int * | Returns the number of members that are online. |
pnInGame | int * | Returns the number members that are in game (excluding those with their status set to offline). |
pnChatting | int * | Returns the number of members in the group chat room. |
Gets the most recent information we have about what the users in a Steam Group are doing.
This can only retrieve data that the local client knows about. To refresh the data or get data from a group other than one that the current user is a member of you must call
DownloadClanActivityCounts.
Returns: bool
true if the data was successfully returned.
false if the provided Steam ID is invalid or the local client does not have info about the Steam group and sets all the other parameters to
0.
GetClanByIndex
CSteamID GetClanByIndex( int iClan );
Name | Type | Description |
iClan | int | An index between 0 and GetClanCount. |
This API is deprecated.Gets the Steam group's Steam ID at the given index.
NOTE: You must call
GetClanCount before calling this.
Returns: CSteamIDInvalid indices return
k_steamIDNil.
GetClanChatMemberCount
int GetClanChatMemberCount( CSteamID steamIDClan );
Name | Type | Description |
steamIDClan | CSteamID | The Steam group to get the chat count of. |
This API is deprecated.Get the number of users in a Steam group chat.
NOTE: Large steam groups cannot be iterated by the local user.
NOTE: The current user must be in a lobby to retrieve the Steam IDs of other users in that lobby.
This is used for iteration, after calling this then
GetChatMemberByIndex can be used to get the Steam ID of each person in the chat.
Returns: int
0 if the Steam ID provided is invalid or if the local user doesn't have the data available.
GetClanChatMessage
int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *peChatEntryType, CSteamID *psteamidChatter );
Name | Type | Description |
steamIDClanChat | CSteamID | The Steam ID of the Steam group chat room. |
iMessage | int | The index of the message. This should be the m_iMessageID field of GameConnectedClanChatMsg_t. |
prgchText | void * | The buffer where the chat message will be copied into. (Should be big enough to hold 2048 UTF-8 characters. So 8192 bytes + 1 for '\0') |
cchTextMax | int | The size of prgchText . |
peChatEntryType | EChatEntryType * | Returns the type of chat entry that was received. |
psteamidChatter | CSteamID * | Returns the Steam ID of the user that sent the message. |
Gets the data from a Steam group chat room message.
This should only ever be called in response to a
GameConnectedClanChatMsg_t callback.
Returns: int
The number of bytes copied into
prgchText
.
Returns
0 and sets
peChatEntryType
to
k_EChatEntryTypeInvalid if the current user is not in the specified Steam group chat room or if the index provided in
iMessage
is invalid.
GetClanCount
int GetClanCount();
Gets the number of Steam groups that the current user is a member of.
This is used for iteration, after calling this then
GetClanByIndex can be used to get the Steam ID of each Steam group.
Returns: int
The number of Steam groups that the user is a member of.
Example:void ListSteamGroups() {
int nGroups = SteamFriends()->GetClanCount();
printf( "Listing %d Steam Groups\n", nGroups );
for ( int i = 0; i < nGroups; ++i )
{
CSteamID groupSteamID = SteamFriends()->GetClanByIndex( i );
const char *szGroupName = SteamFriends()->GetClanName( groupSteamID );
const char *szGroupTag = SteamFriends()->GetClanTag( groupSteamID );
int nOnline, nInGame, nChatting;
bool success = SteamFriends()->GetClanActivityCounts( groupSteamID, &nOnline, &nInGame, &nChatting );
printf( "Group %d - ID: %lld - Name: '%s' - Tag: '%s'\n", i, groupSteamID.ConvertToUint64(), szGroupName, szGroupTag );
printf( " - Online: %d, In Game: %d, Chatting: %d\n", nOnline, nInGame, nChatting );
}
}
GetClanName
const char * GetClanName( CSteamID steamIDClan );
Name | Type | Description |
steamIDClan | CSteamID | The Steam group to get the name of. |
Gets the display name for the specified Steam group; if the local client knows about it.
Returns: const char *
The Steam group's name in UTF-8 format. Returns an empty string ("") if the provided Steam ID is invalid or the user does not know about the group.
See Also: DownloadClanActivityCountsGetClanOfficerByIndex
CSteamID GetClanOfficerByIndex( CSteamID steamIDClan, int iOfficer );
Gets the Steam ID of the officer at the given index in a Steam group.
NOTE: You must call
GetClanOfficerCount before calling this.
Returns: CSteamIDk_steamIDNil if
steamIDClan
or
iOfficer
are invalid.
GetClanOfficerCount
int GetClanOfficerCount( CSteamID steamIDClan );
Name | Type | Description |
steamIDClan | CSteamID | The Steam group to get the officer count of. |
Gets the number of officers (administrators and moderators) in a specified Steam group.
This also includes the owner of the Steam group.
This is used for iteration, after calling this then
GetClanOfficerByIndex can be used to get the Steam ID of each officer.
NOTE: You must call
RequestClanOfficerList before this to get the required data!
Returns: int
The number of officers in the Steam group. Returns
0 if
steamIDClan
is invalid or if
RequestClanOfficerList has not been called for it.
GetClanOwner
CSteamID GetClanOwner( CSteamID steamIDClan );
Name | Type | Description |
steamIDClan | CSteamID | The Steam ID of the Steam group to get the owner for. |
Gets the owner of a Steam Group.
NOTE: You must call
RequestClanOfficerList before this to get the required data!
Returns: CSteamIDReturns
k_steamIDNil if
steamIDClan
is invalid or if
RequestClanOfficerList has not been called for it.
GetClanTag
const char * GetClanTag( CSteamID steamIDClan );
Name | Type | Description |
steamIDClan | CSteamID | The Steam group to get the tag of. |
Gets the unique tag (abbreviation) for the specified Steam group; If the local client knows about it.
The Steam group abbreviation is a unique way for people to identify the group and is limited to 12 characters. In some games this will appear next to the name of group members.
Returns: const char *
The Steam groups tag in UTF-8 format. Returns an empty string ("") if the provided Steam ID is invalid or the user does not know about the group.
See Also: DownloadClanActivityCountsGetCoplayFriend
CSteamID GetCoplayFriend( int iCoplayFriend );
Gets the Steam ID of the recently played with user at the given index.
NOTE: You must call
GetCoplayFriendCount before calling this.
Returns: CSteamIDInvalid indices return
k_steamIDNil.
GetCoplayFriendCount
int GetCoplayFriendCount();
Gets the number of players that the current user has recently played with, across all games.
This is used for iteration, after calling this then
GetCoplayFriend can be used to get the Steam ID of each player.
These players are have been set with previous calls to
SetPlayedWith.
Returns: int
The number of users that the current user has recently played with.
Example:void ListRecentlyPlayedWithList() {
int nPlayers = SteamFriends()->GetCoplayFriendCount();
printf( "Listing %d Recently Played with Players\n", nPlayers );
for ( int i = 0; i < nPlayers; ++i )
{
CSteamID playerSteamID = SteamFriends()->GetCoplayFriend( i );
int iTimeStamp = SteamFriends()->GetFriendCoplayTime( playerSteamID );
AppId_t app = SteamFriends()->GetFriendCoplayGame( playerSteamID );
printf( "Player %d - ID: %lld - Time: %d - App: %d\n", i, playerSteamID.ConvertToUint64(), iTimeStamp, app );
}
}
GetFollowerCount
SteamAPICall_t GetFollowerCount( CSteamID steamID );
Name | Type | Description |
steamID | CSteamID | The user to get the follower count for. |
Gets the number of users following the specified user.
Returns: SteamAPICall_t to be used with a
FriendsGetFollowerCount_t call result.
Example:class GetFollowerCountExample
{
public:
void GetFollowerCount();
private:
void OnFriendsGetFollowerCount( FriendsGetFollowerCount_t *pCallback, bool bIOFailure );
CCallResult< GetFollowerCountExample, FriendsGetFollowerCount_t > m_SteamCallResultFriendsGetFollowerCount;
};
void GetFollowerCountExample::GetFollowerCount()
{
printf( "Getting the number of users who follow us.\n" );
SteamAPICall_t handle = SteamFriends()->GetFollowerCount( SteamUser()->GetSteamID() );
m_SteamCallResultFriendsGetFollowerCount.Set( handle, this, &GetFollowerCountExample::OnFriendsGetFollowerCount );
}
void GetFollowerCountExample::OnFriendsGetFollowerCount( FriendsGetFollowerCount_t *pCallback, bool bIOFailure )
{
if ( pCallback->m_eResult != k_EResultOK || bIOFailure )
{
printf( "OnFriendsGetFollowerCount failed for %lld with m_eResult: %d and bIOFailure: %d!", pCallback->m_steamID.ConvertToUint64(), pCallback->m_eResult, bIOFailure );
return;
}
printf( "Got a FriendsGetFollowerCount_t, we have %d followers.\n", pCallback->m_nCount );
}
GetFriendByIndex
CSteamID GetFriendByIndex( int iFriend, int iFriendFlags );
Name | Type | Description |
iFriend | int | An index between 0 and GetFriendCount. |
iFriendFlags | int | A combined union (binary "or") of EFriendFlags. This must be the same value as used in the previous call to GetFriendCount. |
Gets the Steam ID of the user at the given index.
NOTE: You must call
GetFriendCount before calling this.
Returns: CSteamIDInvalid indices return
k_steamIDNil.
GetFriendCoplayGame
AppId_t GetFriendCoplayGame( CSteamID steamIDFriend );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam ID of the user on the recently-played-with list to get the game played. |
Gets the app ID of the game that user played with someone on their recently-played-with list.
Returns: AppId_tSteam IDs not in the recently-played-with list return
k_uAppIdInvalid.
GetFriendCoplayTime
int GetFriendCoplayTime( CSteamID steamIDFriend );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam ID of the user on the recently-played-with list to get the timestamp for. |
Gets the timestamp of when the user played with someone on their recently-played-with list.
Returns: int
The time is provided in Unix epoch format (seconds since Jan 1st 1970).
Steam IDs not in the recently-played-with list return
0.
GetFriendCount
int GetFriendCount( int iFriendFlags );
Name | Type | Description |
iFriendFlags | int | A combined union (binary "or") of one or more EFriendFlags. |
Gets the number of users the client knows about who meet a specified criteria. (Friends, blocked, users on the same server, etc)
This can be used to iterate over all of the users by calling
GetFriendByIndex to get the Steam IDs of each user.
Returns: int
The number of users that meet the specified criteria.
NOTE: Returns
-1 if the current user is not logged on.
Example:int nFriends = SteamFriends()->GetFriendCount( k_EFriendFlagImmediate );
if ( nFriends == -1)
{
printf( "GetFriendCount returned -1, the current user is not logged in.\n" );
// We always recommend resetting to 0 just in case you were to do something like allocate
// an array with this value, or loop over it in a way that doesn't take into the -1 into account.
nFriends = 0;
}
for ( int i = 0; i < nFriends; ++i )
{
CSteamID friendSteamID = SteamFriends()->GetFriendByIndex( i, k_EFriendFlagImmediate );
const char *friendName = SteamFriends()->GetFriendPersonaName( friendSteamID );
printf( "Friend %d: %lld - %s\n", i, friendSteamID.ConvertToUint64(), friendName );
}
GetFriendCountFromSource
int GetFriendCountFromSource( CSteamID steamIDSource );
Name | Type | Description |
steamIDSource | CSteamID | The Steam group, chat room, lobby or game server to get the user count of. |
Get the number of users in a source (Steam group, chat room, lobby, or game server).
NOTE: Large Steam groups cannot be iterated by the local user.
NOTE: If you're getting the number of lobby members then you should use
ISteamMatchmaking::GetNumLobbyMembers instead.
This is used for iteration, after calling this then
GetFriendFromSourceByIndex can be used to get the Steam ID of each person in the source.
Returns: int
0 if the Steam ID provided is invalid or if the local user doesn't have the data available.
GetFriendFromSourceByIndex
CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend );
Gets the Steam ID at the given index from a source (Steam group, chat room, lobby, or game server).
NOTE: You must call
GetFriendCountFromSource before calling this.
Returns: CSteamIDInvalid indices return
k_steamIDNil.
GetFriendGamePlayed
bool GetFriendGamePlayed( CSteamID steamIDFriend, FriendGameInfo_t *pFriendGameInfo );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam ID of the other user. |
pFriendGameInfo | FriendGameInfo_t * | Fills in the details if the user is in a game. |
Checks if the specified friend is in a game, and gets info about the game if they are.
Returns: bool
true if the user is a friend and is in a game; otherwise,
false.
GetFriendMessage
int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, void *pvData, int cubData, EChatEntryType *peChatEntryType );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam ID of the friend that sent this message. |
iMessageID | int | The index of the message. This should be the m_iMessageID field of GameConnectedFriendChatMsg_t. |
pvData | void * | The buffer where the chat message will be copied into. |
cubData | int | The size of pvData . |
peChatEntryType | EChatEntryType * | Returns the type of chat entry that was received. |
Gets the data from a Steam friends message.
This should only ever be called in response to a
GameConnectedFriendChatMsg_t callback.
Returns: int
The number of bytes copied into
pvData
.
Returns
0 and sets
peChatEntryType
to
k_EChatEntryTypeInvalid if the current user is chat restricted, if the provided Steam ID is not a friend, or if the index provided in
iMessageID
is invalid.
GetFriendPersonaName
const char * GetFriendPersonaName( CSteamID steamIDFriend );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam ID of the other user. |
Gets the specified user's persona (display) name.
This will only be known to the current user if the other user is in their friends list, on the same game server, in a chat room or lobby, or in a small Steam group with the local user.
NOTE: Upon on first joining a lobby, chat room, or game server the current user will not known the name of the other users automatically; that information will arrive asynchronously via
PersonaStateChange_t callbacks.
To get the persona name of the current user use
GetPersonaName.
Returns: const char *
The current user's persona name in UTF-8 format. Guaranteed to not be
NULL.
Returns an empty string (""), or "[unknown]" if the Steam ID is invalid or not known to the caller.
GetFriendPersonaNameHistory
const char * GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam ID of the other user. |
iPersonaName | int | The index of the history to receive. 0 is their current persona name, 1 is their most recent before they changed it, etc. |
Gets one of the previous display names for the specified user.
This only works for display names that the current user has seen on the local computer.
Returns: const char *
The players old persona name at the given index. Returns an empty string when there are no further items in the history.
GetFriendPersonaState
EPersonaState GetFriendPersonaState( CSteamID steamIDFriend );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam ID of the other user. |
Gets the current status of the specified user.
This will only be known to the current user if the other user is in their friends list, on the same game server, in a chat room or lobby, or in a small Steam group with the local user.
To get the state of the current user use
GetPersonaState.
Returns: EPersonaStateThe friend state of the specified user. (Online, Offline, In-Game, etc)
GetFriendRelationship
EFriendRelationship GetFriendRelationship( CSteamID steamIDFriend );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam ID of the other user. |
Gets a relationship to a specified user.
Returns: EFriendRelationshipHow the users know each other.
GetFriendRichPresence
const char * GetFriendRichPresence( CSteamID steamIDFriend, const char *pchKey );
Name | Type | Description |
steamIDFriend | CSteamID | The friend to get the Rich Presence value for. |
pchKey | const char * | The Rich Presence key to request. |
Get a Rich Presence value from a specified friend.
Returns: const char *
Returns an empty string ("") if the specified key is not set.
See Also: RequestFriendRichPresence,
SetRichPresenceGetFriendRichPresenceKeyByIndex
const char * GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey );
Returns: const char *
Returns an empty string ("") if the index is invalid or the specified user has no Rich Presence data available.
GetFriendRichPresenceKeyCount
int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam ID of the user to get the Rich Presence Key Count of. |
Gets the number of Rich Presence keys that are set on the specified user.
This is used for iteration, after calling this then
GetFriendRichPresenceKeyByIndex to get the rich presence keys.
This is typically only ever used for debugging purposes.
Returns: int
Returns
0 if there is no Rich Presence information for the specified user.
GetFriendsGroupCount
int GetFriendsGroupCount();
Gets the number of friends groups (tags) the user has created.
This is used for iteration, after calling this then
GetFriendsGroupIDByIndex can be used to get the ID of each friend group.
This is not to be confused with Steam groups. Those can be obtained with
GetClanCount.
Returns: int
The number of friends groups the current user has.
Example:void ListFriendsGroups() {
int nGroups = SteamFriends()->GetFriendsGroupCount();
for ( int i = 0; i < nGroups; ++i )
{
FriendsGroupID_t friendsGroupID = SteamFriends()->GetFriendsGroupIDByIndex( i );
const char *szFriendsGroupName = SteamFriends()->GetFriendsGroupName( friendsGroupID );
int nFriendsGroupMembers = SteamFriends()->GetFriendsGroupMembersCount( friendsGroupID );
printf( "Group %d - ID: %d - Name: '%s' - Members: %d\n", i, friendsGroupID, szFriendsGroupName, nFriendsGroupMembers );
std::vector<CSteamID> friends( nFriendsGroupMembers );
SteamFriends()->GetFriendsGroupMembersList( friendsGroupID, friends.data(), nFriendsGroupMembers );
for ( int j = 0; j < nFriendsGroupMembers; ++j )
{
printf( " - Member %d - ID: %lld\n", j, friends[j].ConvertToUint64() );
}
}
}
GetFriendsGroupIDByIndex
FriendsGroupID_t GetFriendsGroupIDByIndex( int iFG );
Gets the friends group ID for the given index.
NOTE: You must call
GetFriendsGroupCount before calling this.
Returns: FriendsGroupID_tInvalid indices return
k_FriendsGroupID_Invalid.
GetFriendsGroupMembersCount
int GetFriendsGroupMembersCount( FriendsGroupID_t friendsGroupID );
Name | Type | Description |
friendsGroupID | FriendsGroupID_t | The friends group ID to get the number of friends in. |
Gets the number of friends in a given friends group.
This should be called before getting the list of friends with
GetFriendsGroupMembersList.
Returns: int
The number of friends in the specified friends group.
See Also: GetFriendsGroupCountGetFriendsGroupMembersList
void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID, CSteamID *pOutSteamIDMembers, int nMembersCount );
Name | Type | Description |
friendsGroupID | FriendsGroupID_t | The friends group ID to get the members list of. |
pOutSteamIDMembers | CSteamID * | Returns the Steam IDs of the friends by setting them in this array. |
nMembersCount | int | This should match the number of elements allocated pOutSteamIDMembers and the value returned by GetFriendsGroupMembersCount. |
Gets the number of friends in the given friends group.
If fewer friends exist than requested those positions' Steam IDs will be invalid.
You must call
GetFriendsGroupMembersCount before calling this to set up the
pOutSteamIDMembers
array with an appropriate size!
See Also: GetFriendsGroupCountGetFriendsGroupName
const char * GetFriendsGroupName( FriendsGroupID_t friendsGroupID );
Name | Type | Description |
friendsGroupID | FriendsGroupID_t | The friends group ID to get the name of. |
Gets the name for the given friends group.
Returns: const char *
The friend groups name in UTF-8 format. Returns
NULL if the group ID is invalid.
See Also: GetFriendsGroupCountGetFriendSteamLevel
int GetFriendSteamLevel( CSteamID steamIDFriend );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam ID of the user. |
Gets the Steam level of the specified user.
You can use the local users Steam ID (
ISteamUser::GetSteamID) to get their level.
Returns: int
The Steam level if it's available.
If the Steam level is not immediately available for the specified user then this returns
0 and queues it to be downloaded from the Steam servers. When it gets downloaded a
PersonaStateChange_t callback will be posted with
m_nChangeFlags
including
k_EPersonaChangeSteamLevel
.
GetLargeFriendAvatar
int GetLargeFriendAvatar( CSteamID steamIDFriend );
Name | Type | Description |
steamIDFriend | CSteamID | |
Gets a handle to the large (128*128px) avatar for the specified user.
You can pass in
ISteamUser::GetSteamID to get the current user's avatar.
NOTE: This only works for users that the local user knows about. They will automatically know about their friends, people on leaderboards they've requested, or people in the same source as them (Steam group, chat room, lobby, or game server). If they don't know about them then you must call
RequestUserInformation to cache the avatar locally.
Returns: int
Triggers a
AvatarImageLoaded_t callback.
A Steam image handle which is used with
ISteamUtils::GetImageSize and
ISteamUtils::GetImageRGBA.
Returns
0 if no avatar is set for the user.
Returns
-1 if the avatar image data has not been loaded yet and requests that it gets download. In this case wait for a
AvatarImageLoaded_t callback and then call this again.
See Also: GetMediumFriendAvatar,
GetSmallFriendAvatarGetMediumFriendAvatar
int GetMediumFriendAvatar( CSteamID steamIDFriend );
Name | Type | Description |
steamIDFriend | CSteamID | |
Gets a handle to the medium (64*64px) avatar for the specified user.
You can pass in
ISteamUser::GetSteamID to get the current user's avatar.
NOTE: This only works for users that the local user knows about. They will automatically know about their friends, people on leaderboards they've requested, or people in the same source as them (Steam group, chat room, lobby, or game server). If they don't know about them then you must call
RequestUserInformation to cache the avatar locally.
Returns: int
A Steam image handle which is used with
ISteamUtils::GetImageSize and
ISteamUtils::GetImageRGBA.
Returns
0 if no avatar is set for the user.
See Also: GetLargeFriendAvatar,
GetSmallFriendAvatarGetPersonaName
const char * GetPersonaName();
Gets the current user's persona (display) name.
This is the same name that is displayed the user's community profile page.
To get the persona name of other users use
GetFriendPersonaName.
Returns: const char *
The current user's persona name in UTF-8 format. Guaranteed to not be
NULL.
GetPersonaState
EPersonaState GetPersonaState();
Gets the friend status of the current user.
To get the state of other users use
GetFriendPersonaState.
Returns: EPersonaStateThe friend state of the current user. (Online, Offline, In-Game, etc)
GetPlayerNickname
const char * GetPlayerNickname( CSteamID steamIDPlayer );
Name | Type | Description |
steamIDPlayer | CSteamID | The Steam ID of the user. |
Gets the nickname that the current user has set for the specified user.
Returns: const char *
NULL if the no nickname has been set for that user.
GetSmallFriendAvatar
int GetSmallFriendAvatar( CSteamID steamIDFriend );
Name | Type | Description |
steamIDFriend | CSteamID | |
Gets a handle to the small (32*32px) avatar for the specified user.
You can pass in
ISteamUser::GetSteamID to get the current user's avatar.
NOTE: This only works for users that the local user knows about. They will automatically know about their friends, people on leaderboards they've requested, or people in the same source as them (Steam group, chat room, lobby, or game server). If they don't know about them then you must call
RequestUserInformation to cache the avatar locally.
Returns: int
A Steam image handle which is used with
ISteamUtils::GetImageSize and
ISteamUtils::GetImageRGBA.
Returns
0 if no avatar is set for the user.
See Also: GetLargeFriendAvatar,
GetMediumFriendAvatarGetUserRestrictions
uint32 GetUserRestrictions();
Checks if current user is chat restricted.
If they are restricted, then they can't send or receive any text/voice chat messages, can't see custom avatars.
A chat restricted user can't add friends or join any groups.
Restricted users can still be online and send/receive game invites.
Returns: uint32See:
EUserRestrictionHasFriend
bool HasFriend( CSteamID steamIDFriend, int iFriendFlags );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam user to check the friend status of. |
iFriendFlags | int | A combined union (binary "or") of one or more EFriendFlags. |
Checks if the user meets the specified criteria. (Friends, blocked, users on the same server, etc)
Returns: bool
true if the specified user meets any of the criteria specified in
iFriendFlags
; otherwise,
false.
InviteUserToGame
bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam ID of the friend to invite. |
pchConnectString | const char * | A string that lets the friend know how to join the game (I.E. the game server IP). This can not be longer than specified in k_cchMaxRichPresenceValueLength. |
Invites a friend or clan member to the current game using a special invite string.
If the target user accepts the invite then the pchConnectString gets added to the command-line when launching the game.
If the game is already running for that user, then they will receive a
GameRichPresenceJoinRequested_t callback with the connect string.
Returns: bool
Triggers a
GameRichPresenceJoinRequested_t callback.
true if the invite was successfully sent.
false under the following conditions:
- The Steam ID provided to
steamIDFriend
was invalid.
- The Steam ID provided to
steamIDFriend
is not a friend or does not share the same Steam Group as the current user.
- The value provided to
pchConnectString
was too long.
See Also: ISteamMatchmaking::InviteUserToLobbyIsClanChatAdmin
bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser );
Name | Type | Description |
steamIDClanChat | CSteamID | The Steam ID of the Steam group chat room. |
steamIDUser | CSteamID | The Steam ID of the user to check the admin status of. |
Checks if a user in the Steam group chat room is an admin.
Returns: bool
true if the specified user is an admin.
false if the user is not an admin, if the current user is not in the chat room specified, or the specified user is not in the chat room.
IsClanPublic
bool IsClanPublic( CSteamID steamIDClan );
Name | Type | Description |
steamIDClan | CSteamID | The Steam ID of the Steam group. |
Checks if the Steam group is public.
Returns: bool
true if the specified group is public
false if the specified group is not public
IsClanOfficialGameGroup
bool IsClanOfficialGameGroup( CSteamID steamIDClan );
Name | Type | Description |
steamIDClan | CSteamID | The Steam ID of the Steam group. |
Checks if the Steam group is an official game group/community hub.
Returns: bool
true if the specified group is an official game group/community hub
false if the specified group is not an official game group/community hub
IsClanChatWindowOpenInSteam
bool IsClanChatWindowOpenInSteam( CSteamID steamIDClanChat );
Name | Type | Description |
steamIDClanChat | CSteamID | The Steam ID of the Steam group chat room to check. |
Checks if the Steam Group chat room is open in the Steam UI.
Returns: bool
true if the specified Steam group chat room is opened; otherwise,
false.
This also returns
false if the specified Steam group chat room is unknown.
See Also: OpenClanChatWindowInSteam,
CloseClanChatWindowInSteamIsFollowing
SteamAPICall_t IsFollowing( CSteamID steamID );
Name | Type | Description |
steamID | CSteamID | The Steam ID of the check if we are following. |
Checks if the current user is following the specified user.
Returns: SteamAPICall_t to be used with a
FriendsIsFollowing_t call result.
Example:class CIsFollowingExample
{
public:
CIsFollowingExample();
void CheckWhichFriendsWeAreFollowing();
private:
void OnFriendsIsFollowing( FriendsIsFollowing_t *pCallback, bool bIOFailure );
CCallResult< CIsFollowingExample, FriendsIsFollowing_t > m_SteamCallResultFriendsIsFollowing;
int m_nFriends;
int m_iFriendIndex;
};
CIsFollowingExample::CIsFollowingExample()
{
m_nFriends = SteamFriends()->GetFriendCount( k_EFriendFlagImmediate );
if ( m_nFriends == -1 )
{
printf( "GetFriendCount returned -1, the current user is not logged in.\n" );
m_nFriends = 0;
}
m_iFriendIndex = 0;
}
void CIsFollowingExample::CheckWhichFriendsWeAreFollowing()
{
if ( m_iFriendIndex < m_nFriends )
{
CSteamID steamID = SteamFriends()->GetFriendByIndex( m_iFriendIndex, k_EFriendFlagImmediate );
printf( "Checking if we follow %lld (%d of %d).\n", steamID.ConvertToUint64(), m_iFriendIndex, m_nFriends );
SteamAPICall_t handle = SteamFriends()->IsFollowing( steamID );
m_SteamCallResultFriendsIsFollowing.Set( handle, this, &CIsFollowingExample::OnFriendsIsFollowing );
}
}
void CIsFollowingExample::OnFriendsIsFollowing( FriendsIsFollowing_t *pCallback, bool bIOFailure )
{
if ( pCallback->m_eResult != k_EResultOK || bIOFailure )
{
printf( "OnFriendsIsFollowing failed for %lld with m_eResult: %d and bIOFailure: %d!\n", pCallback->m_steamID.ConvertToUint64(), pCallback->m_eResult, bIOFailure );
return;
}
if ( pCallback->m_bIsFollowing )
printf( "We are following %lld\n", pCallback->m_steamID.ConvertToUint64() );
// Recursively check our whole friends list.
m_iFriendIndex++;
CheckWhichFriendsWeAreFollowing();
}
IsUserInSource
bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource );
Name | Type | Description |
steamIDUser | CSteamID | The user to check if they are in the source. |
steamIDSource | CSteamID | The source to check for the user. |
This API is deprecated.Checks if a specified user is in a source (Steam group, chat room, lobby, or game server).
Returns: bool
true if the local user can see that
steamIDUser
is a member or in
steamIDSource
; otherwise,
false.
JoinClanChatRoom
SteamAPICall_t JoinClanChatRoom( CSteamID steamIDClan );
Name | Type | Description |
steamIDClan | CSteamID | The Steam ID of the Steam group to join. |
Allows the user to join Steam group (clan) chats right within the game.
The behavior is somewhat complicated, because the user may or may not be already in the group chat from outside the game or in the overlay.
You can use
ActivateGameOverlayToUser to open the in-game overlay version of the chat.
If you have joined a Steam group chat then you should be watching for the following callbacks:
Returns: SteamAPICall_t to be used with a
JoinClanChatRoomCompletionResult_t call result.
Triggers a
GameConnectedChatJoin_t callback.
Triggers a
GameConnectedClanChatMsg_t callback.
See Also: LeaveClanChatRoom,
GetClanChatMemberCount,
GetChatMemberByIndex,
SendClanChatMessage,
GetClanChatMessage,
IsClanChatAdmin,
IsClanChatWindowOpenInSteamLeaveClanChatRoom
bool LeaveClanChatRoom( CSteamID steamIDClan );
Name | Type | Description |
steamIDClan | CSteamID | The Steam ID of the Steam group chat to leave. |
Leaves a Steam group chat that the user has previously entered with
JoinClanChatRoom.
Returns: bool
Triggers a
GameConnectedChatLeave_t callback.
true if user is in the specified chat room, otherwise
false.
OpenClanChatWindowInSteam
bool OpenClanChatWindowInSteam( CSteamID steamIDClanChat );
Name | Type | Description |
steamIDClanChat | CSteamID | The Steam ID of the Steam group chat room to open. |
Opens the specified Steam group chat room in the Steam UI.
Returns: bool
true if the user successfully entered the Steam group chat room.
false in one of the following situations:
- The provided Steam group chat room does not exist or the user does not have access to join it.
- The current user is currently rate limited.
- The current user is chat restricted.
See Also: IsClanChatWindowOpenInSteam,
CloseClanChatWindowInSteamReplyToFriendMessage
bool ReplyToFriendMessage( CSteamID steamIDFriend, const char *pchMsgToSend );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam ID of the friend to send the message to. |
pchMsgToSend | const char * | The UTF-8 formatted message to send. |
Sends a message to a Steam friend.
Returns: bool
true if the message was successfully sent.
false if the current user is rate limited or chat restricted.
RequestClanOfficerList
SteamAPICall_t RequestClanOfficerList( CSteamID steamIDClan );
Name | Type | Description |
steamIDClan | CSteamID | The Steam group to get the officers list for. |
Requests information about a Steam group officers (administrators and moderators).
NOTE: You can only ask about Steam groups that a user is a member of.
NOTE: This won't download avatars for the officers automatically. If no avatar image is available for an officer, then call
RequestUserInformation to download the avatar.
Returns: SteamAPICall_t to be used with a
ClanOfficerListResponse_t call result.
See Also: GetClanOwner,
GetClanOfficerCount,
GetClanOfficerByIndexExample:class CClanOfficerListExample
{
public:
void RequestOfficerList();
private:
void OnClanOfficerListResponse( ClanOfficerListResponse_t *pCallback, bool bIOFailure );
CCallResult< CClanOfficerListExample, ClanOfficerListResponse_t > m_SteamCallResultClanOfficerListResponse;
};
void CClanOfficerListExample::RequestOfficerList()
{
printf( "Requesting the Clan Officer List\n" );
const CSteamID SteamworksDevGroup = 103582791433474333ull;
SteamAPICall_t handle = SteamFriends()->RequestClanOfficerList( SteamworksDevGroup );
m_SteamCallResultClanOfficerListResponse.Set( handle, this, &CClanOfficerListExample::OnClanOfficerListResponse );
}
void CClanOfficerListExample::OnClanOfficerListResponse( ClanOfficerListResponse_t *pCallback, bool bIOFailure )
{
if ( !pCallback->m_bSuccess || bIOFailure )
{
printf( "ClanOfficerListResponse failed for %lld!", pCallback->m_steamIDClan.ConvertToUint64() );
return;
}
printf( "Got a ClanOfficerListResponse for: %s (%lld)\n", SteamFriends()->GetClanName( pCallback->m_steamIDClan ), pCallback->m_steamIDClan.ConvertToUint64() );
CSteamID ownerSteamID = SteamFriends()->GetClanOwner(pCallback->m_steamIDClan);
printf( " The owner of the clan is: %s (%lld) and there are %d officers.\n", SteamFriends()->GetFriendPersonaName( ownerSteamID ),
ownerSteamID.ConvertToUint64(), pCallback->m_cOfficers );
int nOfficers = SteamFriends()->GetClanOfficerCount( pCallback->m_steamIDClan );
printf( " GetClanOfficerCount reports: %d", nOfficers );
for ( int i = 0; i < nOfficers; ++i )
{
CSteamID officerSteamID = SteamFriends()->GetClanOfficerByIndex( pCallback->m_steamIDClan, i );
printf( " Officer %d: %s (%lld)\n", i, SteamFriends()->GetFriendPersonaName(officerSteamID), officerSteamID.ConvertToUint64() );
}
}
RequestFriendRichPresence
void RequestFriendRichPresence( CSteamID steamIDFriend );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam ID of the user to request the rich presence of. |
Requests Rich Presence data from a specific user.
This is used to get the Rich Presence information from a user that is not a friend of the current user, like someone in the same lobby or game server.
This function is rate limited, if you call this too frequently for a particular user then it will just immediately post a callback without requesting new data from the server.
Returns: void
Triggers a
FriendRichPresenceUpdate_t callback.
See Also: GetFriendRichPresence,
SetRichPresenceRequestUserInformation
bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly );
Name | Type | Description |
steamIDUser | CSteamID | The user to request the information of. |
bRequireNameOnly | bool | Retrieve the Persona name only (true)? Or both the name and the avatar (false)? |
Requests the persona name and optionally the avatar of a specified user.
NOTE: It's a lot slower to download avatars and churns the local cache, so if you don't need avatars, don't request them.
Returns: bool
Triggers a
PersonaStateChange_t callback.
true means that the data has being requested, and a
PersonaStateChange_t callback will be posted when it's retrieved.
false means that we already have all the details about that user, and functions that require this information can be used immediately.
SendClanChatMessage
bool SendClanChatMessage( CSteamID steamIDClanChat, const char *pchText );
Name | Type | Description |
steamIDClanChat | CSteamID | The Steam ID of the group chat to send the message to. |
pchText | const char * | The UTF-8 formatted message to send. This can be up to 2048 characters long. |
Sends a message to a Steam group chat room.
Returns: bool
true if the message was successfully sent.
false under one of the following circumstances:
- The current user is not in the specified group chat.
- The current user is not connected to Steam.
- The current user is rate limited.
- The current user is chat restricted.
- The message in
pchText
exceeds 2048 characters.
SetInGameVoiceSpeaking
void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking );
Name | Type | Description |
steamIDUser | CSteamID | Unused. |
bSpeaking | bool | Did the user start speaking in game (true) or stopped speaking in game (false)? |
Let Steam know that the user is currently using voice chat in game.
This will suppress the microphone for all voice communication in the Steam UI.
SetListenForFriendsMessages
bool SetListenForFriendsMessages( bool bInterceptEnabled );
Name | Type | Description |
bInterceptEnabled | bool | Turn friends message interception on (true) or off (false)? |
Listens for Steam friends chat messages.
You can then show these chats inline in the game. For example, the chat system in Dota 2.
After enabling this you will receive
GameConnectedFriendChatMsg_t callbacks whenever the user receives a chat message. You can get the actual message data from this callback with
GetFriendMessage. You can send messages with
ReplyToFriendMessage.
Returns: bool
Triggers a
GameConnectedFriendChatMsg_t callback.
Always returns
true.
SetPersonaName
SteamAPICall_t SetPersonaName( const char *pchPersonaName );
Name | Type | Description |
pchPersonaName | const char * | The users new persona name. Can not be longer than k_cchPersonaNameMax bytes. |
Sets the current user's persona name, stores it on the server and publishes the changes to all friends who are online.
Changes take place locally immediately, and a
PersonaStateChange_t callback is posted, presuming success.
If the name change fails to happen on the server, then an additional
PersonaStateChange_t callback will be posted to change the name back, in addition to the final result available in the call result.
Returns: SteamAPICall_t to be used with a
SetPersonaNameResponse_t call result.
SetPlayedWith
void SetPlayedWith( CSteamID steamIDUserPlayedWith );
Name | Type | Description |
steamIDUserPlayedWith | CSteamID | The other user that we have played with. |
Mark a target user as 'played with'.
NOTE: The current user must be in game with the other player for the association to work.
You can view the players you have recently played with
here on the Steam community and in the
Steam Overlay.
SetRichPresence
bool SetRichPresence( const char *pchKey, const char *pchValue );
Name | Type | Description |
pchKey | const char * | The rich presence 'key' to set. This can not be longer than specified in k_cchMaxRichPresenceKeyLength. |
pchValue | const char * | The rich presence 'value' to associate with pchKey . This can not be longer than specified in k_cchMaxRichPresenceValueLength. If this is set to an empty string ("") or NULL then the key is removed if it's set. |
Sets a Rich Presence key/value for the current user that is automatically shared to all friends playing the same game.
Each user can have up to 20 keys set as defined by
k_cchMaxRichPresenceKeys.
There are two special keys used for viewing/joining games:
- "status" - A UTF-8 string that will show up in the 'view game info' dialog in the Steam friends list.
- "connect" - A UTF-8 string that contains the command-line for how a friend can connect to a game. This enables the 'join game' button in the 'view game info' dialog, in the steam friends list right click menu, and on the players Steam community profile. Be sure your app implements ISteamApps::GetLaunchCommandLine so you can disable the popup warning when launched via a command line.
There are three additional special keys used by the
new Steam Chat:
- "steam_display" - Names a rich presence localization token that will be displayed in the viewing user's selected language in the Steam client UI. See Rich Presence Localization for more info, including a link to a page for testing this rich presence data. If steam_display is not set to a valid localization tag, then rich presence will not be displayed in the Steam client.
- "steam_player_group" - When set, indicates to the Steam client that the player is a member of a particular group. Players in the same group may be organized together in various places in the Steam UI. This string could identify a party, a server, or whatever grouping is relevant for your game. The string itself is not displayed to users.
- "steam_player_group_size" - When set, indicates the total number of players in the steam_player_group. The Steam client may use this number to display additional information about a group when all of the members are not part of a user's friends list. (For example, "Bob, Pete, and 4 more".)
You can clear all of the keys for the current user with
ClearRichPresence.
To get rich presence keys for friends see:
GetFriendRichPresence.
Returns: bool
true if the rich presence was set successfully.
false under the following conditions:
RequestEquippedProfileItems
SteamAPICall_t RequestEquippedProfileItems( CSteamID steamID);
Name | Type | Description |
steamID | CSteamID | The user that you want to retrieve equipped items for. |
Requests the list of equipped Steam Community profile items for the given user from Steam.
Returns: SteamAPICall_t to be used with a
EquippedProfileItems_t call result.
BHasEquippedProfileItem
bool BHasEquippedProfileItem( CSteamID steamID, ECommunityProfileItemType itemType);
Name | Type | Description |
steamID | CSteamID | The user that you had already retrieved equipped items for |
itemType | ECommunityProfileItemType | Type of item you want to see is equipped or not |
After calling
RequestEquippedProfileItems, you can use this function to check if the user has a type of profile item equipped or not.
Returns: bool
true if the itemType is equipped for the user
false if the itemType is not equipped for the user
See Also: RequestEquippedProfileItems,
GetProfileItemPropertyString,
GetProfileItemPropertyUintGetProfileItemPropertyString
bool GetProfileItemPropertyString( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop);
Returns a string property for a user's equipped profile item.
Returns: const char *
See Also: RequestEquippedProfileItems,
GetProfileItemPropertyUintGetProfileItemPropertyUint
bool GetProfileItemPropertyUint( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop);
Returns an unsigned integer property for a user's equipped profile item.
Returns: uint32
See Also: RequestEquippedProfileItems,
GetProfileItemPropertyStringCallbacks
These are callbacks which can be fired by calling
SteamAPI_RunCallbacks. Many of these will be fired directly in response to the member functions of
ISteamFriends
.
AvatarImageLoaded_t
Called when a large avatar is loaded if you have tried requesting it when it was unavailable.
Name | Type | Description |
m_steamID | CSteamID | The Steam ID that the avatar has been loaded for. |
m_iImage | int | The Steam image handle of the now loaded image. |
m_iWide | int | Width of the loaded image. |
m_iTall | int | Height of the loaded image. |
Associated Functions: GetLargeFriendAvatarClanOfficerListResponse_t
Marks the return of a request officer list call.
Name | Type | Description |
m_steamIDClan | CSteamID | The Steam group that we just got the officer list for. |
m_cOfficers | int | The number of officers in the group. This is the same as GetClanOfficerCount. |
m_bSuccess | uint8 | Was the call successful? If it wasn't this may indicate a temporary loss of connection to Steam. If this returns true, this does not necessarily mean that all of the info for this Steam group has been downloaded. |
Associated Functions: RequestClanOfficerListDownloadClanActivityCountsResult_t
Called when a Steam group activity has been received.
Name | Type | Description |
m_bSuccess | bool | Was the call successful? |
Associated Functions: DownloadClanActivityCountsFriendRichPresenceUpdate_t
Called when Rich Presence data has been updated for a user, this can happen automatically when friends in the same game update their rich presence, or after a call to
RequestFriendRichPresence.
Name | Type | Description |
m_steamIDFriend | CSteamID | The Steam ID of the user who's rich presence has changed. |
m_nAppID | AppId_t | The App ID of the game. This should always be the current game. |
Associated Functions: RequestFriendRichPresenceFriendsEnumerateFollowingList_t
Returns the result of
EnumerateFollowingList.
Name | Type | Description |
m_eResult | EResult | The result of the operation. |
m_rgSteamID | CSteamID[k_cEnumerateFollowersMax] | The list of users that we are following. |
m_nResultsReturned | int32 | The number of results returned in m_rgSteamID . |
m_nTotalResultCount | int32 | The total number of people we are following. If this is greater than m_nResultsReturned Then you should make a subsequent call to EnumerateFollowingList with m_nResultsReturned as the index to get the next portion of followers. |
Associated Functions: EnumerateFollowingListFriendsGetFollowerCount_t
Returns the result of
GetFollowerCount.
Name | Type | Description |
m_eResult | EResult | The result of the operation. |
m_steamID | CSteamID | The Steam ID of the user we requested the follower count for. |
m_nCount | int | The number of followers the user has. |
Associated Functions: GetFollowerCountFriendsIsFollowing_t
Returns the result of
IsFollowing.
Name | Type | Description |
m_eResult | EResult | The result of the operation. |
m_steamID | CSteamID | The Steam ID that was checked. |
m_bIsFollowing | bool | Are we following the user? (true) or not? (false) |
Associated Functions: IsFollowingGameConnectedChatJoin_t
Called when a user has joined a Steam group chat that we are in.
Name | Type | Description |
m_steamIDClanChat | CSteamID | The Steam ID of the chat that a user has joined. |
m_steamIDUser | CSteamID | The Steam ID of the user that has joined the chat. |
Associated Functions: JoinClanChatRoomGameConnectedChatLeave_t
Called when a user has left a Steam group chat that the we are in.
Name | Type | Description |
m_steamIDClanChat | CSteamID | The Steam ID of the chat that a user has left. |
m_steamIDUser | CSteamID | The Steam ID of the user that has left the chat. |
m_bKicked | bool | Was the user kicked by an officer (true), or not (false)? |
m_bDropped | bool | Was the user's connection to Steam dropped (true), or did they leave via other means (false)? |
Associated Functions: LeaveClanChatRoomGameConnectedClanChatMsg_t
Called when a chat message has been received in a Steam group chat that we are in.
Name | Type | Description |
m_steamIDClanChat | CSteamID | The Steam ID of the chat that the message was received in. |
m_steamIDUser | CSteamID | The Steam ID of the user that sent the message. |
m_iMessageID | int | The index of the message to get the actual data from with GetClanChatMessage. |
Associated Functions: JoinClanChatRoomGameConnectedFriendChatMsg_t
Called when chat message has been received from a friend.
Name | Type | Description |
m_steamIDUser | CSteamID | The Steam ID of the friend that sent the message. |
m_iMessageID | int | The index of the message to get the actual data from with GetFriendMessage. |
Associated Functions: SetListenForFriendsMessagesGameLobbyJoinRequested_t
Called when the user tries to join a lobby from their friends list or from an invite. The game client should attempt to connect to specified lobby when this is received. If the game isn't running yet then the game will be automatically launched with the command line parameter
+connect_lobby <64-bit lobby Steam ID>
instead.
Name | Type | Description |
m_steamIDLobby | CSteamID | The Steam ID of the lobby to connect to. |
m_steamIDFriend | CSteamID | The friend they joined through. This will be invalid if not directly via a friend. |
NOTE: This callback is made when joining a lobby. If the user is attempting to join a game but not a lobby, then the callback
GameRichPresenceJoinRequested_t will be made.
GameOverlayActivated_t
Posted when the
Steam Overlay activates or deactivates. The game can use this to pause or resume single player games.
Name | Type | Description |
m_bActive | uint8 | 1 if it's just been activated, otherwise 0. |
GameRichPresenceJoinRequested_t
Called when the user tries to join a game from their friends list or after a user accepts an invite by a friend with
InviteUserToGame.
Name | Type | Description |
m_steamIDFriend | CSteamID | The friend they joined through. This will be invalid if not directly via a friend. |
m_rgchConnect | char[k_cchMaxRichPresenceValueLength] | The value associated with the "connect" Rich Presence key. |
Associated Functions: InviteUserToGameNOTE: This callback is made when joining a game. If the user is attempting to join a lobby, then the callback
GameLobbyJoinRequested_t will be made.
GameServerChangeRequested_t
Called when the user tries to join a different game server from their friends list. The game client should attempt to connect to the specified server when this is received.
Name | Type | Description |
m_rgchServer | char[64] | Server address (e.g. "127.0.0.1:27015", "tf2.valvesoftware.com") |
m_rgchPassword | char[64] | Server password, if any. |
JoinClanChatRoomCompletionResult_t
Posted when the user has attempted to join a Steam group chat via
JoinClanChatRoom Name | Type | Description |
m_steamIDClanChat | CSteamID | The Steam ID of the chat that the user has joined. |
m_eChatRoomEnterResponse | EChatRoomEnterResponse | The result of the operation. |
Associated Functions: JoinClanChatRoomPersonaStateChange_t
Called whenever a friends' status changes.
Name | Type | Description |
m_ulSteamID | uint64 | Steam ID of the user who changed. |
m_nChangeFlags | int | A bit-wise union of EPersonaChange values. |
Associated Functions: RequestUserInformationSetPersonaNameResponse_t
Reports the result of an attempt to change the current user's persona name.
Name | Type | Description |
m_bSuccess | bool | true if name change completed successfully. |
m_bLocalSuccess | bool | true if name change was retained locally. We might not have been able to communicate with Steam. |
m_result | EResult | The result of the operation. |
Associated Functions: SetPersonaNameStructs
These are structs which functions in ISteamFriends may return and/or interact with.
FriendGameInfo_t
Information about the game a friend is playing.
Obtainable from:
GetFriendGamePlayed.
Name | Type | Description |
m_gameID | CGameID | The game ID that the friend is playing. |
m_unGameIP | uint32 | The IP of the server the friend is playing on. |
m_usGamePort | uint16 | The port of the server the friend is playing on. |
m_usQueryPort | uint16 | The query port of the server the friend is playing on. |
m_steamIDLobby | CSteamID | The Steam ID of the lobby the friend is in. |
FriendSessionStateInfo_t
Information about user sessions. (Steam Internal usage only.)
Name | Type | Description |
m_uiOnlineSessionInstances | uint32 | |
m_uiPublishedToFriendsSessionInstance | uint8 | |
EquippedProfileItemsChanged_t
Callback for when a user's equipped Steam Community profile items have changed. This can be for the current user or their friends.
EquippedProfileItems_t
CallResult from
RequestEquippedProfileItems. Also sent as a
Callback.
Name | Type | Description |
m_eResult | EResult | |
m_bHasAnimatedAvatar | CSteamID | |
m_bHasAvatarFrame | bool | |
m_bHasProfileModifier | bool | |
m_bHasProfileBackground | bool | |
m_bHasMiniProfileBackground | bool | |
Enums
These are enums which are defined for use with ISteamFriends.
EFriendFlags
Flags for enumerating friends list, or quickly checking the relationship between users.
Name | Value | Description |
k_EFriendFlagNone | 0x00 | None. |
k_EFriendFlagBlocked | 0x01 | Users that the current user has blocked from contacting. |
k_EFriendFlagFriendshipRequested | 0x02 | Users that have sent a friend invite to the current user. |
k_EFriendFlagImmediate | 0x04 | The current user's "regular" friends. |
k_EFriendFlagClanMember | 0x08 | Users that are in one of the same (small) Steam groups as the current user. |
k_EFriendFlagOnGameServer | 0x10 | Users that are on the same game server; as set by SetPlayedWith. |
k_EFriendFlagRequestingFriendship | 0x80 | Users that the current user has sent friend invites to. |
k_EFriendFlagRequestingInfo | 0x100 | Users that are currently sending additional info about themselves after a call to RequestUserInformation |
k_EFriendFlagIgnored | 0x200 | Users that the current user has ignored from contacting them. |
k_EFriendFlagIgnoredFriend | 0x400 | Users that have ignored the current user; but the current user still knows about them. |
k_EFriendFlagChatMember | 0x1000 | Users in one of the same chats. |
k_EFriendFlagAll | 0xFFFF | Returns all friend flags. |
EFriendRelationship
Declares the set of relationships that Steam users may have.
Name | Value | Description |
k_EFriendRelationshipNone | 0 | The users have no relationship. |
k_EFriendRelationshipBlocked | 1 | The user has just clicked Ignore on an friendship invite. This doesn't get stored. |
k_EFriendRelationshipRequestRecipient | 2 | The user has requested to be friends with the current user. |
k_EFriendRelationshipFriend | 3 | A "regular" friend. |
k_EFriendRelationshipRequestInitiator | 4 | The current user has sent a friend invite. |
k_EFriendRelationshipIgnored | 5 | The current user has explicit blocked this other user from comments/chat/etc. This is stored. |
k_EFriendRelationshipIgnoredFriend | 6 | The user has ignored the current user. |
k_EFriendRelationshipSuggested_DEPRECATED | 7 | Deprecated -- Unused. |
k_EFriendRelationshipMax | 8 | The total number of friend relationships used for looping and verification. |
EOverlayToStoreFlag
These values are passed as parameters to the store with
ActivateGameOverlayToStore and modify the behavior when the page opens.
Name | Value | Description |
k_EOverlayToStoreFlag_None | 0 | No |
k_EOverlayToStoreFlag_AddToCart | 1 | Deprecated, now works the same as k_EOverlayToStoreFlag_AddToCartAndShow. |
k_EOverlayToStoreFlag_AddToCartAndShow | 2 | Add the specified app ID to the users cart and show the store page. |
EPersonaChange
used in PersonaStateChange_t::m_nChangeFlags to describe what's changed about a user
these flags describe what the client has learned has changed recently, so on startup you'll see a name, avatar & relationship change for every friend
Name | Value | Description |
k_EPersonaChangeName | 0x0001 | |
k_EPersonaChangeStatus | 0x0002 | |
k_EPersonaChangeComeOnline | 0x0004 | |
k_EPersonaChangeGoneOffline | 0x0008 | |
k_EPersonaChangeGamePlayed | 0x0010 | |
k_EPersonaChangeGameServer | 0x0020 | |
k_EPersonaChangeAvatar | 0x0040 | |
k_EPersonaChangeJoinedSource | 0x0080 | |
k_EPersonaChangeLeftSource | 0x0100 | |
k_EPersonaChangeRelationshipChanged | 0x0200 | |
k_EPersonaChangeNameFirstSet | 0x0400 | |
k_EPersonaChangeFacebookInfo | 0x0800 | |
k_EPersonaChangeNickname | 0x1000 | |
k_EPersonaChangeSteamLevel | 0x2000 | |
EPersonaState
List of states a Steam friend can be in.
Name | Value | Description |
k_EPersonaStateOffline | 0 | Friend is not currently logged on. |
k_EPersonaStateOnline | 1 | Friend is logged on. |
k_EPersonaStateBusy | 2 | Friend is logged on, but set to "Do not disturb." |
k_EPersonaStateAway | 3 | Auto-away feature. |
k_EPersonaStateSnooze | 4 | Auto-away for a long time. |
k_EPersonaStateLookingToTrade | 5 | Online, trading. |
k_EPersonaStateLookingToPlay | 6 | Online, wanting to play. |
k_EPersonaStateMax | 7 | The total number of states. Only used for looping and validation. |
EUserRestriction
User restriction flags. These are returned by
GetUserRestrictions.
Name | Value | Description |
k_nUserRestrictionNone | 0 | No known chat/content restriction. |
k_nUserRestrictionUnknown | 1 | We don't know yet, the user is offline. |
k_nUserRestrictionAnyChat | 2 | User is not allowed to (or can't) send/recv any chat. |
k_nUserRestrictionVoiceChat | 4 | User is not allowed to (or can't) send/recv voice chat. |
k_nUserRestrictionGroupChat | 8 | User is not allowed to (or can't) send/recv group chat. |
k_nUserRestrictionRating | 16 | User is too young according to rating in current region. |
k_nUserRestrictionGameInvites | 32 | User cannot send or recv game invites, for example if they are on mobile. |
k_nUserRestrictionTrading | 64 | User cannot participate in trading, for example if they are on a console or mobile. |
ECommunityProfileItemType
Steam Community profile item types
ECommunityProfileItemProperty
Properties on a Steam Community profile item. See
GetProfileItemPropertyString and
GetProfileItemPropertyUint.
EActivateGameOverlayToWebPageMode
Game Overlay web page modes
Name | Value | Description |
k_EActivateGameOverlayToWebPageMode_Default | 0 | Browser will open next to all other windows that the user has open in the overlay. The window will remain open, even if the user closes then re-opens the overlay. |
k_EActivateGameOverlayToWebPageMode_Modal | 1 | Browser will be opened in a special overlay configuration which hides all other windows that the user has open in the overlay. When the user closes the overlay, the browser window will also close. When the user closes the browser window, the overlay will automatically close. |
Typedefs
These are typedefs which are defined for use with ISteamFriends.
Name | Base type | Description |
FriendsGroupID_t | int16 | Friends group (tags) identifier. |
Constants
These are constants which are defined for use with ISteamFriends.
Name | Type | Value | Description |
k_cchMaxFriendsGroupName | int | 64 | The maximum length that a friends group name can be (not including the null-terminator!) |
k_cchMaxRichPresenceKeyLength | int | 64 | The maximum length that a rich presence key can be. |
k_cchMaxRichPresenceKeys | int | 20 | The maximum amount of rich presence keys that can be set. |
k_cchMaxRichPresenceValueLength | int | 256 | The maximum length that a rich presence value can be. |
k_cchPersonaNameMax | int | 128 | Maximum number of UTF-8 bytes in a users persona (display) name. |
k_cEnumerateFollowersMax | int | 50 | The maximum number of followers that will be returned in a FriendsEnumerateFollowingList_t call result at once. |
k_cFriendsGroupLimit | int | 100 | Deprecated - Unused. |
k_cubChatMetadataMax | uint32 | 8192 | Maximum size in bytes that chat room, lobby, or chat/lobby member metadata may have. |
k_cwchPersonaNameMax | int | 32 | The maximum amount of UTF-16 characters in a users persona (display) name. |
k_FriendsGroupID_Invalid | FriendsGroupID_t | -1 | Invalid friends group identifier. |
STEAMFRIENDS_INTERFACE_VERSION | const char * | "SteamFriends015" | |
Rich Presence Localization
Localization for rich presence is a list of token names and values provided for each supported language. Token names begin a # and can contain any alphanumeric character and underscores. Token values contain localized text, and may also contain
substitutions, which specify portions of the string to be replaced by other rich presence values.
- The simplest token is plain localized text:
"#Status_AtMainMenu" "At the Main Menu"
In the example above, if steam_display
is set to #Status_AtMainMenu
using SetRichPresence, then "At the Main Menu
" will be displayed alongside the player's information in the Steam client.
- A substitution looks like this:
"#StatusWithScore" "Score: %score%"
In this case, if steam_display
is set to "#StatusWithScore
" using SetRichPresence and "score
" is set to "3
" using the same API, then "Score: 3
" will be displayed alongside the player's information in the Steam client.
- Substitutions can also trigger additional localization by enclosing a substring with braces. For example:
"#PlayingHero" "Playing: {#Hero_%hero%}"
"#Hero_Tidehunter" "Tidehunter"
Substitutions on the brace-delimited substring are performed first, then the resultant tag is localized. In this instance, if steam_display
is set to "#PlayingHero
" and "hero
" is set to "Tidehunter
", the Steam client will localize "#Hero_Tidehunter
" and display "Playing: Tidehunter
".
Note: Rich presence keys used in substitutions may only contain alphanumeric characters, underscores, and colons.
In the case where a localization token is not found, the system will attempt to fallback to English. If English is also not found, then rich presence will not be displayed in the Steam client. Similarly, if a token specifies a substitution using a rich presence key that is not set, then rich presence will not be displayed in the Steam client.
The game developer provides the rich presence localization file under the Rich Presence section of the Community tab which can be found through the Edit Steamworks Settings page.
For testing, http://www.steamcommunity.com/dev/testrichpresence can be used to display the localized rich presence string for the logged in user, as well as some error information about incomplete or incorrect data. The string will be localized into whatever language has been set for the Steam website.
Each language can be uploaded individually in files that look like this:
"lang"
{
"english"
{
"tokens"
{
"#StatusWithoutScore" "{#Status_%gamestatus%}"
"#StatusWithScore" "{#Status_%gamestatus%}: %score%"
"#Status_AtMainMenu" "At the main menu"
"#Status_WaitingForMatch" "Waiting for match"
"#Status_Winning" "Winning"
"#Status_Losing" "Losing"
"#Status_Tied" "Tied"
}
}
}
Multiple languages can also be included in a single upload. Only languages present in the file are overwritten.
"lang"
{
"english"
{
"tokens"
{
"#StatusWithoutScore" "{#Status_%gamestatus%}"
"#StatusWithScore" "{#Status_%gamestatus%}: %score%"
"#Status_AtMainMenu" "At the main menu"
"#Status_WaitingForMatch" "Waiting for match"
"#Status_Winning" "Winning"
"#Status_Losing" "Losing"
"#Status_Tied" "Tied"
}
}
"french"
{
"tokens"
{
"#Status_AtMainMenu" "Au menu principal"
"#Status_WaitingForMatch" "En attente de match"
"#Status_Winning" "Gagnant"
"#Status_Losing" "Perdant"
"#Status_Tied" "Egalité"
}
}
}