Jump to content

Does anyone know


arris

Recommended Posts

Hook up the onPlayerChat event to a handler, check if whatever he said contains a swear word. If it does, check if his warning count is 3 or higher. If it is, kick him, if not, increment his warning count and send him a warning.

For the swear words and warning counts, you can use tables. In the counter tables, you can use the player elements as indices. Alternatively, you can store the warning counts in element data for each player, although this isn't really recommended since it'll sync the data with the client, where it'll never be used anyways.

Link to comment
swears = (All the swears are here)
 
function chat()
        if outputChatBox ==(swears) and getElementType(source)=="player" then
                outputChatBox ("PLEASE DONT SWEAR ON NRNS SERVERS!!!!... U CAN GET KICKED/BANNED", 255, 0, 0 )
        end
end     
addEventHandler ("onPlayerChat",source, chat )

and i get this is what it says in the console "WARNING: swear.lua: Bad argument @ 'addEventHandler' -Line: 7"

Link to comment

Read the lua basics again. Tables are defined using brackets { }, not parentheses.

Also you will need to loop through the swears table and check for matches (cast all strings to either lowercase or uppercase first, otherwise people can write stuff like FuCk, FUcK, etc. to evade the censor.)

And please do yourself and your clan/whatever a favor and use proper language in the scripts; writing "u" instead of "you" should generally be avoided unless you're in a hurry, but in a server, it makes the whole deal look terribly unprofessional. There's never any excuse for 4 exclamation marks in a row, either.

Link to comment

