OfflineChangeUserPassword -
Antoniohl - 07.05.2015
i can't figure it out.. how to put password in the array PlayerInfo[playerid][pPassword]..
Код:
CMD:changeuserpassword(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 2014)
{
new string[128], playername[MAX_PLAYER_NAME], password[32], hashpass[129];
if(sscanf(params, "s[24]s[24]", playername, password)) return SendInfoMessage(playerid, 3, "0", "/changeuserpassword [Firstname_Surname] [Password]");
if(INI_Exist(playername))
{
WP_Hash(hashpass,sizeof(hashpass),password);
new PlayerFile[MAX_PLAYER_NAME + 32];
format( PlayerFile , sizeof PlayerFile, ACCOUNT_DATA, playername);
new INI:File = INI_Open(PlayerFile);
INI_WriteString(File,"Password",hashpass);
format(PlayerInfo[unknown][pPassword],129,hashpass);
INI_Close(File);
format(string, sizeof(string), "You have changed %s's password {00FF6E}their new password is: %s", playername, password);
SendInfoMessage(playerid, 2, "0", string);
}
else
{
SendInfoMessage(playerid,0,"0","This account doesn't exist");
return 1;
}
return 1;
}
else return SendInfoMessage(playerid, 0, "75", "You're not authorized to use this command.");
}
Re: OfflineChangeUserPassword -
sammp - 07.05.2015
Код:
INI_WriteString(file, "password",hashpass);
try dis?
Re: OfflineChangeUserPassword -
Antoniohl - 07.05.2015
it's there?
INI_WriteString(File,"Password",hashpass);
Re: OfflineChangeUserPassword -
Konstantinos - 07.05.2015
Variables are for storing data but since the player is offline why would you try to store it to a variable than overwriting the current password to the file for that player?
This is probably what you need:
https://sampforum.blast.hk/showthread.php?tid=446575&page=3
Re: OfflineChangeUserPassword -
Antoniohl - 07.05.2015
Quote:
Originally Posted by Konstantinos
|
Because it doesn't work, when they try to login it doesn't work, it says wrong password like
this thread exactly
Re: OfflineChangeUserPassword -
Konstantinos - 07.05.2015
It won't work with variables either so that is the only way.
Are you sure the "field" name is correct? What's the result after trying changing the password for an offline player (to their file)?
Re: OfflineChangeUserPassword -
Antoniohl - 07.05.2015
In their file the password changed successfully, and hashed but when i try to login it says wrong.
Re: OfflineChangeUserPassword -
sammp - 07.05.2015
Woops again..
Vars with [MAX_PLAYERS] are for online players only. You don't need to update their enum data until they log back in.
Just format it BEFORe the INI_WriteString() and remove the variable, use a tmp var to store it
Also what does the file say for the password field