sscanf checking string help
#3

pawn Код:
stock isValidName(const sz_Name[])
{
    new
        lenght = strlen(sz_Name);
           
    if (!lenght) return 0;
   
    new
        us_count;
   
    for (new i; i != lenght; ++i)
    {
        if (sz_Name[i] == '_') ++us_count;
    }
   
    return (us_count == 1 && sz_Name[0] != '_' && sz_Name[lenght - 1] != '_');
}
You can use it:
pawn Код:
if (!isValidName(inputtext))
{
    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ť");
}
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: 2 Guest(s)