CheckPassword Help
#1

Код:
if(CheckPassword(playerid, inputtext)) <<<<<<<<<< my problem ****** gave me 0 answers to my problem how to define this????
pawn Код:
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(CheckPassword(playerid, inputtext))
            {
                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
#2

bumb help plz
Reply
#3

You don't need to define it.
You can either use Whirlpool hasing or udb_checklogin method.

Here's
pawn Код:
//udb checklogin by Dracoblue.

stock udb_hash(buf[]) {
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}
Now using it.

pawn Код:
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(udb_hash(inputtext) == Linfo[playerid][Password]) //Replace Linfo[playerid][Password] it with your password saving.
            {
                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
#4

not like im trying to create a password door
Reply
#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
#6

inputtext is not an integer.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)