09.01.2013, 16:58
Hi guys, I got a quick question. Help is highly appreciated!
I'm building a lotto script, and I'm currently working on ticket purchase system. Everything is pretty much self explanatory: The player types /lotto 1-100, gets 100$ removed and gets a ticket. However, I can't seem to understand how to limit the input to 1-100. Because now, I can do /lotto 'anything' and it will show the ticket as 'Your lotto ticket number: 'anything'. I tried using > < <= signs, but they don't show any effect.
So the question is pretty simple: how do I limit the input to 1-100?
My code:
Thank you very much!
PS. Ignore that it doesn't really convert the input into an actual ticket number, it's just to see if everything works in the input type.
I'm building a lotto script, and I'm currently working on ticket purchase system. Everything is pretty much self explanatory: The player types /lotto 1-100, gets 100$ removed and gets a ticket. However, I can't seem to understand how to limit the input to 1-100. Because now, I can do /lotto 'anything' and it will show the ticket as 'Your lotto ticket number: 'anything'. I tried using > < <= signs, but they don't show any effect.
So the question is pretty simple: how do I limit the input to 1-100?
My code:
Код:
if (strcmp (cmd, "/lotto", true)==0) { new tmp[28]; tmp = strtok(cmdtext, idx); if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xDC143CAA, "USAGE: /lotto [1-100]"); //This one works if(strlen(tmp) < (1)) return SendClientMessage(playerid, 0xDC143CAA, "USAGE: /lotto [1-100]"); //This one is somewhy ignored if(strlen(tmp) > (100)) return SendClientMessage(playerid, 0xDC143CAA, "USAGE: /lotto [1-100]"); //This one is somewhy ignored if(strlen(tmp) <= (100)) SendClientMessage(playerid, 0x10F441AA, "You have purchased a lotto ticket!"); SendClientMessage(playerid, 0x10F441AA, tmp); SendClientMessage(playerid, 0x10F441AA, "Wait for the draw.. Good luck!"); return 1; }
PS. Ignore that it doesn't really convert the input into an actual ticket number, it's just to see if everything works in the input type.