Chat thing. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Chat thing. (
/showthread.php?tid=95882)
Chat thing. -
-Davee- - 05.09.2009
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 !
Re: Chat thing. -
Karlip - 05.09.2009
strfind.
Re: Chat thing. -
-Davee- - 05.09.2009
and how?
Re: Chat thing. -
Clavius - 05.09.2009
https://sampwiki.blast.hk/wiki/Scripting...ns_Old#strfind
Re: Chat thing. -
-Davee- - 05.09.2009
Im not ask what is it.
Im ask HOW i create it.
Re: Chat thing. -
Karlip - 05.09.2009
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.
Re: - - Zeex - 05.09.2009
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
Re: Chat thing. -
-Davee- - 05.09.2009
Thank you ZeeX