y_ini. Cannot load Password.
#1

The password doesn't load and it can't read it to check if it's correct to login.
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    printf("Pass: %s", PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 1;
}
pawn Код:
// OnPlayerResponseDialog
        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                new
                    hashed_password[ 129 ];
                WP_Hash( hashed_password, sizeof ( hashed_password ), inputtext );
               
                if( !strcmp ( hashed_password, PlayerInfo[playerid][pPass] ) )
                // if(!strcmp(hashed_password, PlayerInfo[playerid][pPass], false, 129))
                {
                    printf("It works!\nBuffer: %s ", hashed_password);
                    printf("It works!\nPassword: %s", PlayerInfo[playerid][pPass]);
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    printf("It doesn't work.\nBuffer: %s and Password: %s", hashed_password, PlayerInfo[playerid][pPass]);
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}
Код:
Server Log:
[17:03:59] Incoming connection: 127.0.0.1:2443
[17:04:00] [join] Dwane has joined the server (0:127.0.0.1)
[17:04:00] Pass: 
[17:04:00] Pass: 
[17:04:00] Pass: 
[17:04:00] Pass: 
[17:04:02] It works!
Buffer: BDCE7F9429B4A7EFDA777AF403CC154903B0771232CFBB01549741920E69185D9E2BA9042DD2CA47ADA75C9639B878210FDDA5F2930908EB9D79346997FA86AD 
[17:04:02] It works!
Password: 
[17:04:02] Pass: 
[17:04:02] Pass: 
[17:04:02] Pass: 
[17:04:02] Pass: 
[17:04:09] [part] Dwane has left the server (0:1)
[17:05:11] --- Server Shutting Down.
Reply


Messages In This Thread
y_ini. Cannot load Password. - by Konstantinos - 16.01.2012, 14:07
Re: y_ini. Cannot load Password. - by Wesley221 - 16.01.2012, 14:29
Re: y_ini. Cannot load Password. - by Konstantinos - 16.01.2012, 14:52

Forum Jump:


Users browsing this thread: 1 Guest(s)