Do not use the old C-style cast. The preferred way would be
APlayerMallet* mallet=Cast<APlayerMallet>(gamestate->PlayerArray[i]->GetPawn());
if(mallet) {
mallet->SomeMethodSpecificToMallet();
}
This is a dynamic cast that makes sure that “mallet” is nullptr if it is not a APlayerMallet instance. Your example would crash if for some reason GetPawn() returns something else.