dukenukem Posted December 5, 2010 Share Posted December 5, 2010 Welcome to Censorship system 1.0.0 created by dukenukem Add to ACL.XML group "admin" it: You dont like vulgarity on your server? That simple script change it! -added all vulgar words from: http://www.noswearing.com/dictionary/a DOWNLOAD Link to comment
Aibo Posted December 5, 2010 Share Posted December 5, 2010 elseif (type(string.find(message,"bampot")) == "number") then and 600+ lines total. really? http://lua-users.org/wiki/TablesTutorial http://lua-users.org/wiki/ForTutorial http://lua-users.org/wiki/PatternsTutorial Link to comment
Discord Moderators Zango Posted December 5, 2010 Discord Moderators Share Posted December 5, 2010 mutha fucka is in the censorship words but mother fucker isn't. Isn't it just slang? Also, I personally consider muffdiver a compliment rather something else. Can't associate it with something bad! Link to comment
dukenukem Posted December 6, 2010 Author Share Posted December 6, 2010 elseif (type(string.find(message,"bampot")) == "number") then and 600+ lines total. really? http://lua-users.org/wiki/TablesTutorial http://lua-users.org/wiki/ForTutorial http://lua-users.org/wiki/PatternsTutorial lol i know tables, in next version i make it in .xml Link to comment
Discord Moderators Zango Posted December 6, 2010 Discord Moderators Share Posted December 6, 2010 I made a version for you (thanks to wiki for help) local censored = { 'technocrane', 'teletubbie', 'nebula' -- ... your censored words here } function Check(funcname, ...) local arg = {...} if (type(funcname) ~= "string") then error("Argument type mismatch at 'Check' ('funcname'). Expected 'string', got '"..type(funcname).."'.", 2) end if (#arg % 3 > 0) then error("Argument number mismatch at 'Check'. Expected #arg % 3 to be 0, but it is "..(#arg % 3)..".", 2) end for i=1, #arg-2, 3 do if (type(arg[i]) ~= "string" and type(arg[i]) ~= "table") then error("Argument type mismatch at 'Check' (arg #"..i.."). Expected 'string' or 'table', got '"..type(arg[i]).."'.", 2) elseif (type(arg[i+2]) ~= "string") then error("Argument type mismatch at 'Check' (arg #"..(i+2).."). Expected 'string', got '"..type(arg[i+2]).."'.", 2) end if (type(arg[i]) == "table") then local aType = type(arg[i+1]) for _, pType in next, arg[i] do if (aType == pType) then aType = nil break end end if (aType) then error("Argument type mismatch at '"..funcname.."' ('"..arg[i+2].."'). Expected '"..table.concat(arg[i], "' or '").."', got '"..aType.."'.", 3) end elseif (type(arg[i+1]) ~= arg[i]) then error("Argument type mismatch at '"..funcname.."' ('"..arg[i+2].."'). Expected '"..arg[i].."', got '"..type(arg[i+1]).."'.", 3) end end end function string.explode(self, separator) Check("string.explode", "string", self, "ensemble", "string", separator, "separator") if (#self == 0) then return {} end if (#separator == 0) then return { self } end return loadstring("return {\""..self:gsub(separator, "\",\"").."\"}")() end function string.nail (chat) local exString = string.explode (chat, ' ') for k, v in ipairs (exString) do for j, s in ipairs (censored) do if v == s then outputChatBox ('someone do something, '..tostring (getPlayerName (source))..' just said '..v..'!') -- your action here end end end end addEventHandler ('onPlayerChat', root, string.nail) the code separates all words in a chat message into a table, and matches the values in 'censored' table with any of them, using loops. this way probably isn't very good, rather use string.find to catch people saying 'goddamnit' while only having 'goddamn' listed just an example to show you this doesn't have to fill 600 lines as a suggestion, you could maybe cancelEvent onPlayerChat and outputChatBox the message with the word censored, warning the player, for a less violent way. Your current way is pretty rough Link to comment
dukenukem Posted December 6, 2010 Author Share Posted December 6, 2010 I made a version for you (thanks to wiki for help) local censored = { 'technocrane', 'teletubbie', 'nebula' -- ... your censored words here } function Check(funcname, ...) local arg = {...} if (type(funcname) ~= "string") then error("Argument type mismatch at 'Check' ('funcname'). Expected 'string', got '"..type(funcname).."'.", 2) end if (#arg % 3 > 0) then error("Argument number mismatch at 'Check'. Expected #arg % 3 to be 0, but it is "..(#arg % 3)..".", 2) end for i=1, #arg-2, 3 do if (type(arg[i]) ~= "string" and type(arg[i]) ~= "table") then error("Argument type mismatch at 'Check' (arg #"..i.."). Expected 'string' or 'table', got '"..type(arg[i]).."'.", 2) elseif (type(arg[i+2]) ~= "string") then error("Argument type mismatch at 'Check' (arg #"..(i+2).."). Expected 'string', got '"..type(arg[i+2]).."'.", 2) end if (type(arg[i]) == "table") then local aType = type(arg[i+1]) for _, pType in next, arg[i] do if (aType == pType) then aType = nil break end end if (aType) then error("Argument type mismatch at '"..funcname.."' ('"..arg[i+2].."'). Expected '"..table.concat(arg[i], "' or '").."', got '"..aType.."'.", 3) end elseif (type(arg[i+1]) ~= arg[i]) then error("Argument type mismatch at '"..funcname.."' ('"..arg[i+2].."'). Expected '"..arg[i].."', got '"..type(arg[i+1]).."'.", 3) end end end function string.explode(self, separator) Check("string.explode", "string", self, "ensemble", "string", separator, "separator") if (#self == 0) then return {} end if (#separator == 0) then return { self } end return loadstring("return {\""..self:gsub(separator, "\",\"").."\"}")() end function string.nail (chat) local exString = string.explode (chat, ' ') for k, v in ipairs (exString) do for j, s in ipairs (censored) do if v == s then outputChatBox ('someone do something, '..tostring (getPlayerName (source))..' just said '..v..'!') -- your action here end end end end addEventHandler ('onPlayerChat', root, string.nail) the code separates all words in a chat message into a table, and matches the values in 'censored' table with any of them, using loops. this way probably isn't very good, rather use string.find to catch people saying 'goddamnit' while only having 'goddamn' listed just an example to show you this doesn't have to fill 600 lines as a suggestion, you could maybe cancelEvent onPlayerChat and outputChatBox the message with the word censored, warning the player, for a less violent way. Your current way is pretty rough heh good thanks but i want too make Player say: f**k * - when you say it you dont get mute but **** censor Link to comment
Aibo Posted December 6, 2010 Share Posted December 6, 2010 heh good thanks but i want too make Player say: f**k * - when you say it you dont get mute but **** censor function wordCensor(word) local asterisk = "*" local hide = word:sub(2, #word-1) return word:gsub(hide, asterisk:rep(#hide)) end for example: wordCensor("banana") will return b****a Link to comment
dukenukem Posted December 6, 2010 Author Share Posted December 6, 2010 heh good thanks but i want too make Player say: f**k * - when you say it you dont get mute but **** censor function wordCensor(word) local asterisk = "*" local hide = word:sub(2, #word-1) return word:gsub(hide, asterisk:rep(#hide)) end for example: wordCensor("banana") will return b****a heh. I wanted to do it yourself Link to comment
Aibo Posted December 6, 2010 Share Posted December 6, 2010 heh good thanks but i want too make Player say: f**k * - when you say it you dont get mute but **** censor function wordCensor(word) local asterisk = "*" local hide = word:sub(2, #word-1) return word:gsub(hide, asterisk:rep(#hide)) end for example: wordCensor("banana") will return b****a heh. I wanted to do it yourself yuo still have a lot to do Link to comment
Neukfout Posted December 29, 2010 Share Posted December 29, 2010 Nice resource man, thanks for it, I've got one problem; when I get muted, I am still able to talk? EDIT: Oh man, sorry for this post, didn't read well. Thank you very much man! It works 5/5 EDIT2: Hmmm, thought it worked, but when you put a word like 'mf' in the list, and someone says amfitamin (is that a word?) you'll still get muted... Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now