08.07.2015, 05:39
Hello, I am having some trouble with my y_ini system. The way I made it work with clickable textdraws that say Login and Register. If the player has a account, it instructs him to click Login, if not, register. Now here is the issue. The register system works perfectly fine, it is loading the account that has the trouble, it says the passwords do not match everytime.
My code.
Clickable Login and Register.
Dialogs.
I am also using a udb hash for hashing the password, any suggestions guys?
If any other code is needed, I will gladly post it! Just ask!.
My code.
pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(clickedid == TDEditor_TD[4])
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, 10, DIALOG_STYLE_INPUT, ""COL_WHITE"Login",""COL_WHITE"Welcome back to the server, input your password please.","Login","Quit");
}
else
{
SendClientMessage(playerid, -1, "Your are not registered, click register!");
return 1;
}
}
if(clickedid == TDEditor_TD[5])
{
if(fexist(UserPath(playerid)))
{
SendClientMessage(playerid, -1, "You currently have a account on the server!.");
}
else
{
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_INPUT,""COL_WHITE"Register",""COL_WHITE"Please enter your desired password to register", "Register","Close");
return 1;
}
}
Dialogs.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 11)
{
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Register",""COL_WHITE"Please enter your desired password to register", "Register","Close");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File, "Statistics");
INI_WriteInt(File, "Password",udb_hash(inputtext));
INI_WriteInt(File, "Money", 0);
INI_WriteInt(File, "Admin Level", 0);
INI_WriteInt(File, "Kills", 0);
INI_WriteInt(File, "Deaths", 0);
INI_Close(File);
SendClientMessage(playerid, -1, "Congratulations, you are now registered and your stats will now save!");
TextDrawHideForPlayer(playerid,TDEditor_TD[0]);
TextDrawHideForPlayer(playerid,TDEditor_TD[1]);
TextDrawHideForPlayer(playerid,TDEditor_TD[2]);
TextDrawHideForPlayer(playerid,TDEditor_TD[3]);
TextDrawHideForPlayer(playerid,TDEditor_TD[4]);
TextDrawHideForPlayer(playerid,TDEditor_TD[5]);
TextDrawHideForPlayer(playerid,TDEditor_TD[7]);
TextDrawHideForPlayer(playerid,TDEditor_TD[8]);
TextDrawHideForPlayer(playerid,TDEditor_TD[9]);
TextDrawHideForPlayer(playerid,TDEditor_TD[10]);
TextDrawHideForPlayer(playerid,TDEditor_TD[11]);
TextDrawHideForPlayer(playerid,TDEditor_TD[12]);
CancelSelectTextDraw(playerid);
}
}
if(dialogid == 10)
{
if(response)
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s",.bExtra = true,.extra =playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SendClientMessage(playerid, -1, "Welcome back to the server!");
TextDrawHideForPlayer(playerid,TDEditor_TD[0]);
TextDrawHideForPlayer(playerid,TDEditor_TD[1]);
TextDrawHideForPlayer(playerid,TDEditor_TD[2]);
TextDrawHideForPlayer(playerid,TDEditor_TD[3]);
TextDrawHideForPlayer(playerid,TDEditor_TD[4]);
TextDrawHideForPlayer(playerid,TDEditor_TD[5]);
TextDrawHideForPlayer(playerid,TDEditor_TD[7]);
TextDrawHideForPlayer(playerid,TDEditor_TD[8]);
TextDrawHideForPlayer(playerid,TDEditor_TD[9]);
TextDrawHideForPlayer(playerid,TDEditor_TD[10]);
TextDrawHideForPlayer(playerid,TDEditor_TD[11]);
TextDrawHideForPlayer(playerid,TDEditor_TD[12]);
CancelSelectTextDraw(playerid);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""COL_WHITE"Login",""COL_WHITE"Welcome back to the server, input your password please.","Login","Quit");
}
}
}
return 1;
}
If any other code is needed, I will gladly post it! Just ask!.