I have read of someone successfully dieting by stuffing herself with ice cream and cake during lucid dreams, so that she had no need for them during waking life because she had had enough.

However, I would think that it depends on the addiction:

If it is something that one can saturate (such as the above example, where there is such a thing as "enough" sweats. My understanding of smoking is that there may not be a saturation point like that for smokers, that there may not be such a thing as enough or too many cigarettes, and if that is the case then smoking in your sleep may actually make your addiction worse because now you would have conditioned your mind to want smokes both during waking and dream time.

Also I would think it depends on whether the addiction is more physical or more psychological. For example, if I am "addicted" to online forums, there is no physical component to it, and thus as long as I could make the experience in dreams satisfying enough perhaps I could fool my brain into accepting that doing it in my sleep only is enough. But with an addiction that is physical, you got more than your brain to fool, and the rest of your body may continue to crave the substance.