04.07.2016, 00:26
Hello, I'm working on my giftbox system.
The command /getgift should select a random value between 0 and 10, and give him the random generated gift.
Now I know how to make that command, but I would want it to do the following thing.
* Check if the gift is available, else re-roll till you have an available gift.
So let's say the random generated value is 5.
My code would be like this:
But, let's say that "money" isn't available right now.
- Giftbox money gift is defined as "boxVariables[1][boxMoney]".
How would I re-generate the value and make sure he will get a different gift if the other ones are not available?
The command /getgift should select a random value between 0 and 10, and give him the random generated gift.
Now I know how to make that command, but I would want it to do the following thing.
* Check if the gift is available, else re-roll till you have an available gift.
So let's say the random generated value is 5.
My code would be like this:
Код:
CMD:getgift(playerid, params[]) { new rand = random(10); if(rand == 5) { SendClientMessage(playerid, -1, "You have won $500,000!"); } return 1; }
- Giftbox money gift is defined as "boxVariables[1][boxMoney]".
How would I re-generate the value and make sure he will get a different gift if the other ones are not available?