Limit the input
#4

Hey.
I'd recommend you to use sscanf and zcmd inc's.
Here's a working code for that:
pawn Код:
COMMAND:lotto(playerid, params[])
{
new Number;
if(!sscanf(params, "d", Number))
{
    SendClientMessage(playerid, 0xFF0000FF, "USAGE: Lotto [1-100]"); // if they write something like: /lotto or /lotto blabla
    return 1;
}
if(Number < 1 || Number > 100)
{
    SendClientMessage(playerid, 0xFF0000FF, "USAGE: Lotto [1-100]"); // if they write /lotto -3; /lotto 0; /lotto 101
    return 1;
}
SendClientMessage(playerid, 0x10F441AA, "You have purchased a lotto ticket!");
SendClientMessage(playerid, 0x10F441AA, "Wait for the draw.. Good luck!");

return 1;
}
Greetz,
LetsOWN
Reply


Messages In This Thread
Limit the input - by iRenegade - 09.01.2013, 16:58
Re: Limit the input - by Vince - 09.01.2013, 17:01
Re: Limit the input - by mrtms - 09.01.2013, 17:03
Re: Limit the input - by LetsOWN[PL] - 09.01.2013, 17:05
Re: Limit the input - by iRenegade - 09.01.2013, 17:06
Re: Limit the input - by LetsOWN[PL] - 09.01.2013, 17:10
Re: Limit the input - by iRenegade - 09.01.2013, 17:13
Re: Limit the input - by LetsOWN[PL] - 09.01.2013, 17:16
Re: Limit the input - by iRenegade - 09.01.2013, 17:21
Re: Limit the input - by mastermax7777 - 09.01.2013, 17:22

Forum Jump:


Users browsing this thread: 4 Guest(s)