Skip to main content

SDK Integration

Join a party

A party can be joined by calling the JoinParty(). If the party does not exist when the function call is made, it will be created.

#include "FACEITGameClientSDK/Party/Party.h"
#include "FACEITGameClientSDK/Utility/StringHelpers.h"

void MyGameInstance::JoinParty(const char* partyID)
{
// Make a request to join a party with the provided party ID.
// Provide a response callback that is called once the request completes.
const FGCSDK_Party_ResultCode result = FGCSDK_Party_Join(partyID,
[](const FGCSDK_BasicWebRequestResponseInfo* response)
{
// The JoinParty response has been performed
// successfully.
if ( response->errorType == FGCSDK_REQ_NO_ERROR )
{
// The user successfully joined the party.
}
else
{
// Handle the error in an appropriate way
// (out of scope of this documentation).
Log("Failed to join party. Error: %s\n",
response->summary);
}
}
);

// If the result is not OK, the JoinParty request could not be started.
// This is usually due to some user error such as not having
// completed the authentication process yet.
if ( result != FGCSDK_PARTY_OK )
{
// Handle the error in an appropriate way
// (out of scope of this documentation).
Log("Failed to make party join request. Error: %s",
FGCSDK_ToString(&FGCSDK_Party_ResultCode_GetDescription, result).c_str());
}
}

Leave a party

A party can be left by calling the LeaveParty(). Once all members of the party leave, the party is destroyed.

#include "FACEITGameClientSDK/Party/Party.h"
#include "FACEITGameClientSDK/Utility/StringHelpers.h"

void MyGameInstance::LeaveParty(const char* partyID)
{
// Make a request to leave a party with the provided party ID.
// Provide a response callback that is called once the request completes.
const FGCSDK_Party_ResultCode result = FGCSDK_Party_Leave(partyID,
[](const FGCSDK_BasicWebRequestResponseInfo* response)
{
// The LeaveParty response has been performed
// successfully.
if ( response->errorType == FGCSDK_REQ_NO_ERROR )
{
// The user successfully left the party.
}
else
{
// Handle the error in an appropriate way
// (out of scope of this documentation).
Log("Failed to leave party. Error: %s\n",
response->summary);
}
}
);

// If the result is not OK, the LeaveParty request could not be started.
// This is usually due to some user error such as not having
// completed the authentication process yet.
if ( result != FGCSDK_PARTY_OK )
{
// Handle the error in an appropriate way
// (out of scope of this documentation).
Log("Failed to make party leave request. Error: %s",
FGCSDK_ToString(&FGCSDK_Party_ResultCode_GetDescription, result).c_str());
}
}