Numbers in dialog.
#1

Hi,

I want to make, you can input six numbers in dialog, and all them you have make space like:

1 2 3 4 5 6

But how check that? because i will do lottery, i want to do. And how check all this numbers (for ex: number can't be larget than 48 value). If you write like this:

50 2 3 4 5 6

You will get message, you input one number too high value.
Reply
#2

The player is the only one who can insert text into the textbox of a dialog, so you'll have to insert the spaces yourself
EDIT: i think i misunderstood it!

sscanf is a good alternative for this!

pawn Код:
new nmbr[7];
if(sscanf(playerid, "iiiiiii", nmbr[0], nmbr[1], nmbr[2], nmbr[3], nmbr[4], nmbr[5], nmbr[6]))
{
 //Error, insert numbers!
 return 1;
}

// nmbr[0] > nmbr[6] are now equal to what you've written
return 1;
Reply
#3

If i use playerid, i can error. I try to use inputtext:
Код:
new nmbr[6];
			if(sscanf(inputtext, "dddddd", nmbr[0], nmbr[1], nmbr[2], nmbr[3], nmbr[4], nmbr[5]))
			{
                SendClientMessage( playerid, COLOR_RED,"* Invalid format.");
			 	return 1;
			}
			if( nmbr[0] > 48 || nmbr[1] > 48 || nmbr[2] > 48 || nmbr[3] > 48 || nmbr[4] > 48 || nmbr[5] > 48 )
			{
			    SendClientMessage( playerid, COLOR_RED,"* Too high number in your combination");
			 	return 1;
			}
Problem is, when i write in dialog that numbers like 1 2 3 4 5 6 i always get "too high number in your combination".
Reply
#4

That don't help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)