Comparing password [MySQL Threaded queries]
#1

Fixed.
https://sampforum.blast.hk/showthread.php?tid=419858

pawn Code:
public CheckAccount(playerid)
{
    if(IsPlayerConnected(playerid))
    {

        new rows, fields;
        cache_get_data(rows, fields, conhandle);

        if(rows)
        {
            new temp[33];
            cache_get_row(0, 0, temp, conhandle), PlayerInfo[playerid][SQLid] = strval(temp);
            cache_get_row(0, 1, PlayerInfo[playerid][Pass], conhandle);
            cache_get_row(0, 2, temp, conhandle), PlayerInfo[playerid][Banned] = strval(temp);
            cache_get_row(0, 3, temp, conhandle), PlayerInfo[playerid][BanTime] = strval(temp);

            if(PlayerInfo[playerid][Banned] == 1)
            {
                format(str, sizeof(str), "The account \"%s\" is banned for %i days. If this is your account please post an unban appeal in the forums", GetPnameid(playerid), PlayerInfo[playerid][BanTime]);
                KickWithMessage(playerid, str);
                return 1;
            }
           
            ShowPlayerDialog(playerid, loginid, DIALOG_STYLE_INPUT, "Login","Your username is registered! Please login with your password below!","Login","Quit");
        }

        else return ShowPlayerDialog(playerid, registerid, DIALOG_STYLE_INPUT, "Register","Your username is not registered! Please register with a password below!","Register","Quit");
    }
    return 1;
}
I am guessing something is wrong with this, because when I tried to print the password, it printed nothing.
Reply
#2

Yeah, so I still couldn't fix it so, bump.
Reply
#3

It might be that PlayerInfo[playerid][Pass] is empty if you use a MySQL plugin that's newer than R8. The script tries to do something like "sizeof(PlayerInfo[playerid][Pass])" which will not return 129 as you expect it to (read more about this on the forum, there's even one tutorial about it).

You need to add an extra parameter to that cache_get_row line. Also, for future easiness, learn how you debug. You could've become aware of the issue easily if you had just printed the two strings you're comparing prior to the strcmp call. printf is your buddy.
Reply
#4

Quote:
Originally Posted by AndreT
View Post
You need to add an extra parameter to that cache_get_row line.
Alright, found the tutorial. https://sampforum.blast.hk/showthread.php?tid=419858

Quote:
Originally Posted by AndreT
View Post
It might be that PlayerInfo[playerid][Pass] is empty if you use a MySQL plugin that's newer than R8. The script tries to do something like "sizeof(PlayerInfo[playerid][Pass])" which will not return 129 as you expect it to (read more about this on the forum, there's even one tutorial about it).
Also, for future easiness, learn how you debug. You could've become aware of the issue easily if you had just printed the two strings you're comparing prior to the strcmp call. printf is your buddy.
I already mentioned that
Quote:
Originally Posted by emokidx111
View Post
when I tried to print the password, it printed nothing.
But I was not sure, because [retard]I thought it was too long to be printed[/retard]

Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)