Dialog problems
#1

Well, i'm having a problem figuring out how to compare the text from inputtext (dialogs) to a file - It should work, but yet, it doesn't.

pawn Код:
case LOGIN_DIALOG:
        {
            if(response)
            {
                if(strlen(inputtext) <= 32)
                {
                    if(strcmp(SInfo[playerid][Password], inputtext, true)) //This is the problem.
                    {
                        OnPlayerLogin(playerid, inputtext);
                    }
                    else return ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_INPUT, "Welcome back!", "You appear to have an account on this server!\nPlease login by typing in your password below:", "Submit", "Quit");
                }
                else
                {
                    ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_INPUT, "Welcome back!", "You appear to have an account on this server!\nPlease login by typing in your password below:", "Submit", "Quit");
                }
            }
            else return Kick(playerid);
        }
Any idea what's wrong here?
Reply
#2

pawn Код:
if(!strcmp(SInfo[playerid][Password], inputtext, true)) return OnPlayerLogin(playerid, inputtext);
That will check if the string is same it will return "OnPlayerLogin"
Reply
#3

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
pawn Код:
if(!strcmp(SInfo[playerid][Password], inputtext, true)) return OnPlayerLogin(playerid, inputtext);
That will check if the string is same it will return "OnPlayerLogin"
Still not working.

Quote:

[22:34:07]
Entered Password: sd
Actual Password: lolol1

And then I get the message, "You have been logged into Sky's Local Fun Zone."

Here's the code:

pawn Код:
case LOGIN_DIALOG:
        {
            if(response)
            {
                if(strlen(inputtext) <= 32)
                {
                    if(!strcmp(SInfo[playerid][Password], inputtext, true))
                        return OnPlayerLogin(playerid, inputtext);

                    else return ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_INPUT, "Welcome back!", "You appear to have an account on this server!\nPlease login by typing in your password below:", "Submit", "Quit");
                }
                else
                {
                    ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_INPUT, "Welcome back!", "You appear to have an account on this server!\nPlease login by typing in your password below:", "Submit", "Quit");
                }
            }
            else return Kick(playerid);
        }
Reply
#4

pawn Код:
case LOGIN_DIALOG:
{
    if(response)////This line will called if player press button number 0
    {
        if(!strcmp(SInfo[playerid][Password], inputtext, true)) return OnPlayerLogin(playerid, inputtext);
        else return //This line will called if player put the wrong apssword
    }
    else //This line will called if player press button number 1
    return 0;
}
Reply
#5

pawn Код:
case LOGIN_DIALOG:
        {
            if(response)
            {
                if(!strcmp(SInfo[playerid][Password], inputtext, true)) return OnPlayerLogin(playerid, inputtext);
                    else return ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_INPUT, "Welcome back!", "You appear to have an account on this server!\nPlease login by typing in your password below:", "Submit", "Quit");
            }
            else Kick(playerid);
            return 0;
        }
Copy-pasted it exactly, and still, not working.. it logs me in perfectly fine.
Reply
#6

I just wonder why you put "LOGIN_DIALOG" instead the dialogid?
Reply
#7

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
I just wonder why you put "LOGIN_DIALOG" instead the dialogid?
I have it defined at the top of my script.

pawn Код:
#define     LOGIN_DIALOG        2
But, this has nothing to do with my problem.


EDIT: Fixed.

pawn Код:
case LOGIN_DIALOG:
        {
            if(response)
            {
                new
                    uFile[35],
                    player_Name[MAX_PLAYER_NAME];

                GetPlayerName(playerid, player_Name, sizeof(player_Name));
                format(uFile, 35, USER_DIRECTORY, player_Name);

                INI_ParseFile(uFile, "LoadUserData", .bExtra = true, .extra = playerid);
               
                if(strcmp(inputtext, SInfo[playerid][Password], true) == 0) return OnPlayerLogin(playerid, inputtext);
                    else return ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_INPUT, "Welcome back!", "You appear to have an account on this server!\nPlease login by typing in your password below:", "Submit", "Quit");
            }
            else Kick(playerid);
            return 0;
        }
Reply
#8

Well that's not a problem as long as it's not interupted by another dialog with same ID.
Check if you have a different dialog with same ID and check if your OnDialogResponse is called (I guess you already did).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)