29.01.2017, 15:23 
	
	
	
		Hey guys, how can I check if the player entered an email? I want to restrict a field to emails so they can't type random things.
	
	
	
	
"{s[256]'@'s[256]'.'s[256]}"
 "{s[256]'@'s[256]'.'s[256]}"
if(!sscanf(inputtext, "{s[256]'@'s[256]'.'s[256]}")) 
{
	// the email is valid depends on those patterns...
}
IsValidEmail(text[]) // It will return true if text[] is a valid email, it will return false otherwise.
{
	return !sscanf(text, "{s[256]'@'s[256]'.'s[256]}");
}
| Код: if(!sscanf(inputtext, "{s[256]'@'s[256]'.'s[256]}")) 
{
	// the email is valid depends on those patterns...
}Код: IsValidEmail(text[]) // It will return true if text[] is a valid email, it will return false otherwise.
{
	return !sscanf(text, "{s[256]'@'s[256]'.'s[256]}");
} | 
case DIALOG_EMAIL:
		{
		    if(response)
		    {
                if(!sscanf(inputtext, "{s[256]'@'s[256]'.'s[256]}"))
                {
                    ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "{FFA500}E-MAIL", "{FFFFFF}Please enter your email below:\n\n", "NEXT", "");
				}
				else
				{
				    new DB_Query[225];
			        new pName[24];
			        GetPlayerName(playerid, pName, sizeof(pName));
			        format(PlayerInfo[playerid][pEmail],64, "%s", inputtext);
					mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `USERS` SET `email` = '%e' WHERE `USERNAME` = '%e'"
					, PlayerInfo[playerid][pEmail], pName);
					mysql_tquery(Database, DB_Query);
					SendClientMessage(playerid, COLOR_GREEN, "Email set succesfully! Moving onto the next part, gender!");
					ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "{FFA500}GENDER", "{FFFFFF}Are you a boy or a girl?\n\n", "BOY", "GIRL");
				}
			}
		}
| It doesn't work, it continues to the next dialog even if I type a normal email or not. Код: case DIALOG_EMAIL:
		{
		    if(response)
		    {
                if(!sscanf(inputtext, "{s[256]'@'s[256]'.'s[256]}"))
                {
                    ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "{FFA500}E-MAIL", "{FFFFFF}Please enter your email below:\n\n", "NEXT", "");
				}
				else
				{
				    new DB_Query[225];
			        new pName[24];
			        GetPlayerName(playerid, pName, sizeof(pName));
			        format(PlayerInfo[playerid][pEmail],64, "%s", inputtext);
					mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `USERS` SET `email` = '%e' WHERE `USERNAME` = '%e'"
					, PlayerInfo[playerid][pEmail], pName);
					mysql_tquery(Database, DB_Query);
					SendClientMessage(playerid, COLOR_GREEN, "Email set succesfully! Moving onto the next part, gender!");
					ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "{FFA500}GENDER", "{FFFFFF}Are you a boy or a girl?\n\n", "BOY", "GIRL");
				}
			}
		} | 
sscanf(inputtext, "?<SSCANF_QUIET=1>{s[256]'@'s[256]'.'s[256]}")