SA-MP Forums Archive
Password saves "0" - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Password saves "0" (/showthread.php?tid=375524)

Pages: 1 2


Re: Password saves "0" - Guitar - 08.09.2012

@Kush, thanks and yup your judging is better in a lot of ways, so, I have changed it to WriteInt, but this error showed, it showed before, but I forgot how I fixed it lol,

pawn Code:
C:\Users\3hab\Desktop\BlackEvo 4\samp03e_svr_R2_win32\gamemodes\funland.pwn(1241) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
The error line is:

pawn Code:
INI_WriteInt(File,"Password",buf);
But this one worked, but as Romel changed it .. I didn't know how to change it to the right way,

pawn Code:
INI_WriteInt(File,"Password",WP_Hash(buf, sizeof(buf), inputtext));
@Romel: About LoadData_User, it will just load the "User" data or something ..


Re: Password saves "0" - Aprezt - 08.09.2012

Lol... DONT SAVE PASSWORD delete this lane INI_WriteInt(File,"Password",PlayerInfo[playerid][pPass]);


Re: Password saves "0" - JaKe Elite - 08.09.2012

I told you before.

Its INI_WriteString.

pawn Code:
INI_WriteString(File, "Password", Buf);
Buf is a string not a integer.

Kush accidentally didn't see that you are using Whirlpool.
so he thinks you are using udb_hash.

Sorry, but its INI_WriteString.


Re: Password saves "0" - Guitar - 08.09.2012

Okay, so now we're back to the problem of the log-in, where every player can just put any password to log-in lol.


Re: Password saves "0" - Kush - 08.09.2012

If you're using Whirlpool write it as a string. If you're using Adler32 (udb_hash) use WriteInt (which would've been the solution from the start).

As for your current situation, do it on a test script.


Re: Password saves "0" - Guitar - 08.09.2012

Quote:
Originally Posted by Kush
View Post
If you're using Whirlpool write it as a string. If you're using Adler32 (udb_hash) use WriteInt (which would've been the solution from the start).

As for your current situation, do it on a test script.
It does save the password, but I can just write anything in the log-in dialog and it logs me in, so I am afraid that it doesn't read the password :S


Re: Password saves "0" - Kush - 08.09.2012

Quote:
Originally Posted by Guitar
View Post
It does save the password, but I can just write anything in the log-in dialog and it logs me in, so I am afraid that it doesn't read the password :S
Then there are one of 2 things are occuring;

1. You aren't loading the information when the person connects. (which I believe is the problem). Use INI_ParseFile before any other statement in OnPlayerConnect if the file/user does exist.

2. You aren't checking if the password entered equals the hashed password.

Use examples from my tutorial to check where you've went wrong.


Re: Password saves "0" - Guitar - 08.09.2012

About the first case, in OnPlayerConnect I've got this

pawn Code:
if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
I believe it is working well.

On the second case, I think this is the problem, I think that I am checking the password wrongly, can you please check it? Here is the script:

pawn Code:
case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                new buf[145];
                if(WP_Hash(buf, sizeof(buf), inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }



Re: Password saves "0" - JaKe Elite - 08.09.2012

You are using it wrong once again.

it must be like this remove this line

pawn Code:
if(WP_Hash(buf, sizeof(buf), inputtext) == PlayerInfo[playerid][pPass])
replace it with this

pawn Code:
WP_Hash(buf, sizeof(buf), inputtext);
if(!strcmp(PlayerInfo[playerid][pPass], buf, true))
{
//your code
}
else
{
//your code
}



Re: Password saves "0" - Guitar - 08.09.2012

The problem is still there. I can type in any password and just log-in ..


Re: Password saves "0" - Glint - 08.09.2012

I sent you a PM check it.