How should I do this?
#1

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:
Код:
CMD:getgift(playerid, params[])
{
      new rand = random(10);
      if(rand == 5)
      {
             SendClientMessage(playerid, -1, "You have won $500,000!");
      }
      return 1;
}
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?
Reply


Messages In This Thread
How should I do this? - by danielpalade - 04.07.2016, 00:26
Re: How should I do this? - by Dayrion - 04.07.2016, 00:51
Re: How should I do this? - by danielpalade - 04.07.2016, 00:59
Re: How should I do this? - by Dayrion - 04.07.2016, 01:10
Re: How should I do this? - by danielpalade - 04.07.2016, 01:22
Re: How should I do this? - by Dayrion - 04.07.2016, 01:24
Re: How should I do this? - by danielpalade - 04.07.2016, 01:29
Re: How should I do this? - by Dayrion - 04.07.2016, 01:35
Re: How should I do this? - by danielpalade - 04.07.2016, 01:37
Re: How should I do this? - by Dayrion - 04.07.2016, 01:43

Forum Jump:


Users browsing this thread: 1 Guest(s)