Problem with Y_INI Login/Register
#1

---Fixed--
Reply
#2

show me your LoadUser_data public function and the OnPlayerConnect.
Reply
#3

Register Login stock

pawn Код:
stock RLPlayer(playerid)
{
  new pName [ MAX_PLAYER_NAME ] ;
  GetPlayerName ( playerid , pName , MAX_PLAYER_NAME ) ;
  if(fexist(UserAccount(playerid)))
  {
    INI_ParseFile(UserAccount(playerid),"LoadUser_%s", .bExtra = true, .extra = playerid);
    ShowPlayerDialog(playerid, L_DIALOG, DIALOG_STYLE_PASSWORD,""cgreen"Login",""corange"Your account is already registered\n"cgreen"Please type your password to login","Login","");
  }
  else
  {
    ShowPlayerDialog(playerid, R_DIALOG, DIALOG_STYLE_PASSWORD,""cgreen"Register",""corange"Your account is "cred"not "corange"registered\n"cgreen"Please type your password to register","Register","");
  }
  return 1;
}
LoadUser_data

pawn Код:
public LoadUser_data(playerid, name[], value[])
{
  INI_String("Password", PlayerInfo[playerid][pPass], 129);
  INI_Int("Scores", PlayerInfo[playerid][pScores]);
  INI_Int("Money", PlayerInfo[playerid][pMoney]);
  INI_Int("AdminLevel", PlayerInfo[playerid][pAdmin]);
  INI_Int("Kills", PlayerInfo[playerid][pKills]);
  INI_Int("Deaths", PlayerInfo[playerid][pDeaths]);
  INI_Int("Helper", PlayerInfo[playerid][pHelper]);
  INI_Int("Banned", PlayerInfo[playerid][pBanned]);
  return 1;
}
Reply
#4

Try this maybe?

pawn Код:
if(dialogid == L_DIALOG)
   {
      if(!response) return Kick(playerid);
      else if(response)
      {
        new HashPass[129];
        WP_Hash(HashPass, sizeof(HashPass), inputtext);
        INI_ParseFile(UserAccount(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        if(!strcmp(PlayerInfo [ playerid ] [ pPass ] , HashPass , true ))
        {
            INI_ParseFile(UserAccount(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
            GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
            SetPlayerScore(playerid, PlayerInfo[playerid][pScores]);
        }
        else
        {
            ShowPlayerDialog(playerid, L_DIALOG, DIALOG_STYLE_PASSWORD,""cwhite"Login",""cred"You have entered an incorrect password.\n"cwhite"Type your password below to login.","Login","");
        }
      }
   }
   return 1;
}
You are comparing pPass to the player's inputtext. Did you format the pPass variable with the player's password?
Reply
#5

Why Loaduser_%s? There's the mistake!
Use LoadUser_data and try.
Reply
#6

Yes. and no it didn't worked.

EDIT: Lordz not working.
Reply
#7

Try this
pawn Код:
if(dialogid == L_DIALOG)
   {
      if(!response) return Kick(playerid);
      else if(response)
      {
        new HashPass[129];
        WP_Hash(HashPass, sizeof(HashPass), inputtext);
        INI_ParseFile(UserAccount(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
        if(strcmp(PlayerInfo [ playerid ] [ pPass ] , HashPass , true ))
        {
            INI_ParseFile(UserAccount(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
            GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
            SetPlayerScore(playerid, PlayerInfo[playerid][pScores]);
        }
        else
        {
            ShowPlayerDialog(playerid, L_DIALOG, DIALOG_STYLE_PASSWORD,""cwhite"Login",""cred"You have entered an incorrect password.\n"cwhite"Type your password below to login.","Login","");
        }
      }
   }
   return 1;
}
Or this:
pawn Код:
if(dialogid == L_DIALOG)
   {
      if(!response) return Kick(playerid);
      else if(response)
      {
        new HashPass[129];
        WP_Hash(HashPass, sizeof(HashPass), inputtext);
        INI_ParseFile(UserAccount(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        if(strcmp(PlayerInfo [ playerid ] [ pPass ] , HashPass , true ))
        {
            INI_ParseFile(UserAccount(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
            GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
            SetPlayerScore(playerid, PlayerInfo[playerid][pScores]);
        }
        else
        {
            ShowPlayerDialog(playerid, L_DIALOG, DIALOG_STYLE_PASSWORD,""cwhite"Login",""cred"You have entered an incorrect password.\n"cwhite"Type your password below to login.","Login","");
        }
      }
   }
   return 1;
}
Reply
#8

still not working. i don't know whats wrong ;-/ need ****** here.
Reply
#9

In LoadUser_data
You need to SetTag first otherwise it will try loading data that is NOT in a tag and you haven't got anything there.

Read the Y_INI topic to know what i am talkign about..see the SetTag - Reading functions.
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)