Could someone please convert this script to lua 5
 

Could someone please convert this script to lua 5

Started by whoosh, 28 April, 2005, 22:34:27

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

whoosh

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

Dessamator

#1
--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) !!!
Ignorance is Bliss.

jiten

Hum, u forgot to change "str" to "string." ;)

Cheers

Dessamator

done !!

Post edited, ;)
Ignorance is Bliss.

SMF spam blocked by CleanTalk