Password problem ( 0GM )
#1

Hi I have a problem. I've been doing for about a week from scratch GM. And now the problem is that the password is not retained. I have onplayerlogin, onplayerregister all passwords but somehow it does not save the password. This is all about enumi pKey [20] and stuff there. I would be a mistake for him to be. If I register the password you will not be saved. And you can go to another user without having to say your password is incorrect. I really do not understand what the problem is.

pawn Code:
// Enum: pKey[20]

public OnPlayerRegister(playerid, password[])
{
    if(IsPlayerConnected(playerid))
    {
            new string3[64];
            new playername3[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playername3, sizeof(playername3));
            format(string3, sizeof(string3), "users/%s.ini", playername3);
            new File: hFile = fopen(string3, io_write);
            if (hFile)
            {
                strmid(KasutajaInfo[playerid][pKey], password, 0, strlen(password), 255);
                new var[64];
                format(var, 64, "Key=%s\n", KasutajaInfo[playerid][pKey]);fwrite(hFile, var);

                fclose(hFile);
                OnPlayerLogin(playerid,KasutajaInfo[playerid][pKey]); // This is the last line..
// End onplayerregister

public OnPlayerLogin(playerid,password[])
{
    new tmp2[256];
    new string2[64];
    new playername2[MAX_PLAYER_NAME];
    new playernamesplit[3][MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    split(playername2, playernamesplit, '_');
    format(string2, sizeof(string2), "users/%s.ini", playername2);
    new File: UserFile = fopen(string2, io_read);
    if ( UserFile )
    {
        new PassData[256];
        new keytmp[256], valtmp[256];
        fread( UserFile , PassData , sizeof( PassData ) );
        keytmp = ini_GetKey( PassData );
        if( strcmp( keytmp , "Key" , true ) == 0 )
        {
            valtmp = ini_GetValue( PassData );
            strmid(KasutajaInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
        }
        if(strcmp(KasutajaInfo[playerid][pKey],password, true ) == 0 )
        {
                new key[ 256 ] , val[ 256 ];
                new Data[ 256 ];
                while ( fread( UserFile , Data , sizeof( Data ) ) )
                {
                    key = ini_GetKey( Data );
If you want to tell me something and I'll give more than is necessary to know something.

Sorry my englis is not good but easy understand. My password not save !.
Reply


Messages In This Thread
Password problem ( 0GM ) - by Aprezt - 06.09.2011, 13:17
Re: Password problem ( 0GM ) - by Aprezt - 06.09.2011, 14:15
Re: Password problem ( 0GM ) - by Kaperstone - 06.09.2011, 14:29
Re: Password problem ( 0GM ) - by Aprezt - 06.09.2011, 14:53
Re: Password problem ( 0GM ) - by Kaperstone - 06.09.2011, 14:55

Forum Jump:


Users browsing this thread: 2 Guest(s)