Password Match as a string.
#1

Hello everyone,

I was coding my own game mode. So i used this thread in the starting to do things

So everything use to work fine for me. But suddenly my password hasher stopped working and it wont use to match both the passwords. So i edited my game mode and made it like: That will save the password as a string. and it worked in the end. But now when i try to do it , it doesnt work. I even made changes in the script but nothing happens.

pawn Код:
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login to your account.","Type your password below to login.","Login","Quit");
        return 1;
    }
    else
    {
       ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Registering your acount.","Type your password below to register a new account.","Register","Quit");
    }
    return 1;
}



// The Dialog Response callback
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                new NKey[30];
                format(NKey, sizeof(NKey), "%s",inputtext);
                if(!strlen(inputtext))
                {
                    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Blank Password.","Please type your password below to register a new account.","Register","Quit");
                    SendClientMessage(playerid, COLOR_GREEN, "[CW:WW3] Your password can not be left blank. Please input password to register your account & proceed.");
                }
                new INI:File = INI_Open(UserPath(playerid));
                INI_WriteString(File, "Key",NKey);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Banned",0);
                INI_WriteInt(File,"DonateRank",0);
                INI_WriteInt(File,"Warnings",0);
                INI_WriteInt(File,"Jail",0);
                INI_WriteInt(File,"JailTime",0);
                INI_WriteInt(File,"Cash", 1000);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Muted",0);
                INI_WriteInt(File,"Hide",0);
                INI_WriteInt(File,"Spree",0);
                INI_WriteInt(File,"DuelWon",0);
                INI_WriteInt(File,"DuelLost",0);
                INI_WriteInt(File,"Clan",0);
                INI_WriteInt(File,"ClanRank",0);
                INI_Close(File);
            }
        }
        case DIALOG_CHANGEPASS:
        {
            new NKey[30];
            format(NKey, sizeof(NKey), "%s",inputtext);
            new INI:File = INI_Open(UserPath(playerid));
            INI_WriteString(File, "Key", NKey);
            INI_Close(File);
            new str[128];
            format(str, sizeof(str), "[CW:WW3] Your password has been changed to "COL_GREEN"%s",inputtext);
            SendClientMessage(playerid, COLOR_RED, str);
            return 1;
        }
        case DIALOG_LOGIN:
        {
            if (!response) return Kick (playerid);
            if(response)
            {
                new NKey[30];
                format(NKey, sizeof(NKey), "%s",inputtext);
                if(strcmp(PlayerInfo[playerid][pKey],NKey , true) == 0)
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SendClientMessage(playerid, COLOR_RED, ""COL_GREEN"You have successfully logged in!");
                    gPlayerLogged[playerid] = 1;
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
            return 1;
        }
    }
}

//The callback which loads the user.
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_String("Key",PlayerInfo[playerid][pKey],30);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Banned",PlayerInfo[playerid][pBanned]);
    INI_Int("DonateRank",PlayerInfo[playerid][pDonateRank]);
    INI_Int("Warnings",PlayerInfo[playerid][pWarns]);
    INI_Int("Jail",PlayerInfo[playerid][pJail]);
    INI_Int("JailTime",PlayerInfo[playerid][pJailTime]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Muted",PlayerInfo[playerid][pMuted]);
    INI_Int("Hide",PlayerInfo[playerid][pHide]);
    INI_Int("Spree",PlayerInfo[playerid][pSpree]);
    INI_Int("DuelWon",PlayerInfo[playerid][pDuelWon]);
    INI_Int("DuelLost",PlayerInfo[playerid][pDuelLost]);
    INI_Int("Clan",PlayerInfo[playerid][pClan]);
    INI_Int("ClanRank",PlayerInfo[playerid][pClanRank]);
    return 1;
}

In case any know how to fix it. Please tell me. Im using y_ini to save/read things. Please someone help me.

If you can make this work using any kind of password hasher , if works fine ill use it. What am i doing wrong? Spent so much time on it. Please help.

Thanks
Ballu Miaa
Reply
#2

I am convinced that y_ini is bugged on 0.3e.
Another dude had the exact same problem in this thread: http://forum.sa-mp.com/showthread.ph...55#post1866055
INI_ParseFile wasn't parsing the file.
Reply
#3

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
I am convinced that y_ini is bugged on 0.3e.
Another dude had the exact same problem in this thread: http://forum.sa-mp.com/showthread.ph...55#post1866055
INI_ParseFile wasn't parsing the file.
Damn Oh My Fucking God thats bad. But it worked for a bit for me lol? It wasnt working before yes. But it worked for like an hour when i was saving/loading as a string without the hasher. Worked fine for me at that time. I came after 2 hours and ran the script. I countered the same problem again :S

Changing script since morning now but no use lol. Alex Cole aka ****** where are you my bro?
Reply
#4

On changing the strcmp code when comparing the two string to check the correct password. Sometimes logs me in , and it even logs anyone no matter they type.

****** brother we really want your help? INI_ParseFile is bugged on 0.3e? Or what do we need to do ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)