SA-MP Forums Archive
Numbers in dialog. - 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: Numbers in dialog. (/showthread.php?tid=445411)



Numbers in dialog. - audriuxxx - 21.06.2013

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.


Re: Numbers in dialog. - RedFusion - 21.06.2013

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;



Re: Numbers in dialog. - audriuxxx - 21.06.2013

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".


Re: Numbers in dialog. - audriuxxx - 21.06.2013

That don't help.