SA-MP Forums Archive
Dialog Response Problem. - 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: Dialog Response Problem. (/showthread.php?tid=401672)



Dialog Response Problem. - Biess - 23.12.2012

pawn Код:
case DIALOG_LOGIN: {
            if ( !response ) return Kick ( playerid );
            if( response ) {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register Below","Wrong Password!\nEnter Password To Play!","Register","Quit");
                //if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                //if(strlen(PInfo[playerid][Password])) {
                new file[64], PlayerName[24];
                GetPlayerName(playerid,PlayerName,sizeof PlayerName);
                format(file,sizeof file,"Admin/%s.ini",PlayerName);
                if(strlen(inputtext[PInfo[playerid][Password]])) {
                    INI_Open(file);//Opening the file with SII include
                    INI_ReadString(inputtext[PInfo[playerid][Password]],"Password");
                    PInfo[playerid][Registered] = INI_ReadInt("Registered");
                    PInfo[playerid][Level] = INI_ReadInt("Level");//Setting the admin level variable, to the one thats in his file.
                    PInfo[playerid][Score] = INI_ReadInt("Score"); // Setting the score of player
                    PInfo[playerid][Money] = INI_ReadInt("Money"); // Setting the money of player
                    PInfo[playerid][Operator] = INI_ReadInt("Operator");
                    INI_Close();//"Closing the file", that means that we're not using it anymore :P
                    SendClientMessage(playerid,-1,"You have been successfully logged in!");
                    PInfo[playerid][Logged] = 1;//Setting the logged in variable to 1
                    SetPlayerScore(playerid, PInfo[playerid][Score]);
                    GivePlayerMoney(playerid, PInfo[playerid][Money]);
                } else {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
There is a problem with that, i can login with ANY password like my password is "example" i can login with
ajfhnagjhgal. does someone know the issue?


Re: Dialog Response Problem. - Randy More - 23.12.2012

Replace

pawn Код:
if(strlen(inputtext[PInfo[playerid][Password]])) {
with

pawn Код:
if(!strcmp(inputtext, PInfo[playerid][Password], true)) {



Re: Dialog Response Problem. - Biess - 23.12.2012

doesn't work


Re: Dialog Response Problem. - tyler12 - 23.12.2012

Change
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
to
if(!strcmp(inputtext, PlayerInfo[playerid][pPass])) {


Re: Dialog Response Problem. - Biess - 23.12.2012

Quote:
Originally Posted by tyler12
Посмотреть сообщение
Change
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
to
if(!strcmp(inputtext, PlayerInfo[playerid][pPass])) {
First of all we don't use that HASH. And it just doesn't work either can still login with random pass.


Re: Dialog Response Problem. - tyler12 - 23.12.2012

INI_ReadString(inputtext[PInfo[playerid][Password]],"Password");

You are reading the password after checking it.


Re: Dialog Response Problem. - Biess - 23.12.2012

I did this
pawn Код:
case DIALOG_LOGIN: {
            if ( !response ) return Kick (playerid);
            if( response ) {
                //if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                //if(strlen(PInfo[playerid][Password])) {
                new file[64], PlayerName[24], rank[24];
                GetPlayerName(playerid,PlayerName,sizeof PlayerName);
                format(file,sizeof file,"Admin/%s.ini",PlayerName);
                INI_Open(file);//Opening the file with SII include
                INI_ReadString(inputtext[PInfo[playerid][Password]],"Password");
                if(!strcmp(inputtext, PInfo[playerid][Password])) {
                    PInfo[playerid][Rank] = INI_ReadInt("Rank");
                    PInfo[playerid][Level] = INI_ReadInt("Level");//Setting the admin level variable, to the one thats in his file.
                    PInfo[playerid][Operator] = INI_ReadInt("Operator");
                    PInfo[playerid][Kills] = INI_ReadInt("Kills");
                    PInfo[playerid][Deaths] = INI_ReadInt("Deaths");
                    PInfo[playerid][Score] = INI_ReadInt("Score"); // Setting the score of player
                    PInfo[playerid][Money] = INI_ReadInt("Money"); // Setting the money of player
                    INI_Close();//"Closing the file", that means that we're not using it anymore :P
                    SendClientMessage(playerid,-1,"You have been successfully logged in!");
                    SendClientMessage(playerid, -1, rank);
                    PInfo[playerid][Logged] = 1;//Setting the logged in variable to 1
                    SetPlayerScore(playerid, PInfo[playerid][Score]);
                    GivePlayerMoney(playerid, PInfo[playerid][Money]);
                } else {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
But still doesn't work.


Re: Dialog Response Problem. - Biess - 24.12.2012

Anyone?