Send a Respond to Friend Invites #
A player can send an invite to another player using the player’s social ID or display name. Social IDs and display names may be visible in game instances, on leaderboards, or communicated through methods outside of Pragma, such as via voice chat or direct message. Developers can access the SocialId
and DisplayName
via the Party Player object. Pragma recommends sending invites by socialId if possible because display names can easily change. However, display names may be preferable if manually typing in a value.
When called, SendFriendInviteByDisplayName()
and SendFriendInviteBySocialId()
add a pending sent invite to the inviter’s friend list, and a pending received invite to the invitee’s friend list.
Players cannot send invites to players if they are on the player’s blocklist. Similarly, you cannot send a friend invite to an account on your blocklist. Doing so will result in a Friend_InviteeIsBlocked
error.
If a player’s number of pending received or sent invites is at its max, they will receive a Friend_InviteeReceivedInvitesFull
or Friend_InviteeReceivedInvitesFull
error, respectively.
Invites do not expire.
Send a friend invite by social ID #
To send a friend invite using the invitee’s social ID, use the Friend API’s SendFriendInviteBySocialId()
method.
Player->FriendApi().SendFriendInviteBySocialId(
const FString& SocialId,
const FOnCompleteDelegate& OnComplete
);
Player.FriendApi.SendFriendInviteBySocialId(
PragmaId socialId,
CompleteDelegate onComplete
);
Send a friend invite by display name #
To send a friend invite using the invitee’s display name, use the Friend API’s SendFriendInviteByDisplayName()
method.
Player->FriendApi().SendFriendInviteByDisplayName(
const FPragma_Account_DisplayName& DisplayName,
const FOnCompleteDelegate& OnComplete
);
Player.FriendApi.SendFriendInviteByDisplayName(
DisplayName displayName,
CompleteDelegate onComplete
);
Related events:
Related errors:
- Friend_BlockedByInvitee
- Friend_InviteeReceivedInvitesFull
- Friend_SocialIdentityNotFound
- Friend_InviteeIsBlocked
- Friend_SelfOperationNotAllowed
Cancel a sent friend invite #
Players can cancel previously sent friend invites using the FriendApi.CancelFriendInvite()
method with the invitee’s social ID:
Player->FriendApi().CancelFriendInvite(
const FString& SocialId,
const FOnCompleteDelegate& OnComplete
);
Player.FriendApi.CancelFriendInvite(
PragmaId socialId,
CompleteDelegate onComplete
);
The inviter will receive the OnSentInvitesChanged
event, and the invitee will receive the OnReceivedInvitesChanged
and the OnFriendInviteCanceled
events.
Accept a friend invite #
To accept a friend invite, use the Friend API’s AcceptFriendInvite()
method with the inviter’s socialId
. When accepted, the inviter and invitee are added to each other’s friend list.
Player->FriendApi().AcceptFriendInvite(
const FString& InviterSocialId,
const FOnCompleteDelegate& OnComplete
);
Player.FriendApi.AcceptFriendInvite(
PragmaId inviterSocialId,
CompleteDelegate onComplete
);
To view pending friend invites, use GetReceivedInvites()
.
Related events:
Related errors:
Decline a friend invite #
To decline a friend invite, use the Friend API’s DeclineFriendInvite()
method with the inviter’s social ID.
Player->FriendApi().DeclineFriendInvite(
const FString& InviterSocialId,
const FOnCompleteDelegate& OnComplete
);
Player.FriendApi.DeclineFriendInvite(
PragmaId inviterSocialId,
CompleteDelegate onComplete
);
To view pending friend invites, use GetReceivedInvites()
.
Related events:
Related errors: