I am developing multiplayer shooter for the final qualifying work at the university. As the OSS I am using EOS with UE OnlineSubsystem API to create sessions and lobbies.
However I also would like to use EOS SDK API in my project in order to use all the necessary features of EOS SDK API.
Here is my OnLoginComplete function
, where I am trying to get EOS_ProductUserId
from FUniqueNerIdString
and parse it to EOS_ProductUserId
with EOS_ProductUserId_FromString
. I write this value to the class member Eos_ProductUserId
:
void ULab4GameInstance::OnLoginComplete(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& Error)
{
const FUniqueNetIdString UniqueNetIdString = static_cast<FUniqueNetIdString>(UserId);
TArray<FString> AccountIds;
UniqueNetIdString.UniqueNetIdStr.ParseIntoArray(AccountIds, EOS_ID_SEPARATOR, false);
FString EpicAccountIdString;
FString ProductUserIdSting;
if (AccountIds.Num() > 1 && AccountIds[1].Len() > 0)
{
ProductUserIdSting = AccountIds[1];
}
if (AccountIds.Num() > 1 && AccountIds[0].Len() > 0)
{
EpicAccountIdString = AccountIds[0];
}
Eos_ProductUserId = EOS_ProductUserId_FromString(TCHAR_TO_UTF8(*ProductUserIdSting));
}
And then I use variable Eos_ProductUserId
in EOS SDK API functions, like this:
EOS_Leaderboards_QueryLeaderboardRanksOptions LeaderboardRanksOptions = {0};
LeaderboardRanksOptions.ApiVersion = EOS_LEADERBOARDS_QUERYLEADERBOARDRANKS_API_LATEST;
LeaderboardRanksOptions.LeaderboardId = TCHAR_TO_UTF8(*FString(TEXT("PlayersFragsLeaderboard")));
LeaderboardRanksOptions.LocalUserId = Eos_ProductUserId;
EOS_Leaderboards_QueryLeaderboardRanks(LeaderboardsHandle, &LeaderboardRanksOptions, nullptr, &CompletionDelegateLeaderboards);
And every time I call the function given below, I always get the same error: EOS_IvalidUser
.
Does anyone know what the problem is?
I know for sure that the problem is not related to memory managment. I guess the problem lies precisely in the ProductUserIdString
, where I don’t take into account the null terminated char or something else.
Please, let me know, if you have an idea, how to fix this issue. Thank you.