YINI Password Issue... Again...
#1

Alright, once again I am having an issue with my YINI login system, basically regardless of what password you input it says the password is incorrect, here is my coding:

pawn Код:
public loadaccount_user(playerid, name[], value[])
{
    INI_String("Password", pInfo[playerid][Pass],129);
    INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);
    INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);
    INI_Int("Money",pInfo[playerid][Money]);
    INI_Int("Scores",pInfo[playerid][Scores]);
    INI_Int("Kills",pInfo[playerid][Kills]);
    INI_Int("Deaths",pInfo[playerid][Deaths]);
    INI_Int("Faction",pInfo[playerid][Faction]);
    INI_Int("FactionRank",pInfo[playerid][FactionRank]);
    INI_Int("Skin",pInfo[playerid][Skin]);
    INI_Int("BankMoney",pInfo[playerid][BankMoney]);
    INI_Int("Level",pInfo[playerid][Level]);
    INI_Int("Experience",pInfo[playerid][Experience]);
    INI_Int("TutorialTaken",pInfo[playerid][TutorialTaken]);
    INI_Int("SpawnSelection",pInfo[playerid][SpawnSelection]);
    return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(fexist(Path(playerid)))
    {
        new INI:file = INI_Open(Path(playerid));
        INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]);
        INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);
        INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
        INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
        INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
        INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
        INI_WriteInt(file,"Faction",pInfo[playerid][Faction]);
        INI_WriteInt(file,"FactionRank",pInfo[playerid][FactionRank]);
        INI_WriteInt(file,"Skin",pInfo[playerid][Skin]);
        INI_WriteInt(file,"BankMoney",pInfo[playerid][Skin]);
        INI_WriteInt(file,"Level",pInfo[playerid][Level]);
        INI_WriteInt(file,"Expereience",pInfo[playerid][Experience]);
        INI_WriteInt(file,"TutorialTaken",pInfo[playerid][TutorialTaken]);
        INI_WriteInt(file,"SpawnSelection",pInfo[playerid][SpawnSelection]);
        INI_Close(file);
        return 1;
    }
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == dregister)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(!strlen(inputtext))
            {
                ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
                return 1;
            }
            new plrIP[16];
            new string[128];
            new hashpass[129];
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            new INI:file = INI_Open(Path(playerid));
            INI_WriteString(file,"Password",hashpass);
            INI_WriteInt(file,"AdminLevel",0);
            INI_WriteInt(file,"VIPLevel",0);
            INI_WriteInt(file,"Money",1500);
            INI_WriteInt(file,"Scores",0);
            INI_WriteInt(file,"Kills",0);
            INI_WriteInt(file,"Deaths",0);
            INI_WriteInt(file,"Faction",0);
            INI_WriteInt(file,"FactionRank",0);
            INI_WriteInt(file,"Skin",26);
            INI_WriteInt(file,"BankMoney",2500);
            INI_WriteInt(file,"Level",1);
            INI_WriteInt(file,"Experience",0);
            INI_WriteInt(file,"TutorialTaken",0);
            INI_WriteInt(file,"SpawnSelection",1);
            INI_Close(file);
            format(string, sizeof(string), "You have registered! [IP: %d] [PING: %d]", GetPlayerIp(playerid, plrIP, sizeof(plrIP)) , GetPlayerPing(playerid));
            SendClientMessage(playerid, 0x02D8FDFF, string);
            if(pInfo[playerid][Faction] >= 1)
            {
                format(string, sizeof(string), "Administrative Level: %d | Faction: %d (Rank %d) | Helper: No | Money: %d", pInfo[playerid][Adminlevel], pInfo[playerid][Faction], pInfo[playerid][FactionRank], pInfo[playerid][Money]);
                SendClientMessage(playerid, 0x02D8FDFF, string);
                format(string, sizeof(string), "Bank Money: %d | Level: %d | Experience: %d | Address: None | Skin %d", pInfo[playerid][BankMoney], pInfo[playerid][Level], pInfo[playerid][Experience], pInfo[playerid][Skin]);
                SendClientMessage(playerid, 0x02D8fDFF, string);
            }
            else
            {
                format(string, sizeof(string), "Administrative Level: %d | Faction: Civilian (N/A) | Helper: No | Money: %d", pInfo[playerid][Adminlevel], pInfo[playerid][Faction], pInfo[playerid][FactionRank], pInfo[playerid][Money]);
                SendClientMessage(playerid, 0x02D8FDFF, string);
                format(string, sizeof(string), "Bank Money: %d | Level: %d | Experience: %d | Address: None | Skin %d", pInfo[playerid][BankMoney], pInfo[playerid][Level], pInfo[playerid][Experience], pInfo[playerid][Skin]);
                SendClientMessage(playerid, 0x02D8fDFF, string);
            }
            return 1;
        }
    }
    if(dialogid == dlogin)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new string[128];
            new plrIP[999];
            new hashpass[129];
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            if(!strcmp(hashpass,pInfo[playerid][Pass]))
            {
                pInfo[playerid][Authenticated] = 1;
                TogglePlayerSpectating(playerid, false);
                format(string, sizeof(string), "You have successfully logged in! [IP: %d] [PING: %d]", GetPlayerIp(playerid, plrIP, sizeof(plrIP)) , GetPlayerPing(playerid));
                SendClientMessage(playerid, 0x02D8FDFF, string);
                pInfo[playerid][Authenticated] = 1;
                if(pInfo[playerid][Faction] >= 1)
                {
                    format(string, sizeof(string), "Administrative Level: %d | Faction: %d (Rank %d) | Helper: No | Money: %d", pInfo[playerid][Adminlevel], pInfo[playerid][Faction], pInfo[playerid][FactionRank], pInfo[playerid][Money]);
                    SendClientMessage(playerid, 0x02D8FDFF, string);
                    format(string, sizeof(string), "Bank Money: %d | Level: %d | Experience: %d | Address: None | Skin %d", pInfo[playerid][BankMoney], pInfo[playerid][Level], pInfo[playerid][Experience], pInfo[playerid][Skin]);
                    SendClientMessage(playerid, 0x02D8fDFF, string);
                }
                else
                {
                    format(string, sizeof(string), "Administrative Level: %d | Faction: Civilian (N/A) | Helper: No | Money: %d", pInfo[playerid][Adminlevel], pInfo[playerid][Faction], pInfo[playerid][FactionRank], pInfo[playerid][Money]);
                    SendClientMessage(playerid, 0x02D8FDFF, string);
                    format(string, sizeof(string), "Bank Money: %d | Level: %d | Experience: %d | Address: None | Skin %d", pInfo[playerid][BankMoney], pInfo[playerid][Level], pInfo[playerid][Experience], pInfo[playerid][Skin]);
                    SendClientMessage(playerid, 0x02D8fDFF, string);
                }
                if(pInfo[playerid][SpawnSelection] == 1)
                {
                    SetPlayerPos(playerid, -2485.8848,2224.3340,4.8480);
                    SpawnPlayer(playerid);
                }
                SetCameraBehindPlayer(playerid);
                INI_ParseFile(Path(playerid),"loadaccount_user", .bExtra = true, .extra = playerid);
                SetPlayerScore(playerid,pInfo[playerid][Scores]);
                SetPlayerSkin(playerid,pInfo[playerid][Skin]);
                GivePlayerMoney(playerid,pInfo[playerid][Money]);
            }
            else
            {
                new IncorrectPasswords;
                if(IncorrectPasswords < 3)
                {
                    format(string, sizeof(string), "Welcome back, {0D72EE}%s!{FFFFFF} \nPlease enter your password below to login to your account.", RPName(playerid));
                    INI_ParseFile(Path(playerid),"loadaccount_user", .bExtra = true, .extra = playerid);
                    ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login",string,"Login","Quit");
                    SendClientMessage(playerid, 0x8F8F8FFF, "ERROR: You have inserted an invalid password!");
                    IncorrectPasswords ++;
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, 0xFF0000FF, "SERVER: You have been kicked for the following reason: Multiple failed login attempts.");
                    Kick(playerid);
                    return 1;
                }
            }
        }
     }
    return 1;
}
Any and all help will be appreciated, especially being this must be fixed before I may continue.

Kind regards,
~Nmader
Reply
#2

I noticed that you're not using a Tag. (INI_SetTag).
You need to set the tag
pawn Код:
INI_SetTag(File, "user");
And last, do you use ParseFile in OnPlayerConnect to load the password?
Reply
#3

Quote:
Originally Posted by Dwane
Посмотреть сообщение
I noticed that you're not using a Tag. (INI_SetTag).
You need to set the tag
pawn Код:
INI_SetTag(File, "user");
And last, do you use ParseFile in OnPlayerConnect to load the password?
I added in the INI_SetTag and it had not worked.

And yes, I did.
Reply
#4

You need to set the tag in some parts of your system, check out tutorials about registration systems using y_ini. It'll really help you.
Reply
#5

Quote:
Originally Posted by Dwane
Посмотреть сообщение
You need to set the tag in some parts of your system, check out tutorials about registration systems using y_ini. It'll really help you.
I have, Dwane...
Reply
#6

Alright, I'm not at my pc at the moment, so would you mind to show me the register/login part via PM and I'll try to fix it when I come back to home
Reply
#7

PMed you the code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)