SA-MP Forums Archive
Only digits. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Only digits. (/showthread.php?tid=112400)



Only digits. - Martin_M - 07.12.2009

Hey, guys. I'm searching in forum, but no result. I have registration with GUI. But i need to make, that password can be just digits, no letters. What is the code? Because after time i forget this.

Thanks.



Re: Only digits. - Remi-X - 07.12.2009

Do something with IsNumeric. Check if the password which that player gave contains number, and if not, return him to the password gui.
Код:
stock IsNumeric(const string[])
{
	for (new i = 0, j = strlen(string); i < j; i++)
	{
		if (string[i] > '9' || string[i] < '0') return 0;
	}
	return 1;
}



Re: Only digits. - Martin_M - 07.12.2009

Quote:
Originally Posted by Remi-X
Do something with IsNumeric. Check if the password which that player gave contains number, and if not, return him to the password gui.
Код:
stock IsNumeric(const string[])
{
	for (new i = 0, j = strlen(string); i < j; i++)
	{
		if (string[i] > '9' || string[i] < '0') return 0;
	}
	return 1;
}
Thank you.