Password doesn't save ... -
rockhopper - 07.11.2014
See I have added a Autosave feature but then too password doesn't save at all i:e In the player file it is like Pass=
Here is all required code
THE AUTOSAVE
PHP код:
stock AutoSave(playerid)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"PlayerData");
INI_WriteString(File, "Password", PlayerInfo[playerid][pPass]);// This Is the PAss
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"IsJailed",PlayerInfo[playerid][pJailed]);
INI_WriteInt(File,"IsBanned",PlayerInfo[playerid][pBanned]);
INI_WriteInt(File,"Warnings",PlayerInfo[playerid][pWarn]);
INI_WriteInt(File,"SecondPass",PlayerInfo[playerid][pSPass]);
INI_WriteString(File, "Mail", PlayerInfo[playerid][pMail]);
INI_WriteInt(File,"Email Check",PlayerInfo[playerid][pCMail]);
INI_Close(File);
return 1;
}
THE LOAD USER DATA
PHP код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_String("Password",PlayerInfo[playerid][pPass], 129);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin Level",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
INI_Int("IsJailed",PlayerInfo[playerid][pJailed]);
INI_Int("IsBanned",PlayerInfo[playerid][pBanned]);
INI_Int("Warnings",PlayerInfo[playerid][pWarn]);
INI_Int("SecondPass",PlayerInfo[playerid][pSPass]);
INI_String("Mail",PlayerInfo[playerid][pMail], 300);
INI_Int("Email Check",PlayerInfo[playerid][pCMail]);
return 1;
}
OnPlayerDisconnect
PHP код:
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"PlayerData");
INI_WriteString(File, "Password", PlayerInfo[playerid][pPass]);
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"IsJailed",PlayerInfo[playerid][pJailed]);
INI_WriteInt(File,"IsBanned",PlayerInfo[playerid][pBanned]);
INI_WriteInt(File,"Warnings",PlayerInfo[playerid][pWarn]);
INI_WriteInt(File,"SecondPass",PlayerInfo[playerid][pSPass]);
INI_WriteString(File, "Mail", PlayerInfo[playerid][pMail]);
INI_WriteInt(File,"Email Check",PlayerInfo[playerid][pCMail]);
INI_Close(File);
THE ENUM
PHP код:
enum pInfo
{
pPass[129],
pCash,
pAdmin,
pKills,
pDeaths,
pScore,
pJailed,
pBanned,
pWarn,
pMail[300],
pSPass,
pCMail,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
And Last the register Dialog Part
PHP код:
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Making your account ..",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"PlayerData");
new HashPass[129];
WP_Hash(HashPass, sizeof(HashPass), inputtext);
INI_WriteString(File, "Password", HashPass);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",-1);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"IsJailed",0);
INI_WriteInt(File,"IsBanned",0);
INI_WriteInt(File,"Warnings",0);
PlayerInfo[playerid][pSPass] = 100*random(10) + random(10) + random(10);
INI_WriteInt(File,"Email Check",0);
INI_Close(File);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Account created!",""COL_GREEN"You've created an account successfuly. ","Ok","");
ShowPlayerDialog(playerid, DIALOG_MAIL, DIALOG_STYLE_INPUT, ""COL_WHITE"Setting up Mail",""COL_WHITE"Type your email ID for password recovery purposes \n You can't enter it later and if lost your password it \n can't be recovered ","Set","Abort");
}
}
And this problem occurred now First it was fine ...
Re: Password doesn't save ... -
Banana_Ghost - 07.11.2014
OnPlayerDisconnect
pawn Код:
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"PlayerData");
//INI_WriteString(File, "Password", PlayerInfo[playerid][pPass]); //remove this
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"IsJailed",PlayerInfo[playerid][pJailed]);
INI_WriteInt(File,"IsBanned",PlayerInfo[playerid][pBanned]);
INI_WriteInt(File,"Warnings",PlayerInfo[playerid][pWarn]);
INI_WriteInt(File,"SecondPass",PlayerInfo[playerid][pSPass]);
INI_WriteString(File, "Mail", PlayerInfo[playerid][pMail]);
INI_WriteInt(File,"Email Check",PlayerInfo[playerid][pCMail]);
INI_Close(File);
Don't resave their password when they quit. This should work.
Re: Password doesn't save ... -
rockhopper - 07.11.2014
Thanks a Lot <3