Hey you can do the following. (Edited to fix some issues with prev ocde)
auto It = GetWorld()->GetPlayerControllerIterator();
for (int Idx = 0; Idx < 1; ++Idx)
{
if (It->Get() /* && Idx == WANTED_PLAYER_INDEX */ )
break;
++It;
}
APlayerController* PC = *It; // May need to be AYourPlayerController:: instead...
if (PC)
{
// You have your controller
APawn* ThePawn = PC->GetPawn();
if (ThePawn)
{
// Get that controllers pawn
AYourProjectPlayerClass* Player = Cast<AYourProjectPlayerClass>(ThePawn);
if (Player)
{
// You have your Character Class
}
}
}
This is from the top of my head i am at work so i have no chance of testing it for you atm.
Hope it helps.
Edit: BTW to get the IDs for players, you can get the GameState and then use PlayerArray in AGameState::
And credits to Arshia001 for the interation code.