Filter String for Textdraws
#1

Hello, I made a function to filter out characters like [ ] * to avoid stars or other wierd things inside a textdraw string.
pawn Код:
stock CompareStringForTextdraw(text[])
{
    new strpos;
    new invalidstr[3][2] = {
    "[","]","*"};
    for (new s=0; s<strlen(text); s++)
    {
        for (new x=0; x<sizeof(invalidstr); x++)
        {
            strpos = strfind(text, invalidstr[x], true);
            if(strpos != -1)
            {
                strdel(text, strpos, strpos+1);
            }
        }
    }
    return text;
}
Now this what I got, but it doesn't work I get only wierd characters out of it.
Maybe somebody sees the fault? because i don't lol.
Reply
#2

Try this:
pawn Код:
stock CompareStringForTextdraw(text[])
{
    new
        strpos,
        invalidstr[3][2] = { "[", "]", "*" }
    ;        
    for (new x=0; x<sizeof(invalidstr); x++)
    {
        strpos = strfind(text, invalidstr[x], true);
        if(strpos != -1)
        {
            strdel(text, strpos, strpos+1);
        }
    }
    return text;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)