Password Lengh
#1

Hello, how to make an password lengh that you must type minimal 1 letter as password? Give me an short example or something like that, please.
Reply
#2

PHP код:
if(strlen(inputtext) <= )
        {
        
//Do Something
        

Put this under Your Register Dialog
Reply
#3

Quote:
Originally Posted by nor15
Посмотреть сообщение
PHP код:
if(strlen(inputtext) <= )
        {
        
//Do Something
        

Put this under Your Register Dialog
Are you aware of what you're writing here ? this code just checks if the input text length is less or equal to 1, but the guy was asking how to check if the password length is bigger than 1 !

pawn Код:
if(strlen(inputtext) >= 1)
{
    // Code
}
EDIT: Actually after reading ur post again, i got confused, do u want to check if the password length is bigger than 1 or if the password contains at leat 1 letter ?
Reply
#4

Quote:
Originally Posted by OrMisicL
Посмотреть сообщение
Are you aware of what you're writing here ? this code just checks if the input text length is less or equal to 1, but the guy was asking how to check if the password length is bigger than 1 !

pawn Код:
if(strlen(inputtext) >= 1)
{
    // Code
}
What about if the arguments aren't met? What are you going to do then? You haven't provided an else in that block.
Reply
#5

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
What about if the arguments aren't met? What are you going to do then? You haven't provided an else in that block.
Thats up to him, what he wants to do if the arguments arent met is not part of what he asked, so i didnt provided it in the answer
Reply
#6

I want it too when the arguments arent met, and i want that you must type MINIMUM 1 letter in the register dialog, to register an account.
Reply
#7

pawn Код:
stock IsLetter(c)
{
    return ((c >= 65 && c <= 91) || (c >= 97 && c <= 123)) ? true : false;
}

// Under on OnDialogResponse
new bool:valid = false;
for(new i = 0; i < strlen(inputtext); i++)
{
    if(IsLetter(inputtext[i]))
    {
        valid = true;
        break;
    }
}
if(valid)
{
    // Success code
}
else
{
    SendClientMessage(playerid, COLOR, "Your password must contain at least one character");
}
Reply
#8

~fixed~
Reply
#9

PHP код:
if(strlen(inputtext) < 1) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT,"Register","{80999B}You have entered an invalid password.\nYour password must contain more than one characters.\nType your password below to register a new account.","Register","Quit"); 
Reply
#10

nevermind, i fixed it myself, but thanks to all for the ideas etc.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)