Help with dialogs
#1

Hey, why when i type something in a dialog and i exit the game and reconnect to server the text that i typed in the dialog it's remaining.

And i have a problem that i can put any text i want without @, but i added
Код:
strfind(inputtext, "@", false, 0)
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        switch(dialogid)
        {
                 .......
		case DIALOG_EMAIL:
		{
			if(!response)
			{
				new EmailQuerry[255];
				mysql_format(Database, EmailQuerry, sizeof(EmailQuerry), "UPDATE `USERS` SET `Email` = 'NoEmail' WHERE `USERNAME`='%s'", pInfo[playerid][pName]);
				mysql_query(Database, EmailQuerry);
			}
			if(response)
			{
				if(!strlen(inputtext))
				{
					if(pInfo[playerid][pLanguage] == 1) return ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "Email", "Introdu un email valid.\n\nIntrodu in casuta de mai jos un email de recuperare.", "Ok", "Close");
					if(pInfo[playerid][pLanguage] == 2) return ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "Email", "Type an valid email.\n\nType in the dialog box an recovery email", "Ok", "Close");
				}
				if(strfind(inputtext, "@", false, 0))
				{
					if(pInfo[playerid][pLanguage] == 1)
					{
						new EmailQuerry[255];
						mysql_format(Database, EmailQuerry, sizeof(EmailQuerry), "UPDATE `USERS` SET `Email` = '%s' WHERE `USERNAME`='%s'", inputtext, pInfo[playerid][pName]);
						mysql_query(Database, EmailQuerry);
						SCM(playerid, COLOR_YELLOW, "Email salvat.");
					}
					else
					{
						new EmailQuerry[255];
						mysql_format(Database, EmailQuerry, sizeof(EmailQuerry), "UPDATE `USERS` SET `Email` = '%s' WHERE `USERNAME`='%s'", inputtext, pInfo[playerid][pName]);
						mysql_query(Database, EmailQuerry);
						SCM(playerid, COLOR_YELLOW, "Email saved.");
					}

				}
				else
				{
					if(pInfo[playerid][pLanguage] == 1) return ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "Email", "Introdu un email valid.\n\nIntrodu in casuta de mai jos un email de recuperare.", "Ok", "Close");
					if(pInfo[playerid][pLanguage] == 2) return ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "Email", "Type an valid email.\n\nType in the dialog box an recovery email", "Ok", "Close");
				}
				SendToTutorial(playerid);
			}
		}
		///////////////////////////////////////////////////////////////////////////////////////////////////
	}
	return 0;
}
Reply
#2

use this.
PHP код:
if(strfind(inputtext"@"true) != -1
also change the place for this code: SendToTutorial(playerid);
put this after this codes
PHP код:
                    if(pInfo[playerid][pLanguage] == 1)
                    {
                        new 
EmailQuerry[255];
                        
mysql_format(DatabaseEmailQuerrysizeof(EmailQuerry), "UPDATE `USERS` SET `Email` = '%s' WHERE `USERNAME`='%s'"inputtextpInfo[playerid][pName]);
                        
mysql_query(DatabaseEmailQuerry);
                        
SCM(playeridCOLOR_YELLOW"Email salvat.");
                    }
                    else
                    {
                        new 
EmailQuerry[255];
                        
mysql_format(DatabaseEmailQuerrysizeof(EmailQuerry), "UPDATE `USERS` SET `Email` = '%s' WHERE `USERNAME`='%s'"inputtextpInfo[playerid][pName]);
                        
mysql_query(DatabaseEmailQuerry);
                        
SCM(playeridCOLOR_YELLOW"Email saved.");
                    }
                    
SendToTutorial(playerid); 
Reply
#3

And to make to don't save my input everytime?
Oh, and to check if after "@" it's a "something.com"
Reply
#4

1. you dont have to show a dialog at every-time when they logins. (if u mean this)
2. you can also place a checker/filter by strfind and find a domains like .com .ru .org .us and others...
Reply
#5

it's doesn't show every time, it's only when it's registering
Reply
#6

so what's problem?
Reply
#7

myeah, nothing, thanks for help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)