SA-MP Forums Archive
Help with dialogs - 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: Help with dialogs (/showthread.php?tid=649486)



Help with dialogs - C0oL3r - 09.02.2018

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;
}



Re: Help with dialogs - Mugala - 09.02.2018

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); 



Re: Help with dialogs - C0oL3r - 09.02.2018

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


Re: Help with dialogs - Mugala - 09.02.2018

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...


Re: Help with dialogs - C0oL3r - 09.02.2018

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


Re: Help with dialogs - Mugala - 09.02.2018

so what's problem?


Re: Help with dialogs - C0oL3r - 09.02.2018

myeah, nothing, thanks for help.