Whats Wrong ?
#6

Quote:
Originally Posted by Joe_
Посмотреть сообщение
Something like this, try not to get into a habbit of using strlen for simple things like this !

pawn Код:
if(dialogid == 2)
    {
        new
            name[MAX_PLAYER_NAME], file[50], tmp[50];

        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);

        if(!response) return Kick(playerid);

        // Your previous example used strlen, which loops around every character in the string until it finds the '\0' escape character
        // To check if there's no input, simply check if the first character is not a valid character, thus it must be '\0'.
        // This is much quicker than checking all characters, when you only want to check if there is a character, if there is text, the first character will not be '\0'.

        if(!inputtext) return ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Your registered!","Welcome back :P\nPlease sign-in below:","Login","Cancel");

        format(tmp, sizeof(tmp), "%s", dini_Get(file, "Password"));
        format(PlayerInfo[playerid][Password], 50, "%s", tmp);

        if(udb_hash(inputtext) != PlayerInfo[playerid][Password])
        {
            SendClientMessage(playerid,RED,"Sorry Wrong Password!");
            ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Your registered!","Welcome back :P\nPlease sign-in below:","Login","Cancel");
            return 1;
        }
       
        OnLogin(playerid, inputtext);
        return 1;
    }
   
    // Other dialogs
    return 0;
}
Not getting right pass "Sorry Wrong Password!".......
Reply


Messages In This Thread
Whats Wrong ? - by iRana - 06.12.2010, 10:32
Re: Whats Wrong ? - by leong124 - 06.12.2010, 10:57
Re: Whats Wrong ? - by Lenny the Cup - 06.12.2010, 12:22
Re: Whats Wrong ? - by Joe_ - 06.12.2010, 13:35
Re: Whats Wrong ? - by iRana - 06.12.2010, 15:39
Re: Whats Wrong ? - by iRana - 07.12.2010, 09:34
Re: Whats Wrong ? - by iRana - 07.12.2010, 10:05

Forum Jump:


Users browsing this thread: 2 Guest(s)