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.");
}
INI_WriteString(file, "password",hashpass);
|
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 |