Dialog
#1

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;
}
Reply
#2

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 ".")
            }
        }
    }
Reply
#3

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


Forum Jump:


Users browsing this thread: 2 Guest(s)