setpass help!!

Started by AroliS^, Jan 19, 2019, 03:22 AM

Previous topic - Next topic

AroliS^

if ( cmd == "setpass" || cmd == "newpassword" )
{
if ( !text ) MessagePlayer( " /"+ cmd +" <plr> <pass>", player );
else
{
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) ::MessagePlayer( "Unknown Player.", player );
else
}
local pass = GetTok( text, " ", 2);
if ( !pass ) ::MessagePlayer( cmd + " <plr> <pass>", player );
else
{
local password = SHA256( pass );
QuerySQL( db, "UPDATE Accounts SET Password='" + password + "' WHERE Name='" + plr.Name + "'" );
::MessagePlayer( "You changed " + plr.Name + " password to: " + pass, player );
::MessagePlayer( "[#FFD700]** [ADMIN][#9400D3] " + player.Name + "[#FFFFFF] change ur password: " + pass, plr );
}
return 0;
}

something is wrong when i changed someone password /login don't read sha256 passwords this is what i have on login command 

if ( SHA256(text) != GetPass( player ) ) return ::MessagePlayer( "Wrong password. [" + pstatus[ player.ID ].Warnlogg + "/3]", player );
           
the current account with yellow is how my setpass do sha256 password and the other are when players use /register + password   


Lemme love ya

MatheuS

Change the line:
local pass = SHA256(text);
to:

local pass = SHA256(p);
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

AroliS^

Lemme love ya