Incorrect password, please help :[
#1

Hello everyone, since I tried to improve my register account system... and wanted to use dini for that as it's the simplest for me...

So I changed everything to dini functions... and now in game when I /register password it works, and /login password it says Incorrect password all the times...

Can anyone help please? Here is the code...

pawn Code:
stock PlayerStats( playerid )
{
    if (IsPlayerConnected(playerid))
    {
        if (PlayerInfo[playerid][ pLogged ] ==1)
        {
      new string3[32];
            new playername3[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playername3, sizeof(playername3));
            format(string3, sizeof(string3), "/Accounts/%s.ini", playername3);
            new ip[ 20 ];
          GetPlayerIp(playerid,ip,sizeof(ip));
            new File: hFile = fopen(string3, io_write);
            if (hFile)
            {
              dini_Set(string3, "Password", PlayerInfo[playerid][ pPassword ]);
              dini_IntSet(string3, "AdminLevel", PlayerInfo[playerid][pAdmin]);
                dini_IntSet(string3, "Money", PlayerInfo[playerid][pCash]);
                dini_IntSet(string3, "Score", PlayerInfo[playerid][pScore]);
                dini_IntSet(string3, "Kills", PlayerInfo[playerid][pKills]);
                dini_IntSet(string3, "Deaths", PlayerInfo[playerid][pDeaths]);
                dini_IntSet(string3, "Level", PlayerInfo[playerid][Level]);
                dini_IntSet(string3, "Exp", PlayerInfo[playerid][Exppoints]);
                fclose(hFile);
            }
        }

    }
    return 1;
}
This function above is called when please leaves, OnPlayerDisconnect...
_________________________________________________
pawn Code:
stock OnPlayerRegister( playerid, password[] )
{
    if (IsPlayerConnected(playerid)) {
        new string3[32], playername3[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername3, sizeof(playername3));
        format(string3, sizeof(string3), "/Accounts/%s.ini", playername3);
        new ip[ 20 ];
        GetPlayerIp(playerid,ip,sizeof(ip));
        new File: hFile = fopen(string3, io_write);
        if (hFile) {
          strmid(PlayerInfo[playerid][ pPassword ], password, 0, strlen(password), 255);
          dini_Set(string3, "Password", PlayerInfo[playerid][ pPassword ]);
          dini_IntSet(string3, "AdminLevel", 0);
        dini_IntSet(string3, "Money", 0);
          dini_IntSet(string3, "Score", 0);
          dini_IntSet(string3, "Kills", 0);
          dini_IntSet(string3, "Deaths", 0);
          dini_IntSet(string3, "Level", 0);
          dini_IntSet(string3, "Exp", 0);
          dini_Set(string3, "IP", ip);
            fclose(hFile);
          SendClientMessage(playerid, COLOR_FINALSCORE, "You have successfully registered! You may now use /login password to login.");
            ResetPlayerMoney(playerid);
        }
    }
    return 1;
}
This code above is used on dcmd_register...
_________________________________________________
pawn Code:
stock OnPlayerLogin( playerid, password[] )
{
  new string2[ 64 ], playername2[ MAX_PLAYER_NAME ], string[ 128 ];

  GetPlayerName(playerid, playername2, sizeof(playername2));
    format(string2, sizeof(string2), "/Accounts/%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 , "Password" , true ) == 0 )
        {
            valtmp = ini_GetValue( PassData );
            strmid(PlayerInfo[playerid][ pPassword ], valtmp, 0, strlen(valtmp)-1, 255);
        }
        if(strcmp(PlayerInfo[playerid][ pPassword ],password, true ) == 0 )
        {
              new Data[ 256 ];
              while ( fread( UserFile , Data , sizeof( Data ) ) )
                {
                  PlayerInfo[playerid][pAdmin] = dini_Int(string2, "AdminLevel");
                    PlayerInfo[playerid][pCash] = dini_Int(string2, "Money");
                    PlayerInfo[playerid][pScore] = dini_Int(string2, "Score");
                    PlayerInfo[playerid][pKills] = dini_Int(string2, "Kills");
                    PlayerInfo[playerid][pDeaths] = dini_Int(string2, "Deaths");
                    PlayerInfo[playerid][Level] = dini_Int(string2, "Level");
                    PlayerInfo[playerid][Exppoints] = dini_Int(string2, "Exp");
        }//end while
        fclose(UserFile);//close the file after everything has been read in the while
        }
        else
        {
      SetPVarInt(playerid, "LWarn", GetPVarInt(playerid, "LWarn")+1);
            format(string, sizeof(string), "ERROR: Incorrect password! [WARNINGS %d/3]", GetPVarInt(playerid, "LWarn"));
            SendClientMessage(playerid, COLOR_RED, string);
            if(GetPVarInt(playerid, "LWarn") == 3) {
            SendClientMessage(playerid, COLOR_RED, "You have been kicked from the server for too many failed logins");
            Kick(playerid);
        fclose(UserFile);
        }
        return 1;
        }
        PlayerInfo[ playerid ][ pLogged ] =1;
    GivePlayerMoney(playerid,PlayerInfo[playerid][ pCash ]);
        SetPlayerScore(playerid,PlayerInfo[playerid][ pKills ]);
        SystemMsg(playerid, "You have successfully logged in! You may now select your team.");
    }
    return 1;
}
This code above is used in dcmd_login...

If you know where the problem may be, please help me as it's URGENTLY....
Reply
#2

Guys this is very urgently.... if you can just please try to help me... I don't know why it doesn't work... please...
Reply
#3

I really need this fixed, PLEASE help me, PLEASE!
Reply
#4

Check if it save the PASSWOR when you /Register
Reply
#5

Quote:
Originally Posted by park4bmx
Check if it save the PASSWOR when you /Register
It does save, I guess... just when I want to /login it says incorrect password
Reply
#6

Find the scriptfiles and you mabye find (Pass or somting try to use that if you find it!
server>scriptfiles>name.txt

Quote:
Key=?? <-----//mabye that!
Level=16
AdminLevel=0
DonateRank=0
UpgradePoints=0
ConnectedTime=0
Registered=1
Sex=1
Age=24
Origin=1
CK=0
Muted=0
Respect=27
Money=10999500
Bank=13000000
Crimes=0
Kills=0
Deaths=4
Arrested=0
WantedDeaths=0
Phonebook=0
LottoNr=0
Fishes=0
BiggestFish=0
Job=16
Paycheck=1214
HeadValue=0
Jailed=0
JailTime=0
Materials=1532500
Drugs=0
Leader=1
Member=0
FMember=255
Rank=0
Char=0
ContractTime=0
DetSkill=0
SexSkill=0
BoxSkill=0
LawSkill=0
MechSkill=0
JackSkill=0
CarSkill=0
NewsSkill=0
DrugsSkill=0
CookSkill=0
FishSkill=0
pSHealth=0.0
pHealth=23.0
Int=0
Local=255
Team=11
Model=0
PhoneNr=321
House=255
Bizz=255
Pos_x=2246.6
Pos_y=-1161.9
Pos_z=1029.5
CarLic=0
FlyLic=0
BoatLic=0
FishLic=0
GunLic=0
Gun1=0
Gun2=0
Gun3=0
Gun4=0
Ammo1=0
Ammo2=0
Ammo3=0
Ammo4=0
CarTime=0
PayDay=1
PayDayHad=0
CDPlayer=0
Wins=0
Loses=0
AlcoholPerk=0
DrugPerk=0
MiserPerk=0
PainPerk=0
TraderPerk=0
Tutorial=1
Mission=0
Warnings=0
Adjustable=1
Fuel=0
Married=0
MarriedTo=No-one

Reply
#7

Ok here is the copy of user file...

Code:
Password=lwn
AdminLevel=0
Money=0
Score=0
Kills=0
Deaths=0
Level=0
Exp=0
IP=127.0.0.1
Passwords are Encrypted maybe thats a problem? Dini can't read Encrypted passwords??

Code:
public Encrypt(string[])
{
	for (new x=0; x < strlen(string); x++) {
		 string[x] += (3^x) * (x % 15);
		 if (string[x] > (0xff)) {
			 string[x] -= 256;
		 }
	}
	return 1;
}
Reply
#8

have you hashed the pass
EXAMPLE
pawn Code:
dini_IntSet(file,"Password", udb_hash(inputtext));
Reply
#9

Quote:
Originally Posted by park4bmx
have you hashed the pass
EXAMPLE
pawn Code:
dini_IntSet(file,"Password", udb_hash(inputtext));
No... it's encrypted...
Reply
#10

I have the same problem, I don't think DINI and Encrypted passwords work :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)