If we help a stranger with our money to support his habit of gambling, then we will not have a chance to get the money back. We don't have to help him if he will use that money to gamble because that will not help him to solve his problem. But if he needs money to buy food, then yes, we can help him because it's about humanity.
And that is the tricky part, if someone is asking for money, let's just say he is asking for it to buy some food, but the truth is he will not use it to buy some food, instead he is going to use it to play gambling, that is why for me when I'm helping someone, I'm not giving money, I'm asking them what they need and I buy it to give it to them, mostly it is food and clothing, I am not going to give money or anything materials that won't help them to be honest.
We don't know if his reason to ask for money for gambling, but he says that with the money, he will buy some food. I think we don't know what he will do after we give that money. But maybe we can ask them first, and if they say that money will be used to buy food, we can ask him to buy that food, and we can pay for that food. That will prevent him from using that money for playing gambling, and I think that is the right solution for us to know what is his real reason to ask that money.