SA-MP Forums Archive
Password Lengh - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Password Lengh (/showthread.php?tid=451379)



Password Lengh - Blackazur - 16.07.2013

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.


Re: Password Lengh - nor15 - 16.07.2013

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

Put this under Your Register Dialog


Re: Password Lengh - OrMisicL - 16.07.2013

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 ?


Re: Password Lengh - Scenario - 16.07.2013

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.


Re: Password Lengh - OrMisicL - 16.07.2013

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


AW: Password Lengh - Blackazur - 16.07.2013

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.


Re: Password Lengh - OrMisicL - 16.07.2013

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");
}



AW: Password Lengh - Blackazur - 16.07.2013

~fixed~


Re: Password Lengh - ThePhenix - 16.07.2013

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"); 



AW: Password Lengh - Blackazur - 16.07.2013

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