Silly question
#1

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?
Reply
#2

You haven't defined any value for %d
Reply
#3

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

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

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
Reply
#5

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)