Hi, I am not really good with c++ so I need some help. (but I have good c# background)
I would need to fire the RedeemMatchmakerTicket in the Login function so that I can accept or reject the login.
The problem is that with the current implementation, this is async so I can't wait for the result and decide for the login operation.
Here is my current code.
void APlayfabGameModeBase::BeginPlay() { Super::BeginPlay(); serverAPI = IPlayFabModuleInterface::Get().GetServerAPI(); FString cmdOptions = FCommandLine::Get(); lobbyID = UGameplayStatics::ParseOption(cmdOptions, TEXT("game_id")); } void APlayfabGameModeBase::OnSuccess(const PlayFab::ServerModels::FRedeemMatchmakerTicketResult & Result) const { } void APlayfabGameModeBase::OnError(const PlayFab::FPlayFabCppError & ErrorResult) const { } APlayerController * APlayfabGameModeBase::Login(UPlayer * NewPlayer, ENetRole InRemoteRole, const FString & Portal, const FString & Options, const FUniqueNetIdRepl & UniqueId, FString & ErrorMessage) { FString matchmakeTicket = UGameplayStatics::ParseOption(Options, TEXT("ticket")); PlayFab::ServerModels::FRedeemMatchmakerTicketRequest request; request.Ticket = matchmakeTicket; request.LobbyId = lobbyID; serverAPI->RedeemMatchmakerTicket(request, PlayFab::UPlayFabServerAPI::FRedeemMatchmakerTicketDelegate::CreateUObject(this, &APlayfabGameModeBase::OnSuccess), PlayFab::FPlayFabErrorDelegate::CreateUObject(this, &APlayfabGameModeBase::OnError) ); //--HERE I SHOULD WAIT AND RETURN AND ERROR MESSAGE IF LOGIN IS INVALID--- //call original logic and return APlayerController* const SpawnedPlayerController = AGameModeBase::Login(NewPlayer, InRemoteRole, Portal, Options, UniqueId, ErrorMessage); return SpawnedPlayerController; }
How should I make it so that the Login function waits until the task is executed?
Any extra information about this?
Thanks!