Dialog Inputtext
#1

Hello, I need help, you need to make so that inputtext contained in the dialogue and the letters and numbers alphabet if inputtext sodrzhit only numbers or letters but not only numbers and letters that I get an error SendClientMessage (playerid, -1, "Your password must contain numbers and letters ");
Reply
#2

Put this at the bottom of your script
pawn Код:
stock IsValidPassword(const password[])
{
    for(new i = 0; password[i] != EOS; ++i)
    {
        switch(password[i])
        {
            case '0'..'9', 'A'..'Z', 'a'..'z': continue;
            default: return 0;
        }
    }
    return 1;
}
Put this under your register dialog (under your if(response) of u have one):
pawn Код:
if(!IsValidPassword(inputtext))
            {
                SendClientMessage(playerid, -1, ""COL_RED"The password is invalid, Valid characters are: A-Z, a-z, 0-9");
                ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, ""COL_BLUE"SGZM"COL_WHITE" Register pannel", "Please register to play on "COL_BLUE"Survival Games Zombie Mode\n"COL_WHITE"Enter a "COL_BLUE"password"COL_WHITE":", "Register", "Exit");
                return 1;
            }
            if(strlen(inputtext) < 3 || strlen(inputtext) > 24)
            {
                SendClientMessage(playerid, -1, ""COL_RED"The password is invalid, Its lenght should be 3-24 characters");
                ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, ""COL_BLUE"SGZM"COL_WHITE" Register pannel", "Please register to play on "COL_BLUE"Survival Games Zombie Mode\n"COL_WHITE"Enter a "COL_BLUE"password"COL_WHITE":", "Register", "Exit");
                return 1;
            }
You will need to change the color defines to yours.
goodluck!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)