Types of Dreams in Islam
Question

I was wondering if it is possible to have warning dreams. I recently had a few dreams where someone is trying to harm one of my family members, physically and by slandering. Well, that’s what I get from the dream. I didn’t tell my family member the dream, but just to ask Allah for protection, because though others might plan against my family, I know Allah is the best of planners. Was I wrong for telling my family member that I fear others are trying to harm u, please make dua to Allah for protection? Insha Allah, I hope that I didn’t do anything wrong.
Praise be to Allah.We ask Allah to protect us and you from all bad and evil things and to divert from us and from you the plots of the devils among mankind and the jinn, for He is the best of protectors and the Most merciful of those who show mercy.
Types of dreams in Islam
With regard to what the sleeper sees in his sleep, it falls into three categories:

good dreams which come from Allah;
bad dreams which come from the devil;
and what a person is thinking about.

Good dreams in Islam
Good dreams are those in which the sleeper sees good things; they come from Allah. They may be meant as good news, or warning against evil, or helping and guiding. It is Sunnah to praise Allah for them and to tell one’s loved ones, but not others, about them.
Bad dreams in Islam
Bad dreams are those in which the sleeper sees bad things; they come from the devil. It is Sunnah to seek refuge with Allah from them and to spit to the left three times, and not to talk about them, but if a person does that it will not harm him. It is also recommended to turn onto one`s other side, and to pray two Rak`ahs.
Confused dreams in Islam
It may be that what one sees is not a dream of either of these two types, rather it stems from what one is thinking about. This is called confused dreams and it stems from events and fears stored in the memory and subconscious, which are replayed during sleep. For example, a man who works in a certain profession and spends all day working in that field, and before he goes to sleep he thinks about it, so he may see things having to do with it in his dream; or one who thinks about someone whom he loves and sees things that have to do with that person. There is no interpretation for these things.
It was narrated from Abu Hurayrah (may Allah be pleased with him) that the Prophet (peace and blessings of Allah be upon him) said: “Towards the end of time, hardly any dream of a Muslim will be false. The ones who have the truest dreams will be those who are truest in speech. The dream of a Muslim is one of the forty-six parts of Prophethood. Dreams are of three types: a good dream which is glad tidings from Allah, a dream from the devil which causes distress, and a dream that comes from what a man is thinking of to himself…”
Shaykh Ibn `Uthaymin (may Allah have mercy on him) said:
“The meaning of the words of the Prophet (peace and blessings of Allah be upon him), ‘The dreams of the believer are one of the forty-six parts of Prophethood’ is that the dreams of the believer come true, because they are like parables that the angel gives to the one who sees them. They may tell of something that is happening or that is going to happen, so it happens in accordance with the dream, so these dreams are like the way of Prophethood in that they come true, yet they are different from it. Hence they are one of the forty-six parts of Prophethood.” (End quote from Majmu` Fatawa Ash-Shaykh Ibn `Uthaymin, 1/327)
The dreams of the believer are described in the Hadiths as “true” and “good” and “from Allah”. What is meant by “true” is explained in the words of Ibn `Uthaymin quoted above as meaning that they come true. What is meant by “good” is that they bring good news or draw attention to some mistakes that one is not aware of. What is meant by their being “from Allah” is that they happen by His grace and mercy, or as a warning or glad tidings from Him, or as guidance from Him.
Bad dreams are described as “causing grief” or being “from the devil.” What is meant by “causing grief” is that they make one sad and cause distress. What is meant by them being “from the devil” is that they are instilled by him in an effort to cause fear or because of his toying with the sleeper.
Shaykh Ibn `Uthaymin (may Allah have mercy on him) said:
“Alarm comes from the devil. The devil depicts to a person in his sleep things that alarm him with regard to himself, his wealth or his family, or in his community, because the devil loves to make the believers sad, as Allah says (interpretation of the meaning):
{Secret counsels (conspiracies) are only from the devil, in order that he may cause grief to the believers. But he cannot harm them in the least, except as Allah permits.} [Al-Mujadilah 58:10]
Everything that causes distress to people and upsets them, the devil is eager for it, whether it is when they are awake or asleep, because the devil is an enemy as Allah says (interpretation of the meaning):
{Surely, the devil is an enemy to you, so take (treat) him as an enemy.” [Fatir 35:6]” (End quote from Majmu` Fatawa Ash-Shaykh Ibn `Uthaymin, 1/329)
The Prophet (peace and blessings of Allah be upon him) taught us what we should do if a person sees something in his dream that he dislikes and wakes up as a result. It is: spitting dryly to the left, seeking refuge with Allah from the devil, turning over, praying if one wants, and not telling people about it.
We should point out an important matter, which is that if a person is righteous and strives to obey Allah always, he will not be harmed if he sees or is seen (in a dream) in a situation that causes distress, but if he is an evildoer and sinner in his real life, then he will not benefit from seeing himself or being seen in the best state.
Ibn Muflih (may Allah have mercy on him) said:
“Hisham ibn Hassan said: Ibn Sirin was asked about one hundred dreams and he did not give any answer except to say: Fear Allah and do good whilst you are awake, and whatever you see in your sleep will not harm you.”  (End quote from Al-Adab Ash-Shar`iyyah, 3/451)
And he (may Allah have mercy on him) said:
“Al-Marwadhi said: I brought Ibrahim Al-Humaydi with me to meet Abu `Abdullah, and he was a righteous man. He said: My mother saw [in a dream] that such and such happened to you, and she mentioned Paradise. He said: O my brother, the people used to say such things to Sahl ibn Salamah, and Sahl rebelled and shed blood, and he said: Dreams may bring joy to the believer but they cannot deceive him.” (End quote from Al-Adab Ash-Shar`iyyah, 3/453)
Are there warning dreams from Allah?
There may be warnings in a dream to the person or to others, of some mistake that they are negligent about, or some sin that they are committing, or of a bad end if they continue as they are, following deviation or misguidance. These cannot be the bad dreams which come from the devil`s plots and efforts to cause grief, rather they come from Allah by His grace and mercy. So if a person sees something in his dream which indicates that he should alert and warn others, he should do so. The same applies if he sees something that warns and alerts him (i.e., he should pay heed).
You can warn your relative about a possible plot or evil that is expected, without mentioning who may be behind this plot. If you are worried that something bad may happen, then you should take precautions, and nothing will harm you in sha Allah, even if what you fear happens. But if what you feared did not happen, and the dream did not come true, no harm will befall you because you did not speak badly of anyone and did not transgress against anyone.
And Allah knows best.