PDA

View Full Version : Changepassword


Despacito
20/04/2017, 08:51 AM
Hello, i have this command from my old gamemode, which players can be able to change password:

CMD:changepass(playerid, params[])
{
if(PlayerInfo[playerid][pLogged] == 1)
{
new pass[30];
if(sscanf(params,"s[30]", pass)) return SendClientMessage(playerid, RED,"[USAGE]: /changepass [new password]");
new query[200];
format(query, sizeof(query),"UPDATE `playerdata` SET `password`=SHA1('%s') WHERE `user`='%s'", pass, escpname(playerid));
mysql_query(query);
mysql_free_result();
new str[120];
format(str, sizeof(str),"Your password has been successfully changed to "cred"%s", pass);
SendClientMessage(playerid, GREEN,str);
}
else
{
SendClientMessage(playerid, RED, "ERROR: You must login in order to change your password");
}
return 1;
}

Since in the new gamemode im not using SHA1 anymore but SHA256, how should i edit it to make it work with new hashing system? Thanks.

DobbysGamertag
20/04/2017, 09:41 AM
Can you at least update to a newer mysql plugin?

However:

UPDATE `playerdata` SET `password`=SHA2('%s',256) WHERE `user`='%s' LIMIT 1