Chat thing.
#1

I would like to make a text filter system.
example:
if somebody writes it: hi all !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
transforms this into a format like this: hi all !
Reply
#2

strfind.
Reply
#3

and how?
Reply
#4

https://sampwiki.blast.hk/wiki/Scripting...ns_Old#strfind
Reply
#5

Im not ask what is it.
Im ask HOW i create it.
Reply
#6

Quote:
Originally Posted by Davee.
Im not ask what is it.
Im ask HOW i create it.
Please don't delete what your post has, some other people might search for something similar and then make new posts about it.
Reply
#7

If you still need it, this is what I just did and tested:
pawn Код:
stock RemoveRepeatedChars(text[], max_rep_chars = 2)
{
    new
      ch,
      pos,
      count = 1,
      len = strlen(text);
    while (pos < len)
    {
        if (text[pos] == ch)
        {
          count++;
          if (count == max_rep_chars+1)
          {
            new
              pos2 = pos;
                while (++pos2 < len && text[pos2] == ch) {}
                count = pos2-pos;
                strdel(text, pos, pos2);
                len -= pos2-pos;
            count = 1;
          }
          else
            {
                pos++;
            }
        }
        else
        {
          ch = text[pos];
            count = 1;
            pos++;
        }
    }
}
max_rep_chars is how many times people can write same chars in a row, I think 2 is enough.
And please rename topic back
Reply
#8

Thank you ZeeX
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)