PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: Ahmed on 10 July, 2004, 23:29:12

Title: Need some help to add one feature.
Post by: Ahmed on 10 July, 2004, 23:29:12
I have foud one good word replace script, it works onli in main chat, and i can't to get it workin in PM too.

--//NaughtyASs Cook Bot v1.06 fixed by Phatty
--//Does things with words lol :p

Bot = "!crazy"
function Main()
frmHub:RegBot(Bot)
end
 
badtable = {

["twat"]="bread",
["cunt"]="dish washer",
["bastard"]="cook-book",
["fucker"]="chief",
["fucking"]="cooking",
["fuck"]="cook",
["arsehole"]="microwave",
["arse"]="microchip",
["clit"]="tomato",
["cock"]="banana",
["tosser"]="baker",
["bitch"]="teaspoon",
["shit"]="mcdonald's manager",
["crap"]="chocolate",
["pissed"]="diluted",
["piss"]="orange juice",
["shagging"]="boiling",
["shag"]="sauce",
["cum"]="water",
["spunk"]="juice",
["asshole"]="fridge-freezer",
["ass"]="oven",
["slut"]="grape-fruit",
["dick"]="sausage",
["fanny"]="pie",
["whore"]="hotdog",
["wanker"]="i'm a wanker",
["slag"]="i'm a slag",

}

function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
for i,v in badtable do
  data=gsub(data, i, v)
--data, x,y = gsub(data, "%b"..i, v)
end
SendToAll(data)
return 1
end
end
Title:
Post by: nErBoS on 11 July, 2004, 01:28:22
Hi,

Try this...

--//NaughtyASs Cook Bot v1.06 fixed by Phatty
--//Does things with words lol :p
--//Work in PM by nErBoS

Bot = "!crazy"
function Main()
frmHub:RegBot(Bot)
end
 
badtable = {

["twat"]="bread",
["cunt"]="dish washer",
["bastard"]="cook-book",
["fucker"]="chief",
["fucking"]="cooking",
["fuck"]="cook",
["arsehole"]="microwave",
["arse"]="microchip",
["clit"]="tomato",
["cock"]="banana",
["tosser"]="baker",
["bitch"]="teaspoon",
["shit"]="mcdonald's manager",
["crap"]="chocolate",
["pissed"]="diluted",
["piss"]="orange juice",
["shagging"]="boiling",
["shag"]="sauce",
["cum"]="water",
["spunk"]="juice",
["asshole"]="fridge-freezer",
["ass"]="oven",
["slut"]="grape-fruit",
["dick"]="sausage",
["fanny"]="pie",
["whore"]="hotdog",
["wanker"]="i'm a wanker",
["slag"]="i'm a slag",

}

function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
for i,v in badtable do
  data=gsub(data, i, v)
end
SendToAll(data)
return 1
elseif strsub(data, 1, 5) == "$To: " then
for i,v in badtable do
  data=gsub(data, i, v)
end
user:SendData(data)
return 1
end
end

Best regards, nErBoS
Title:
Post by: Ahmed on 11 July, 2004, 14:05:39
Found litle problems, PM dont work correctly, when i using
 elseif strsub(data, 1, [COLOR=red]5[/COLOR] ) == "$To: " then
then PM dont work, if i edit it to
elseif strsub(data, 1, [COLOR=red]4[/COLOR] ) == "$To: " then
then script dont work.
Title:
Post by: NightLitch on 11 July, 2004, 15:11:51
--//NaughtyASs Cook Bot v1.06 fixed by Phatty
--//Does things with words lol :p
--//Work in PM by nErBoS
--//Slight Change by NightLitch should work in PM now...

Bot = "!crazy"
function Main()
frmHub:RegBot(Bot)
end
 
badtable = {

["twat"]="bread",
["cunt"]="dish washer",
["bastard"]="cook-book",
["fucker"]="chief",
["fucking"]="cooking",
["fuck"]="cook",
["arsehole"]="microwave",
["arse"]="microchip",
["clit"]="tomato",
["cock"]="banana",
["tosser"]="baker",
["bitch"]="teaspoon",
["shit"]="mcdonald's manager",
["crap"]="chocolate",
["pissed"]="diluted",
["piss"]="orange juice",
["shagging"]="boiling",
["shag"]="sauce",
["cum"]="water",
["spunk"]="juice",
["asshole"]="fridge-freezer",
["ass"]="oven",
["slut"]="grape-fruit",
["dick"]="sausage",
["fanny"]="pie",
["whore"]="hotdog",
["wanker"]="i'm a wanker",
["slag"]="i'm a slag",

}

