Password saves "0"
#21

@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 ..
Reply
#22

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

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.
Reply
#24

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.
Reply
#25

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.
Reply
#26

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
Reply
#27

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.
Reply
#28

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;
            }
        }
Reply
#29

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
}
Reply
#30

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

I sent you a PM check it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)