General > Developers Corner
This thread's OP is a lua n00b
Storm:
um. Okay I will try...
MrPresident:
If you don't understand, post what you are using and someone can help you out.
Storm:
I am using Eccid's code from yesterday posted right above on this page.
Decicus:
This should work (the change is inside "string.find", btw).
--- Code: ---KickWords = KickWords or {}
KickWords.words = {
"lolipop",
"damndude",
"corecheng",
"prinnies"
}
KickWords.admins = false --Kick Admins?
KickWords.sadmins = false --Kick Superadmins?
KickWords.censor = true --Censor words?
hook.Add( "PlayerSay", "Meanie Head", function(ply, text)
local oldtext = text --Remember what they said, for admins sake
for a,b in pairs(KickWords.words) do
if string.find(string.lower(text), b, 1, true) then --Is a word being used?
if KickWords.censor then text = "I said a bad word...." end --What to print if censored.
if (ply:IsAdmin() and not KickWords.admins) or (ply:IsSuperAdmin() and not KickWords.sadmins) then return text end--Tie it all into one line
RunConsoleCommand("ulx", "kick", ply:Nick(), "You Meanie!") --If yes, kick them
ulx.fancyLogAdmin( ply, true, "#A was kicked for saying the following: #s", oldtext or text) --Tell admins they were kicked and what they said.
return text --Return nothing so everyone can't read what was said.
end
end
--- End code ---
Storm:
Works great! Thanks so much!
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version