SA-MP Forums Archive
need help always wrong - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: need help always wrong (/showthread.php?tid=339292)



need help always wrong - RicaNiel - 03.05.2012

pawn Код:
public OnPlayerLogin(playerid,password[])
{
    new h_password[ 129 ];
    WP_Hash( h_password, sizeof ( h_password ), password );
    if(strcmp ( h_password, pData[ playerid ][ pPassword ] ) )
    {
        INI_ParseFile(UPath ( playerid ), "LoadUser_%s", .bExtra = true, .extra = playerid);
        SendClientMessage(playerid,C_GREEN,"Correct Password");
    }
    else
    {
        new dbug[500];
        format(dbug,sizeof(dbug),"Password %s [ %s ]",password,h_password);
       
        print(dbug); // thats for debuging
        SendClientMessage(playerid,C_RED,"Wrong Password");
        SPD(playerid,D_LOGIN,PASSWORD,""CSERVER"",""CWHITE"Please Enter Your Password   ToLogin","Proceed","Quit");
    }
    return 1;
}
I always got wrong password i need help


Re: need help always wrong - ReneG - 03.05.2012

You need to parse the file before you check for a password.


Re: need help always wrong - RicaNiel - 03.05.2012

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
You need to parse the file before you check for a password.
i already did but same thing nothing is working


Re: need help always wrong - RicaNiel - 03.05.2012

anyone its been an hour


Re: need help always wrong - SuperViper - 03.05.2012

pawn Код:
if(strcmp ( h_password, pData[ playerid ][ pPassword ] ) )
should be

pawn Код:
if(strcmp ( h_password, pData[ playerid ][ pPassword ] ) == 0)
because strcmp returns 0 if the strings match and 1 if they don't match.