function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
for i,v in badtable do
  data=gsub(data, i, v)
end
SendToAll(data)
return 1
elseif strsub(data, 1, 4) == "$To:" then
for i,v in badtable do
  data=gsub(data, i, v)
end
user:SendData(data)
return 1
end
end

/NL
Title:
Post by: Ahmed on 11 July, 2004, 15:25:18
Destination users dont recive private messages,
but user who send message recive his own messages.
Then users send messages itself.
Title:
Post by: plop on 12 July, 2004, 10:01:39
try this 1.
-- word replace script.
-- by plop


---- filter what? use 1 to enable, nil to disable the filter.
FilterPm = nil
FilterMain = 1

---- the words to be replaced and by what.
tBadWords = {
   ["fuck"]= "havin sex",
   ["shit"] = "bleeeeeeeeh",
   ["m8"] = "mate",
   ["ass"] = "my hiny",
   ["g/f"] = "girlfriend",
   ["asshole"] = "(place where dirty stuff exits the body)",
   ["dick"] = "male saucage",
   ["cum"] = "body cream",
   ["fucker"] = "I love you",
   ["fuckers"] = "I love you guy's",
   ["fucking"] = "doing dirty",
   ["bastard"] = "naughty boy",
   ["hell"] = "mac donalds",
   ["whore"] = "angel",
   ["yep3"] = "yepyepyep4711",
   ["nl"] = "NightLitch",
   ["truck"] = "[NL]trucker",
   ["woosh"] = "Wooshman",
   ["ner"] = "nErBoS",
   ["typ"] = "typhoon",
   ["opti"] = "Optimus",
   ["opium"] = "OpiumVolage",
   ["kbeh"] = "kbeh273300",
   ["shad"] = "Shad_dow?",
   ["hawk"] = "??????Hawk??????",
   ["des"] = "Herodes",
   ["nid"] = "Nidaros",
   ["2"] = "to"
}

tBadChar = {
   ["!"] = "",
   ["?"] = "",
   ["."] = "",
   [":"] =  "",
   ["\""] = "",
   ["'"] = "",
   ["*"] = "",
   ["("] = "",
   [")"] = "",
   ["="] = ""
}

function CheckLetter(letter)
   if tBadChar[letter] then
      store = store..letter
      return tBadChar[letter]
   else
      return letter
   end
end

function CheckWord(word)
   store = ""
   local word2 = gsub(word, "(%S)", function(letter) return CheckLetter(letter) end)
   if tBadWords[word2] then
      c = 1
      return tBadWords[word2]..store
   else
      return word
   end
end

function DataArrival(user, data)
   c = nil
   if( strsub(data, 1, 1) == "<" ) then
      if FilterMain then
         local data = strlower(strsub(data,(strlen(user.sName)+4),strlen(data)-1))
         data=gsub(data , "(%S+)", function(word) return CheckWord(word) end)
         if c then
            local s,e, cmd = strfind(data, "%s*(%S+)")
            if cmd == "!me" then
               SendToAll("* "..user.sName.." "..strsub(data, 5, strlen(data)).."|")
               return 1
            else
               SendToAll(user.sName, data.."|")
               return 1
            end
         end
      end
   elseif(strsub(data, 1, 4) == "$To:") then
      if FilterPm then
         local data = strsub(data, 1, (strlen(data)-1))
         local s,e,whoto = strfind(data, "%S+%s*(%S+)")
         s,e,data = strfind(data, "$%b<>%s*(.*)$")
         data=gsub(data , "(%S+)", function(word) return CheckWord(word) end)
         if c then
            SendPmToNick(whoto, user.sName, data.."|")
            return 1
         end
      end
   end
end

plop
Title:
Post by: Ahmed on 12 July, 2004, 11:51:18
Thx, I think all right, now.