20.04.2017, 08:51
Hello, i have this command from my old gamemode, which players can be able to change password:
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.
pawn Код:
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;
}