sscanf checking string help
#2

Hm, I still got one problem.. When I type to inputtext as first character the underscore (_) it will detect him.. But when I type after underscore some text (string) like _world it will still detect it as correct.. Adding code

pawn Код:
case 7:
        {
            if (response)
            {
                if(sscanf(inputtext, "{p<_>s[9]s[9]}"))
                {
                    new TEXT[MAX_PLAYER_NAME], underscorecount;
                    format (TEXT, sizeof (TEXT), "%s", inputtext);
                    for (new i; i < MAX_PLAYER_NAME; i++)
                    {
                     if (TEXT[i] == '_')
                         underscorecount++;
                    }

                    if (underscorecount > 1)
                    {
                        SendClientMessage (playerid, -1, "two underscores found!");
                    }
                   
                    if (TEXT[0] == '_')
                    {
                        SendClientMessage(playerid, -1, "underscore is located in first place in inputtext!");
                        return ShowPlayerDialog (playerid, 3, DIALOG_STYLE_LIST, "Sprбvca postбv", "Načнtavanie postбv\nVytvorenie postбv\nVymazanie Postбv", "Potvrdiť", "Zruљiť");
                    }

                    SendClientMessage(playerid, -1, "You have entered bad format of name!");
                    return ShowPlayerDialog (playerid, 3, DIALOG_STYLE_LIST, "Sprбvca postбv", "Načнtavanie postбv\nVytvorenie postбv\nVymazanie Postбv", "Potvrdiť", "Zruљiť");
                }
                else
                {
                    SendClientMessage(playerid, -1, "Correct format");
                    ShowPlayerDialog (playerid, 3, DIALOG_STYLE_LIST, "Sprбvca postбv", "Načнtavanie postбv\nVytvorenie postбv\nVymazanie Postбv", "Potvrdiť", "Zruљiť");
                }
            }
Dont worry about dialog lang I translated messages / other stuff..
Reply


Messages In This Thread
sscanf checking string help - by Riwerry - 28.01.2014, 12:20
Re: sscanf checking string help - by Riwerry - 28.01.2014, 15:49
Re: sscanf checking string help - by Konstantinos - 28.01.2014, 16:06

Forum Jump:


Users browsing this thread: 1 Guest(s)