NOTE. The translation here leaves a lot to be desired. Instead of "if somebody intends to do", I would use "if somebody is resolved to do" or "if someone has decided to do". The Arabic word used in the hadith is hamma (Arabic: هم). This word refers to the onset of resolution to take some action (Arabic: الهم أول العزيمة) and not intention. The word nawa (Arabic: نوى) is the one that can be translated as "intends", but this is not the word used in the hadith.
The answer is yes, Allah willing, according to the words of the hadith, provided that there is sincerity in one's intention. Linguistically, resolution to do an action implies:
- sincerity in intention and desire to start an action, and
- ability to complete the action.
However, scholars tend to rule out absolute ability and tie resolution to conditional ability instead. This means that if one is resolved to do an action that by its nature is doable (e.g., donate money to charity), but is unable to complete the action (e.g., for being poor), one still gets rewarded.
In the following long hadith, the Prophet ﷺ classified people into four categories. The second category is that of a slave who has knowledge of what should be done and has a sincere resolution to do the right thing but is incapable of seeing his action through, then he gets rewarded as if he had completed the action:
حَدَّثَنِي أَبُو كَبْشَةَ الأَنْمَارِيُّ، أَنَّهُ سَمِعَ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ
ثَلاَثَةٌ أُقْسِمُ عَلَيْهِنَّ وَأُحَدِّثُكُمْ حَدِيثًا فَاحْفَظُوهُ
مَا نَقَصَ مَالُ عَبْدٍ مِنْ صَدَقَةٍ وَلاَ ظُلِمَ عَبْدٌ مَظْلِمَةً فَصَبَرَ عَلَيْهَا إِلاَّ زَادَهُ اللَّهُ عِزًّا وَلاَ فَتَحَ عَبْدٌ بَابَ مَسْأَلَةٍ إِلاَّ فَتَحَ اللَّهُ عَلَيْهِ بَابَ فَقْرٍ ـ أَوْ كَلِمَةً نَحْوَهَا ـ وَأُحَدِّثُكُمْ حَدِيثًا فَاحْفَظُوهُ
إِنَّمَا الدُّنْيَا لأَرْبَعَةِ نَفَرٍ عَبْدٍ رَزَقَهُ اللَّهُ مَالاً وَعِلْمًا فَهُوَ يَتَّقِي فِيهِ رَبَّهُ وَيَصِلُ فِيهِ رَحِمَهُ وَيَعْلَمُ لِلَّهِ فِيهِ حَقًّا فَهَذَا بِأَفْضَلِ الْمَنَازِلِ وَعَبْدٍ رَزَقَهُ اللَّهُ عِلْمًا وَلَمْ يَرْزُقْهُ مَالاً فَهُوَ صَادِقُ النِّيَّةِ يَقُولُ لَوْ أَنَّ لِي مَالاً لَعَمِلْتُ بِعَمَلِ فُلاَنٍ فَهُوَ بِنِيَّتِهِ فَأَجْرُهُمَا سَوَاءٌ وَعَبْدٍ رَزَقَهُ اللَّهُ مَالاً وَلَمْ يَرْزُقْهُ عِلْمًا فَهُوَ يَخْبِطُ فِي مَالِهِ بِغَيْرِ عِلْمٍ لاَ يَتَّقِي فِيهِ رَبَّهُ وَلاَ يَصِلُ فِيهِ رَحِمَهُ وَلاَ يَعْلَمُ لِلَّهِ فِيهِ حَقًّا فَهَذَا بِأَخْبَثِ الْمَنَازِلِ وَعَبْدٍ لَمْ يَرْزُقْهُ اللَّهُ مَالاً وَلاَ عِلْمًا فَهُوَ يَقُولُ لَوْ أَنَّ لِي مَالاً لَعَمِلْتُ فِيهِ بِعَمَلِ فُلاَنٍ فَهُوَ بِنِيَّتِهِ فَوِزْرُهُمَا سَوَاءٌ
Abu Kabshah Al-Anmari narrated that the Messenger of Allah (ﷺ) said:
There are three things for which I swear and narrate to you about, so remember my narration.
- The wealth of a slave (of Allah) shall not be decreased by charity,
- No slave (of Allah) suffers injustice and is patient with it except that Allah adds to his honor;
- No slave (of Allah) opens up a door to begging except that Allah opens a door for him to poverty [or a similar word]
And I shall narrate to you a narration, so remember my narration.
The world is only for four persons:
- A slave whom Allah provides with wealth and knowledge, so he has taqwa of his Lord with it, nurtures the ties of kinship with it, and he knows that Allah has a right in it. So this is the most virtuous rank.
- And a slave whom Allah provides with knowledge, but He does not provide with wealth. So he has a truthful intent, saying: 'If I had wealth, then I would do the deeds of so-and-so with it.' He has his intention, so their rewards are the same.
- And a slave whom Allah provides with wealth, but He does not provide him with knowledge. [So he] spends his wealth rashly without knowledge, nor having taqwa of his Lord, nor nurturing the ties of kinship, and he does not know that Allah has a right in it. So this is the most despicable rank.
- And a slave whom Allah does not provide with wealth nor knowledge, so he says: 'If I had wealth, then I would do the deeds of so-and-so with it.' He has his intention, so their sin is the same.
— Jami' at-Tirmidhi, Book 36, Hadith 22
There may be some reward in temporarily having the intention to do good, as you mentioned, according to the following hadith:
عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ: يَقُولُ اللَّهُ إِذَا أَرَادَ عَبْدِي أَنْ يَعْمَلَ سَيِّئَةً فَلاَ تَكْتُبُوهَا عَلَيْهِ حَتَّى يَعْمَلَهَا، فَإِنْ عَمِلَهَا فَاكْتُبُوهَا بِمِثْلِهَا وَإِنْ تَرَكَهَا مِنْ أَجْلِي فَاكْتُبُوهَا لَهُ حَسَنَةً وَإِذَا أَرَادَ أَنْ يَعْمَلَ حَسَنَةً فَلَمْ يَعْمَلْهَا فَاكْتُبُوهَا لَهُ حَسَنَةً، فَإِنْ عَمِلَهَا فَاكْتُبُوهَا لَهُ بِعَشْرِ أَمْثَالِهَا إِلَى سَبْعِمِائَةٍ
Narrated Abu Huraira: Allah's Messenger (ﷺ) said, "Allah says, 'If My slave intends to do a bad deed then (O Angels) do not write it unless he does it; if he does it, then write it as it is, but if he refrains from doing it for My Sake, then write it as a good deed (in his account). (On the other hand) if he intends to do a good deed, but does not do it, then write a good deed (in his account), and if he does it, then write it for him (in his account) as ten good deeds up to seven-hundred times.'"
— Sahih al-Bukhari, Book 97, Hadith 126
The good deed is recorded at the time of intention (according to the translation, but the Arabic word used is arada, which means "wills").