Dialog Response
#1

pawn Код:
if(dialogid == 262)
    {
        if(response)
        {
                for(new i = 0; i < strlen(inputtext); i++)
                {
                    if(!IsALetter(inputtext[i]))
                    {
                        //SendClientMessage(playerid, COLOR_LIGHTRED, "You can only use letters!"); return 1;
                        format(string, sizeof(string),"{DC0C0C}You cannot use invalid characters in your Accent!\n{F9F7CE}Click 'OK' to continue.");
                        ShowPlayerDialog(playerid, 264, DIALOG_STYLE_MSGBOX,"{DC0C0C}SU Gaming Accent", string,"OK", "");
                    }
                }
                if(strlen(inputtext) < 3 || strlen(inputtext) > 15))
                {
                    format(string, sizeof(string),"{DC0C0C}The accent cannot be less than 3 characters or longer than 15 characters.\n{F9F7CE}Click 'OK' to continue.");
                    ShowPlayerDialog(playerid, 264, DIALOG_STYLE_MSGBOX,"{DC0C0C}SU Gaming Accent", string,"OK", "");
                }
                if(strmatch(inputtext, "None"))
                {
                    strmid(PlayerInfo[playerid][pAccent], inputtext, 0, strlen(inputtext), 999);
                    Update(playerid, pAccent);
                    format(string, sizeof(string),"{DC0C0C}You have removed your accent.\n{F9F7CE}Click 'OK' to continue.",inputtext);
                    ShowPlayerDialog(playerid, 263, DIALOG_STYLE_MSGBOX,"{DC0C0C}SU Gaming Accent", string,"OK", "");
                    new query[120];
                    format(query, sizeof(query), "UPDATE players SET Accent = '%s' WHERE username = '%s'", inputtext, PlayerName(playerid));
                    mysql_function_query(g_Handle, query, false, "SendQuery", "");
                }
                else
                {
                    strmid(PlayerInfo[playerid][pAccent], inputtext, 0, strlen(inputtext), 999);
                    Update(playerid, pAccent);
                    format(string, sizeof(string),"{DC0C0C}Your new accent is {F9F7CE}%s.\nClick 'OK' to continue.",inputtext);
                    ShowPlayerDialog(playerid, 263, DIALOG_STYLE_MSGBOX,"{DC0C0C}SU Gaming Accent", string,"OK", "");
                    new query[120];
                    format(query, sizeof(query), "UPDATE players SET Accent = '%s' WHERE username = '%s'", inputtext, PlayerName(playerid));
                    mysql_function_query(g_Handle, query, false, "SendQuery", "");
                }
        }
    }
I'm trying to make this not accept any symbols or numbers. Only letters as well as not be any shorter than 3 or longer than 15 characters.
Yet, it's throwing me errors on the length and it's still allowing invalid characters
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)