SA-MP Forums Archive
Silly question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Silly question (/showthread.php?tid=406277)



Silly question - iRenegade - 09.01.2013

Hi, I got a rather easy question right here. So, I'm trying to scan the input lotto number and print it out.
Here's the code:
Код:
COMMAND:lotto(playerid, params[])
{
new Number;
sscanf(params, "d", Number);
if(Number < 1)
{
     SendClientMessage(playerid, 0x10F441AA, "USAGE: /lotto (1-100)");
     return 1;
}
if(Number > 100)
{
     SendClientMessage(playerid, 0x10F441AA, "USAGE: /lotto (1-100)");
     return 1;
}
SendClientMessage(playerid, 0x10F441AA, "Your lotto number is: %d");
SendClientMessage(playerid, 0x10F441AA, "You have purchased a lotto ticket!");
SendClientMessage(playerid, 0x10F441AA, "Wait for the draw.. Good luck!");

return 1;
}
However, it doesn't print out my input, like 1,2 or whatever. It prints some weird stuff like 1951519. Why's that?


Re: Silly question - RedCrossER - 09.01.2013

You haven't defined any value for %d


Re: Silly question - iRenegade - 09.01.2013

Doesn't it get defined in input? I'm confused.

Well I need to print out the input 'number'. Which command should I use?


Re: Silly question - RedCrossER - 09.01.2013

pawn Код:
COMMAND:lotto(playerid, params[])
{
new Number;
sscanf(params, "d", Number);
if(Number < 1)
{
     SendClientMessage(playerid, 0x10F441AA, "USAGE: /lotto (1-100)");
     return 1;
}
if(Number > 100)
{
     SendClientMessage(playerid, 0x10F441AA, "USAGE: /lotto (1-100)");
     return 1;
}
SendClientMessage(playerid, 0x10F441AA, "Your lotto number is: %d",Number);
SendClientMessage(playerid, 0x10F441AA, "You have purchased a lotto ticket!");
SendClientMessage(playerid, 0x10F441AA, "Wait for the draw.. Good luck!");

return 1;
}
You have to format that line , Iam not in oc so do it yourself


Re: Silly question - iRenegade - 09.01.2013

I tried adding 'Number' there countless times. It just drops out an error
warning 202: number of arguments does not match definition


Re: Silly question - RedCrossER - 09.01.2013

As I said : https://sampwiki.blast.hk/wiki/Format