ahhh... Robohol, i was the one that made that script with arris and we wrote (All Swears Here) Because we didnt want to have a awsomly long text just with swearing. And all words are written like this: swears = { ["Swear"]=true, ["swear"]=true, and so on... Just so u know xD

And that outputChatBox string, thats just temporary

So dont worry about that.

But The Thing We Gotta Get Fixed Is That Warning. And Right Now We Have No Clue What To Do.

And Also We Just Gotta Get It Working Right Now.. Then We Can Fix The Swearings.

Link to comment

You shouldn't make a table like this:

tablename = { ["string"]=true, ["string"], ... }
 
-- just do it this way:
 
tablename = { "string", "string" }

Then just loop through the table and check if any of the words match. Use string.gmatch or string.find.

Link to comment

rofl ok.. here it is

  1. swears = { ["fodido"]=true, ["puta"]=true, ["PUTA"]=true, ["puto"]=true, ["PUTO"]=true, ["ass"]=true, ["wanker"]=true, ["@"]=true, ["666"]=true, ["amina koyayim"]=true, ["asshole"]=true, ["bicha"]=true, ["bitch"]=true, ["cabron"]=true, ["carechimba"]=true, ["chinga"]=true, ["chupamela"]=true, ["cook"]=true, ["cunt"]=true, ["donkey"]=true, ["cum"]=true, ["estupido"]=true, ["foda"]=true, ["fuck"]=true, ["fuckers"]=true, ["fuckin"]=true, ["gay"]=true, ["gonorrea"]=true, ["guevon"]=true, ["hpd"]=true, ["hijueputa"]=true, ["hotmail"]=true, ["hps"]=true, ["ibne"]=true, ["maldita"]=true, ["maldito"]=true, ["malnarcido"]=true, ["malparido"]=true, ["marica"]=true, ["maricon"]=true, ["marik"]=true, ["marika"]=true, ["mierda"]=true, ["monda"]=true, ["msn"]=true, ["n00b"]=true, ["noob"]=true, ["orospu cocugu"]=true, ["pija"]=true, ["pirobo"]=true, ["pussy"]=true, ["retard"]=true, ["shit"]=true, ["sik"]=true, ["siktir"]=true, ["slut"]=true, ["twat"]=true, ["wanker"]=true, ["whore"]=true, ["wtf"]=true }

 

 

 

     

 

 

 

    function chat()

 

 

 

            if outputChatBox ==(swears) and getElementType(source)=="player" then

 

 

 

                    outputChatBox ("PLEASE DONT SWEAR ON NRNS SERVERS!!!!... U CAN GET KICKED/BANNED", 255, 0, 0 )

 

 

 

            end

 

 

 

    end    

 

 

 

    addEventHandler ("onPlayerChat",source, chat )

 

 

 

 

 

 

this gives the WARNING arris was talking about

but.. i made another one that may me abit better

swears = { ["fodido"]=true, ["puta"]=true, ["PUTA"]=true, ["puto"]=true, ["PUTO"]=true, ["ass"]=true, ["wanker"]=true, ["@"]=true, ["666"]=true, ["amina koyayim"]=true, ["asshole"]=true, ["bicha"]=true, ["bitch"]=true, ["cabron"]=true, ["carechimba"]=true, ["chinga"]=true, ["chupamela"]=true, ["cook"]=true, ["cunt"]=true, ["donkey"]=true, ["cum"]=true, ["estupido"]=true, ["foda"]=true, ["fuck"]=true, ["fuckers"]=true, ["fuckin"]=true, ["gay"]=true, ["gonorrea"]=true, ["guevon"]=true, ["hpd"]=true, ["hijueputa"]=true, ["hotmail"]=true, ["hps"]=true, ["ibne"]=true, ["maldita"]=true, ["maldito"]=true, ["malnarcido"]=true, ["malparido"]=true, ["marica"]=true, ["maricon"]=true, ["marik"]=true, ["marika"]=true, ["mierda"]=true, ["monda"]=true, ["msn"]=true, ["n00b"]=true, ["noob"]=true, ["orospu cocugu"]=true, ["pija"]=true, ["pirobo"]=true, ["pussy"]=true, ["retard"]=true, ["shit"]=true, ["sik"]=true, ["siktir"]=true, ["slut"]=true, ["twat"]=true, ["wanker"]=true, ["whore"]=true, ["wtf"]=true }

 

 

 

function chat_bad(message, messageType)

 

 

 

        if message ==(swears) and getElementType(source)=="player" then

 

 

 

                outputChatBox ("PLEASE DONT SWEAR ON NRNS SERVERS!!!!... U CAN GET KICKED/BANNED, 255, 0, 0 )

 

 

 

        end

 

 

 

end     

 

 

 

addEventHandler ("onPlayerChat", getElementRoot(), chat_bad )

 

 

 

 

 

 

thou i havent debugged the latest one lol... its 2 Am here... been scripting for 13 hours today rofl

Link to comment

Oh, come ON! Half of those aren't even remotely offensive, and more still aren't swear words at all! Why would you block "donkey"? Roflmao.

If you don't intend to host a kindergarten server, screw this. If I came into a server that censored me, I'd gtfo VERY quickly.

And Thehookerkiller01, you still don't know what you're talking about, as evidenced by the horrendous example you posted. Will you please shut the fuck up and stop spreading misinformation?

Link to comment

I think this should work.

Someone should correct me if it's wrong.

flameWords = {"fuck", "bitch", "cocksucker"}
 
function disallowFlame(message)
for key, value in pairs(flameWords) do
if string.find(string.lower(message), value) then
outputChatBox("YOU HAVE BEEN WARNED!",source) -- do whatever you want here
end
end
end
 
addEventHandler("onPlayerChat", getRootElement(), disallowFlame)

Edited by Guest
Link to comment
Oh, come ON! Half of those aren't even remotely offensive, and more still aren't swear words at all! Why would you block "donkey"? Roflmao.

If you don't intend to host a kindergarten server, screw this. If I came into a server that censored me, I'd gtfo VERY quickly.

And Thehookerkiller01, you still don't know what you're talking about, as evidenced by the horrendous example you posted. Will you please shut the fuck up and stop spreading misinformation?

Hmm and Cook... :S

TBH why make a censor script? Its a waste of time and seeings GTA is rated 18+.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...