if(dialogid == DIALOG_LOGIN && response == 1)
{
new file[256], pname[MAX_PLAYER_NAME];
new pass[256];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "Accounts/%.txt", pname);
pass = dini_Get(file, "Password");
if(strcmp(inputtext,pass, false) !=0 ) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login Information", "Please Enter Your Password, You Have Entered Wrong Password", "Enter", "Quit");
#if !defined isnull
#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
if(isnull(inputtext))
{
//Do something: display a dialog saying no text was input
return 0;
}
if(strcmp(inputtext,pass, false) == 0) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login Information", "Please Enter Your Password, You Have Entered Wrong Password", "Enter", "Quit");
|
You first need to check if the inputtext is a null string before comparing both strings. You could use this useful macro by ******:
PHP код:
PHP код:
|
if(dialogid == DIALOG_LOGIN && response == 1)
{
new file[256], pname[MAX_PLAYER_NAME];
//new pass[256];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "Accounts/%.txt", pname);
//pass = dini_Get(file, "Password");
if(isnull(inputtext))
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login Information", "Please Enter Your Password, No Password Has Entered", "Enter", "Quit");
return 0;
}
if(strcmp(inputtext, dini_Get(file, "Password"), false) !=0) return 1;
new str3[180];
format(str3, sizeof(str3), "Your Password Is %s", dini_Get(file, "Password"));
printf(str3);
format(str3, sizeof(str3), "INPUTTEXT Is %s", inputtext);
printf(str3);
format(file, sizeof(file), "Accounts/%s.txt", pname);