SA-MP Forums Archive
problem with ondialogresponse and inputtext with password... - 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: problem with ondialogresponse and inputtext with password... (/showthread.php?tid=400661)



problem with ondialogresponse and inputtext with password... - niels44 - 19.12.2012

hey guys,

i was making this:
pawn Код:
if(dialogid == DIALOG_NIELSPASSWORD)
    {
        if(response)
        {
            if(strcmp(inputtext, "chilltime"))
            {
                CallElevator(playerid, 19);
            }
            else return ShowPlayerDialog(playerid, DIALOG_NIELSPASSWORD, DIALOG_STYLE_PASSWORD, "Please enter the Password", "This Floor belongs to Niels and requires a password\nYou entered the wrong Password!\nPlease try again or press Cancel", "Enter", "Cancel");
        }
        else if(!response)
        {
            ShowElevatorDialog(playerid);
        }
        return 1;
    }
but now when i go to the elevator, select the right floor, it DOES gives me the dialog for the password, but i can enter ANYTHING, everything you enter works, like when i type asdasdwafasf, then it say accepted and it works, but it only should work for the password "chilltime" and nothing else...

anyone sees wut i do wrong here?

greets niels


Re: problem with ondialogresponse and inputtext with password... - [KHK]Khalid - 19.12.2012

You need this:

pawn Код:
if(strcmp(inputtext, "chilltime") == 0)
because Strcmp returns ZERO when the strings are the same.

Also you may want to use the 3rd parameter of Strcmp which is ignorecase as it's a password dialog box. For more info about Strcmp: https://sampwiki.blast.hk/wiki/Strcmp.