General > Developers Corner

Admin sounds, tools and other code chat.

<< < (13/31) > >>

JamminR:
Well, string.Replace(text:lower(), " ","") is replacing all your spaces with nothing, making it all run together.
Perhaps find a way to add a space after and before each censored word was found.
Formatting would stilll be off, but would be better than no space.

jay209015:
Is there a way to just test the for the words while is lowercased and with the spaces removed, then return back to normal, but with the censor in place?

JamminR:
Well, no easy way.
If all they were typing was w o r d 1 w o r d 2 w o r d 1 ... after converting to lower/removed spaces, you could replace with ~**** .. then replace ~ with " "
But. That wouldn't make up for when someone went w o r d 1 a n d I t h i n k i t s w o r d 2
" **** andIthinkits **** "
Here, trying to watch for censor avoidance with people using spaces, you start getting really complicated.
You also start chewing into resources.



jay209015:
Ok, I guess I'll stop with any further developement of this script, and start working on something new :D

Chironex:

--- Quote from: jay209015 on April 13, 2008, 06:14:02 PM ---Nice catch there, thank you.

==EDIT==

Code with the change, but still doesn't work.


--- Code: ---function WFilter( ply, text, toall )
TextD = { "word1", "word2" }
TextC = text.Explode(" ")
for _, v in pairs ( TextC )
    if TextD[v:lower()] then
        text:Replace( v, string.rep( "*", v:len() ) )
    end
end
return text
hook.Add( "PlayerSay", "WFilter", WFilter )
--- End code ---

--- End quote ---

N00b, you copied my error :) i forgot the 'do' after the for, which i fixed some minutes after..that's probably why it didn't worked..well i don't see anything else.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version