Retrieve List of Blocked Players
Last updated on
Use the following function to retrieve a list of currently blocked players. This method has a callback that returns an array of data containing the blocked players' User IDs.
- Unreal Engine
- Unity
FRegistry::Lobby.Connect();
FRegistry::Lobby.GetListOfBlockedUsers(THandler<FAccelByteModelsListBlockedUserResponse>::CreateLambda([](const FAccelByteModelsListBlockedUserResponse& Result)
{
// Do something if GetListOfBlockedUsers has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetListOfBlockedUsers has an error
UE_LOG(LogTemp, Log, TEXT("Error GetListOfBlockedUsers, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
AccelBytePlugin.GetLobby().Connect();
AccelBytePlugin.GetLobby().GetListOfBlockedUser(result =>
{
if (result.IsError)
{
// Do something if GetListOfBlockedUser has an error
Debug.Log($"Error GetListOfBlockedUser, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetListOfBlockedUser has been successful
}
});
Retrieve List of Blocked Players by User ID
Use the following function to retrieve a list of blocked players specific to a certain user, based on their User ID.
- Unreal Engine
FRegistry::Lobby.Connect();
FRegistry::Lobby.GetListOfBlockedUsers(UserId, THandler<FAccelByteModelsListBlockedUserResponse>::CreateLambda([](const FAccelByteModelsListBlockedUserResponse& Result)
{
// Do something if GetListOfBlockedUsers has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetListOfBlockedUsers has an error
UE_LOG(LogTemp, Log, TEXT("Error GetListOfBlockedUsers, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));