CheckPassword Help
#5

pawn Код:
new doorpass = 1234; //Creating a password variable for the door.

ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Please enter your password:", "Login", "Cancel");
 
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_LOGIN)
    {
        if(!response) // If they clicked 'Cancel' or pressed esc
        {
            SendClientMessage(playerid, COLOR_RED, "You MUST login to play here. Please change your name.");
            Kick(playerid);
        }
        else // Pressed ENTER or clicked 'Login' button
        {
            if(inputtext == doorpass) //Detecting whether the entered text is the password of door or not.
            { //If yes, ...
                SendClientMessage(playerid, COLOR_RED, "You are now logged in!");
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "LOGIN FAILED.");
 
                // Re-show the login dialog
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Please enter your password:", "Login", "Cancel");
            }
        }
        return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
    }
 
    return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
Reply


Messages In This Thread
CheckPassword Help - by trapstar2020 - 24.09.2012, 22:55
Re: CheckPassword Help - by trapstar2020 - 25.09.2012, 02:53
Re: CheckPassword Help - by Lordzy - 25.09.2012, 03:21
Re: CheckPassword Help - by trapstar2020 - 25.09.2012, 03:24
Re: CheckPassword Help - by Lordzy - 25.09.2012, 03:35
Re: CheckPassword Help - by YourLord - 25.09.2012, 05:17

Forum Jump:


Users browsing this thread: 1 Guest(s)