SA-MP Forums Archive
Login fail - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Login fail (/showthread.php?tid=267002)



Login fail - HydraX - 06.07.2011

Hey guys, I need your help.

pawn Код:
if(dialogid == 1) //login dialog
    {
        if(response)
        {
            new pName[MAX_PLAYER_NAME];GetPlayerName(playerid, pName, sizeof(pName));
            new file[96];format(file,sizeof file,"/User_Database/%s.ini",pName);
            INI_ParseFile(file, "GetData", .bExtra = true, .extra =playerid);
            SendClientMessage(playerid, COLOR_GREEN,"You have succesfully logged in !");
            if (strcmp(inputtext, PlayerInfo[playerid][password]))
            {
                new string[128];
                if (attempt[playerid] <3)
                {
                    attempt[playerid]++;
                    PlayerPlaySound(playerid,1057,0,0,0);
                    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Account", "Your accountname is registered! \nPlease fill in your password here:", "Login", "Quit");
                    printf("%s has failed to login", pName);
                    format(string,sizeof string,"Invalid password! [%i/3]",attempt[playerid]);
                    SendClientMessage(playerid, 0xFF3200FF, string);
                    attempt[playerid] = attempt[playerid]++;
                } else {
                    GetPlayerName(playerid,pName,8);
                    format(string,sizeof string,"%s(%i) Has been kicked by the server(Failed to login).",pName,playerid);
                    SendClientMessageToAll(COLOR_GRAY,string);
                    Kick(playerid);
                }
            }
        } else Kick(playerid);
    }
When I login with ANY password other than the one I used. I still am able to login. Can anyone find the error?


Re: Login fail - iTzZh - 06.07.2011

Change
Код:
if (strcmp(inputtext, PlayerInfo[playerid][password]))
to
Код:
if (!strcmp(inputtext, PlayerInfo[playerid][password]))
Let me know if it works after that.


Re: Login fail - HydraX - 07.07.2011

No, It didn't.
Like for example, if you register, your password is 123456, your fine, however, when you login the next time you join, it request you for a password, but instead of typing 123456, I can type 123 or sfdnsjlkfnvdafks and I still can login.


Re: Login fail - Basicz - 07.07.2011

I got the same problem before, but after I change this code it got to be working...
Change
pawn Код:
if (strcmp(inputtext, PlayerInfo[playerid][password]))
To
pawn Код:
if ( !strcmp( inputtext, PlayerInfo[ playerid ][ password ], false ) )
Hope it helps ..


Re: Login fail - HydraX - 07.07.2011

Thanks, but I found a better, simpler way.