English Bad Word ( Censor System )

7 replies
Goto Page
To the start Previous 1 Next To the start
21.07.12 10:30:08 pm
Up
Jhony
User
Offline Off
How to Script Word Inappropriate?

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
badtal={
lixo,
bin,
fuck,
puta,
Desgracado,
desgracado,
cotoco,
cotocos,
merda,
Merda,
Cotoco,
Cotocos,
Lixo,
Gay,
gay,
viado,
Viado,
bixa,
Bicha,
Bixa,
bicha,
Nerd,
nerd,
NERD}

addhook("say","ina")
function ina(id,t)
if t == "..badtal.." then
parse("kick "..id)
msg2(id,"©255255255VAZA SEU MERDA")
msg("©255000000 "..player(id,"name").." Usou umas Palavras Inapropriadas no Servidor e Foi Kickado !")
return 1
end
end
21.07.12 10:34:14 pm
Up
Alistaire
User
Offline Off
for i = 1, #badtal do
     if t == i then
          parse('kick '..id)
     end
end
IMG:http://i.imgur.com/5zhwOTP.png
21.07.12 10:44:39 pm
Up
PyKemis
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("say","ina")
function ina(id,t)
     local kick=false
     for _,word in pairs(badtal) do
          if string.find(string.lower(t),string.lower(word))~=nil then
               kick=true
               break
          end
     end
     if kick==true then
          parse("kick "..id)
          msg2(id,"©255255255VAZA SEU MERDA")
          msg("©255000000 "..player(id,"name").." Usou umas Palavras Inapropriadas no Servidor e Foi Kickado !")
          return 1
     end
end
21.07.12 10:46:50 pm
Up
Avo
User
Offline Off
@user Jhony: Remember, than "smart" players can use "3" instead of "e"/"E",@ instead of "a"/"A" etc...
21.07.12 10:47:41 pm
Up
EP
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
badtal={
"lixo",
"bin",
"fuck",
"puta",
"caralho",
"desgracado",
"cotoco",
"merda",
"gay",
"viado",
"bixa",
"bicha",
"nerd"}

addhook("say","ina")
function ina(id,t)
     for _,word in pairs(badtal) do
          if t:lower():match(word) then
               msg2(id,"©255255255VAZA SEU MERDA")
               parse("kick "..id)
               msg("©255000000 "..player(id,"name").." Usou umas Palavras Inapropriadas no Servidor e Foi Kickado !")
               return 1
          end
     end
end
Remember that you want to know strings, not variables (They will give error cause they have no value).
edited 1×, last 21.07.12 11:25:17 pm
21.07.12 10:57:04 pm
Up
PyKemis
User
Offline Off
You should get into the habit of using pairs for everything and ipairs only if you want to sort a table by index.

As a table such as:

Code:
1
2
3
4
5
6
battal={
     ["index"]="word",
     [function() msg("hello") end]="word",
     [true]="word",
     [1]="word"
}


Are all valid, and he might want to add something like that if he wishes to add a punishment level for different types of words.
21.07.12 11:57:49 pm
Up
Jela331
User
Offline Off
You can find that script in lua/samples folder.
22.07.12 02:30:02 am
Up
DarkLight66
User
Offline Off
It's strange that noone noticed that he's kicking the player before showing the message to him, and even if it showed it before, the player won't read it before the server kicks him.

About the script:

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
badtal={
"lixo",
"bin",
"fuck",
"puta",
"caralho",
"desgracado",
"cotoco",
"merda",
"gay",
"viado",
"bixa",
"bicha",
"nerd"}

addhook("say","ina")
function ina(id,t)
     for _,word in pairs(badtal) do
          if t:lower():match(word:lower()) then
               msg("©255000000 "..player(id,"name").." Usou umas Palavras Inapropriadas no Servidor e Foi Kickado !")
               parse("kick "..id.." \"©255255255VAZA SEU MERDA\"")
               return 1
          end
     end
end
Paradox
To the start Previous 1 Next To the start