PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: whoosh on 28 April, 2005, 22:34:27

Title: Could someone please convert this script to lua 5
Post by: whoosh on 28 April, 2005, 22:34:27
I have been using an Anti Swear script for some time now but i have upgraded to latest ptokax and roboc and it doesn't work any more...here is the script i have been using

--Made By nErBoS
--Fixed by plop


botname = "?SwearBot?"
trigs = {"offensive words have been removed"}

function Main()
   frmHub:RegBot(botname)
end
   
function DataArrival(user, data)
   if (not user.bOperator) then
      if ( strsub(data, 1, 1) == "<" ) then
         for i=1,getn(trigs) do
            if( strfind( strlower(data), trigs) ) then
            local word = strlower(data), trigs
               SendToAll(botname, "The user "..user.sName.." was banned for Advertising or Swearing." )
               user:SendData(botname, "You have been banned for Advertising or Swearing.")
               SendPmToOps(botname, "The user "..user.sName.." was banned for Advertising or Swearing.")
               SendPmToOps(botname, "The user IP "..user.sIP.." .")
               SendPmToOps(botname, "He wrote : "..word)
               user:Disconnect()
               user:TempBan()
               break
            end
         end
      end
   end
end




Thanks in advance
Title:
Post by: Dessamator on 28 April, 2005, 23:28:55
--By Dessamator
--Made By nErBoS
--Fixed by plop


botname = "?SwearBot?"
trigs = {"offensive words have been removed"}

function Main()
frmHub:RegBot(botname)
end

function ChatArrival(user, data)
if (not user.bOperator) then
for i=1,table.getn(trigs) do
if( string.find( string.lower(data), trigs[i]) ) then
local word = string.lower(data), trigs[i]
SendToAll(botname, "The user "..user.sName.." was banned for Advertising or Swearing." )
user:SendData(botname, "You have been banned for Advertising or Swearing.")
SendPmToOps(botname, "The user "..user.sName.." was banned for Advertising or Swearing.")
SendPmToOps(botname, "The user IP "..user.sIP.." .")
SendPmToOps(botname, "He wrote : "..word)
user:Disconnect()
user:TempBan()
break
end
end
end
end
 
 

Done(untested) !!!
Title:
Post by: jiten on 29 April, 2005, 12:38:23
Hum, u forgot to change "str" to "string." ;)

Cheers
Title:
Post by: Dessamator on 29 April, 2005, 14:37:06
done !!

Post edited, ;)