[Help] Can't login -
javad - 02.08.2015
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == REGISTER)
{
new Value = strval(inputtext);
if(!response){ Kick(playerid); }
if(!strlen(inputtext)) { ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Invalid password. Enter password to register.", "Register", "Quit"); }
new INI:File = INI_Open(PlayerFile(playerid));
INI_SetTag(File, "Information");
INI_WriteInt(File, "Password", Value); <===== "INI_WriteString" doesn't work.
INI_Close(File);
}
else if(dialogid == LOGIN)
{
if(!response){ Kick(playerid); }
if(!strlen(inputtext)) { ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Invalid password.Enter password to login.", "Login", "Quit"); }
INI_ParseFile(PlayerFile(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
if(strcmp(inputtext[0], PlayerInfo[playerid][pPass]))
{
SetSpawnInfo(playerid, 0, 137, -1974.4125, 138.0872 ,27.6875, 90, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Invalid password.Enter password to login.", "Login", "Quit");
}
}
return 1;
}
Hi,
The register system works fine but can't login even with correct password.
Re: [Help] Can't login -
Mencent - 02.08.2015
PHP код:
if(strcmp(inputtext[0], PlayerInfo[playerid][pPass]))
to
PHP код:
if(!strcmp(inputtext, PlayerInfo[playerid][pPass]))
Re: [Help] Can't login -
javad - 02.08.2015
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == REGISTER)
{
new Value = strval(inputtext);
if(!response){ Kick(playerid); }
if(!strlen(inputtext)) { ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Invalid password. Enter password to register.", "Register", "Quit"); }
new INI:File = INI_Open(PlayerFile(playerid));
INI_SetTag(File, "Information");
INI_WriteInt(File, "Password", Value);
INI_Close(File);
}
else if(dialogid == LOGIN)
{
if(!response){ Kick(playerid); }
if(!strlen(inputtext)) { ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Invalid password.Enter password to login.", "Login", "Quit"); }
INI_ParseFile(PlayerFile(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
if(!strcmp(inputtext, PlayerInfo[playerid][pPass]))
{
SetSpawnInfo(playerid, 0, 137, -1974.4125, 138.0872 ,27.6875, 90, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Invalid password.Enter password to login.", "Login", "Quit");
}
}
return 1;
}
Now i can login even with wrong password. =))))))
Re: [Help] Can't login -
Mencent - 02.08.2015
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == REGISTER)
{
new Value = strval(inputtext);
if(!response){ Kick(playerid); }
if(!strlen(inputtext)) { ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Invalid password. Enter password to register.", "Register", "Quit"); }
new INI:File = INI_Open(PlayerFile(playerid));
INI_SetTag(File, "Information");
INI_WriteInt(File, "Password", Value);
INI_Close(File);
}
else if(dialogid == LOGIN)
{
if(!response){ Kick(playerid); }
if(!strlen(inputtext)) { ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Invalid password.Enter password to login.", "Login", "Quit"); }
INI_ParseFile(PlayerFile(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
printf("inputtext: %s - pPass: %s",inputtext,PlayerInfo[playerid][pPass]);
if(!strcmp(inputtext, PlayerInfo[playerid][pPass],false))
{
SetSpawnInfo(playerid, 0, 137, -1974.4125, 138.0872 ,27.6875, 90, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Invalid password.Enter password to login.", "Login", "Quit");
}
}
return 1;
}
Take this. What is printing in the console (server.log) if you are logging in? (Please, don't send us the code of the console otherwise we can see your password...) Check if inputtext and pPass are the same if you enter your password (correct password).
Re: [Help] Can't login -
xVIP3Rx - 02.08.2015
pawn Код:
else if(dialogid == LOGIN)
{
if(!response) return Kick(playerid);
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Invalid password.Enter password to login.", "Login", "Quit");
INI_ParseFile(PlayerFile(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
new string[128];
format(string, 128, "you entered: %s, the actual password: %s", inputtext, PlayerInfo[playerid][pPass]);
SendClientMessage(playerid, -1, string);
if(!strcmp(inputtext, PlayerInfo[playerid][pPass]))
{
SetSpawnInfo(playerid, 0, 137, -1974.4125, 138.0872 ,27.6875, 90, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
else return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Invalid password.Enter password to login.", "Login", "Quit");
}
Re: [Help] Can't login -
javad - 02.08.2015
Код:
[22:02:34] inputtext: 1234 - pPass:
1234 is not the correct password but i spawned.
I think the Player's data didn't load.
![undecided](images/smilies/neutral.gif)
Right?
Код:
forward LoadUser_data(playerid, name[], value[]);
public LoadUser_data(playerid, name[], value[])
{
INI_Int("Password", PlayerInfo[playerid][pPass]);
return 1;
}
Re: [Help] Can't login -
xVIP3Rx - 02.08.2015
You're right, try this
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == REGISTER)
{
new Value = strval(inputtext);
if(!response) return Kick(playerid);
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Invalid password. Enter password to register.", "Register", "Quit");
new INI:File = INI_Open(PlayerFile(playerid));
INI_SetTag(File, "Information");
INI_WriteInt(File, "Password", Value);
INI_Close(File);
}
else if(dialogid == LOGIN)
{
if(!response) return Kick(playerid);
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Invalid password.Enter password to login.", "Login", "Quit");
INI_ParseFile(PlayerFile(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
printf("inputtext: %s - pPass: %s",inputtext,PlayerInfo[playerid][pPass]);
if(strcmp(inputtext, PlayerInfo[playerid][pPass],false)) return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Invalid password.Enter password to login.", "Login", "Quit");
SetSpawnInfo(playerid, 0, 137, -1974.4125, 138.0872 ,27.6875, 90, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
return 1;
}
Re: [Help] Can't login -
javad - 02.08.2015
[22:16:33] [join] Mohammad_Shams has joined the server (0:127.0.0.1)
[22:16:35] inputtext: 123 - pPass: і
[22:16:36] inputtext: 5555 - pPass: і
[22:16:38] inputtext: 5555 - pPass: і
[22:16:39] inputtext: 123 - pPass: і
[22:16:39] [part] Mohammad_Shams has left the server (0:2)
[22:16:39] inputtext: - pPass: і
Kill me
P.S.
Correct password = 5555
Re: [Help] Can't login -
javad - 02.08.2015
Download:
http://www.solidfiles.com/d/14c5312700/
This is the script.
Re: [Help] Can't login -
xVIP3Rx - 02.08.2015
Got it
pawn Код:
INI_WriteInt(File, "Password", Value);
password isn't integer, so save it as a string
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == REGISTER)
{
if(!response) return Kick(playerid);
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Invalid password. Enter password to register.", "Register", "Quit");
new INI:File = INI_Open(PlayerFile(playerid));
INI_SetTag(File, "Information");
INI_WriteString(File, "Password", inputtext);
INI_Close(File);
}
else if(dialogid == LOGIN)
{
if(!response) return Kick(playerid);
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Invalid password.Enter password to login.", "Login", "Quit");
INI_ParseFile(PlayerFile(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
printf("inputtext: %s - pPass: %s",inputtext,PlayerInfo[playerid][pPass]);
if(strcmp(inputtext, PlayerInfo[playerid][pPass],false)) return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Invalid password.Enter password to login.", "Login", "Quit");
SetSpawnInfo(playerid, 0, 137, -1974.4125, 138.0872 ,27.6875, 90, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
return 1;
}
forward LoadUser_data(playerid, name[], value[]);
public LoadUser_data(playerid, name[], value[])
{
INI_String("Password", PlayerInfo[playerid][pPass]);
return 1;
}