How do i get the player position from c++ script?

I finally got it !!!
Thank you so much guys !

void ABoss_Character::getPlayerPosition() {

FVector MyCharacterPosition = GetWorld()->GetFirstPlayerController()->GetPawn()->GetActorLocation();

GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, FString::Printf(TEXT("Player Location: %s"), *MyCharacterPosition.ToString()));

}

This is the function in case someone needs it in the future

2 Likes