How can a schizophrenia can prevent from getting a nightmare?

It cannot. Having schizophrenia does not prevent nightmares. Sometimes, folks with schizophrenia have hallucinations which they think is like a daytime dream. Also, there are certain medications which seem to decrease a person's dreaming all together or create a situation whereby they don't remember their dreams. Such medicines have a property called rem suppression.