Hello my friend, I was trying to fix it and did some modifies. For now it works but I think is not optimized because looking previous scripts of roulette (working as the people say), those are very small compared to this so if someone can help us to optimize it should be good.
Also I try to do it as I think it should be like but there is something that for now I don't know how to solve that is the possibility to choose which coin you want spend. At this moment this is spend from bronze to silver and also don't has the restriction to advance stage for stage, instead if you don't have bronze coins but silver coins, the roulette start in the stage associated to silver coin, obivously this can be changed in the way that you must advance in order (bronze->silver->gold (all of this if you have the success for every stage to advance)).
In my opinion I would like to choose which coin I would to spend but I'm working on it.
EDIT: I detect a issue, when I have silver coins but no bronze and gold, this stuck in a stage but I'm gonna continue tomorrow. I hope this help us for people that can help 8).
EDIT2: I think is because when spin, it want to continue but the condition to advance is not completed because no gold coins and the stage continues the sum in sd->roulette.stage++;
EDIT3: How I expected, the solution was more easy and already solved it yesterday in the repository of rAthena. Anyway, in my case, I would like to choose which coin I want to use in the roulette so gonna try to do it