OK guys. I figured it out. If you copy this script exactly, you
will be able to use number 0 and you won't be able to use number
100. This is because PAWN thinks that when you state there are 100 numbers up for grabs, it thinks you mean for 0-99. I don't know if you can do anything but what I did was give 101 numbers instead of 100. Like so:
Then to fix the problem where you can use 0 as a ticket number, I did this:
All this comes under dcmd_lotto(playerid, params[]).
Код:
if(Num == 0)
{
SendClientMessage(playerid,0xE21F1FFF, "You cannot use 0 or any other number over 100."); //This appears as a rule then
return 1;
}
Then you must the winning number settings. You must change the way it is chosen. Not exactly. You must simply add 1 if you have a 100 numbers.
Код:
new Lnum = random(101) + 1;
See? If you have 100 numbers. You just have to add one. But to watch out for certain problems like getting number 101 or 102, you"ll have to do this.
Код:
new Lnum = random(101) + 1; //Picks a random number
if(Lnum == 102) return Lnum = 102 - random(101);
if(Lnum == 101) return Lnum = 102 - random(101);
if(Lnum == 0) return Lnum = random(101)
There is a simpler way, but I'm too tired to write that tiny piece now so I'll write it in the morning.
EDIT: Ok, to continue with this, you don't need to add one at all.
Код:
new Lnum = random(100) + 1; //Picks a random number
That code above ^^^ is much cleaner. That never really needs editing. I was just so tired that I couldn't think right.