Password Length
#1

Hello, how to make that the password must be between 5 and 32 characters?

Код:
   if(response)
            {
		if(!strlen(inputtext) || strlen(inputtext) > 32)
            }

	     else if(strlen(inputtext) > 0 && strlen(inputtext) < 32)
             {
Reply
#2

pawn Код:
if(strlen(inputtext) < 5)
            {
//Code
            return 1;
            }
            if(strlen(inputtext) > 32)
            {
//Code
            return 1;
            }
Reply
#3

I dont think that this will work.
Reply
#4

Give it a try,
Example;

pawn Код:
if(strlen(inputtext) < 5)
            {
                ShowPlayerDialog(playerid, Your_Dialog, DIALOG_STYLE_INPUT, "Register", "The password must be more than 5 characters.", "Register", "Cancel");
                return 1;
            }
            if(strlen(inputtext) > 32)
            {
                ShowPlayerDialog(playerid, Your_Dialog, DIALOG_STYLE_INPUT, "Register", "The password is too long.", "Register", "Cancel");
                return 1;
            }
Reply
#5

if(strlen(inputtext) < 5 || strlen(inputtext) > 32)
Reply
#6

if(response)
{
if(strlen(inputtext) < 5 || strlen(inputtext) > 32) //error
return 1;
}

else if(strlen(inputtext) > 4 && strlen(inputtext) < 33) //accepted
return 1;
{
Reply
#7

Quote:
Originally Posted by Thewin
Посмотреть сообщение
if(response)
{
if(strlen(inputtext) < 5 || strlen(inputtext) > 32) //error
return 1;
}

else if(strlen(inputtext) > 4 && strlen(inputtext) < 33) //accepted
return 1;
{
or just else..
Reply
#8

pawn Код:
if(5 > strlen(inputtext) > 32)
{
    // password not between 5-32 characters
}
Reply
#9

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
pawn Код:
if(5 > strlen(inputtext) > 32)
{
    // password not between 5-32 characters
}
That will not work. It should be:
pawn Код:
if (!(5 <= strlen(inputtext) <= 32))
{
    // password not between 5-32 characters
}
Reply
#10

pawn Код:
if(strlen(inputtext) < 5 || strlen(inputtext) > 32)
{
  //Code
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)