It is narrated from Sayyiduna ‘Ubada bin Samit (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: “Whoever fights in the way of Allah and does not intend in his expedition except (to obtain) a rope, then he will get only that thing.”
Brief Explanation
(Commentary on Hadith 2452)
That is, he will not receive the reward of jihad because his intention was not sincere. Even though a rope is not a significant thing, yet having even such a small motive and greed stains sincerity and erases the reward.
A person should be mindful of this in every action, because the result will be according to the intention.