SA-MP Forums Archive
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: Dialog (/showthread.php?tid=371045)



Dialog - SumX - 22.08.2012

Hello!
I made a dialog for my players to type their e-mail,to let me contact them.
But I want to check if the player wrote in the DIALOG_STYLE_INPUT an e-mail,with letters or numbers and with a '.' (dot) and an '@'.

How can I do that? I can check only if is numeric.

Код:
stock IsNumeric(string[])
{
	for (new i = 0, j = strlen(string); i < j; i++)
	{
		if (string[i] > '9' || string[i] < '0') return 0;
	}
	return 1;
}



Re: Dialog - MarinacMrcina - 22.08.2012

You can try mine method:

pawn Код:
if(dialogid==reg1)
    {
        if(response==0)
        {
                //kick player and send him an error message about canceling registration
        }
        if(response==1)
        {
            if((strfind(inputtext,"@",true) !=-1) && (strfind(inputtext,".",true) !=-1))
            {
                    //proceed to anothther registration step
            }
            else
            {
                    //show the dialog again since no valid e-mail adres is entered( a "@" and ".")
            }
        }
    }



Re: Dialog - SumX - 22.08.2012

Ohh
Good!
Thank you! If the player don't write name@domain . x