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
#2

Anyone ?
Reply
#3

Quote:
Originally Posted by Aprezt
View Post
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 !.
lol first of all..
you didnt close barackets :
pawn Code:
// Enum: pKey[20]

public OnPlayerRegister(playerid, password[])
{                                                 //1 open
    if(IsPlayerConnected(playerid)) {
                                                  //2 open
        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) {
                                                  //3 open
            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);
                                                  // This is the last line..
            OnPlayerLogin(playerid,KasutajaInfo[playerid][pKey]);
        }                                         //3 close
    }                                             //2 close
    return 1;
}                                                 //1 close


// End onplayerregister

public OnPlayerLogin(playerid,password[])
{                                                 //1 open
    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 ) {
                                                  //2 open
        new PassData[256];
        new keytmp[256], valtmp[256];
        fread( UserFile , PassData , sizeof( PassData ) );
        keytmp = ini_GetKey( PassData );
        if( strcmp( keytmp , "Key" , true ) == 0 ) {
                                                  //3 open
            valtmp = ini_GetValue( PassData );
            strmid(KasutajaInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
        }
        if(strcmp(KasutajaInfo[playerid][pKey],password, true ) == 0 ) {
                                                  //4 open
            new key[ 256 ] , val[ 256 ];
            new Data[ 256 ];
            while ( fread( UserFile , Data , sizeof( Data ) ) ) {
                                                  //5 open
                key = ini_GetKey( Data );
            }                                     //5 close
        }                                         //4 close
    }                                             //3 close
}                                                 //2 close


return 1;
}                                                 //1 close
second: i suggest you to use Kush's registeration/login system Tutorial
Reply
#4

OMG... i got there some shit function like pMoney ... i dont see this is so necessary.

// Edit i am from estonia and you dont understand these names what i write.
Reply
#5

Quote:
Originally Posted by Aprezt
View Post
OMG... i got there some shit function like pMoney ... i dont see this is so necessary.

// Edit i am from estonia and you dont understand these names what i write.
ik.. lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)