PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Markitos on 24 April, 2005, 00:02:29

Title: Help
Post by: Markitos on 24 April, 2005, 00:02:29
Can someone convert this script to lua 5?

--## Warn Bot
--## Pedido por ?
--## Feito por nErBoS

sBot = "!'U?????h??le'!?"

--## Tabela com as palavras a ser avisadas ##--
arrWord = {
   "a", "e", "i", "o", "u", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
}

function Main()
   frmHub:RegBot(katbot)
end

function DataArrival(user, data)
   if (strsub(data,1,1) == "<" and not user.bOperator) then
      data = strsub(data,1,strlen(data)-1)
      for i=1, getn(arrWord) do
         if (strfind(data, arrWord[i])) then
            local s,e,talk = strfind(data, "%b<>%s+(.+)")
            SendPmToOps(sBot, "<"..user.sName.."> ("..user.sIP..") disse no Main: "..talk)
            return 0
         end
      end
   end
   if (strsub(data,1,5) == "$To: " and not user.bOperator) then
      data = strsub(data,1,strlen(data)-1)
      for i=1, getn(arrWord) do
         if (strfind(data, arrWord[i])) then
            local s,e,to = strfind(data, "$To:%s+(%S+)")
            local s,e,talk = strfind(data, "%b<>%s+(.+)")
            SendPmToOps(sBot, "<"..user.sName.."> ("..user.sIP..") disse em PVT ao utilizador "..to.." o seguinte: "..talk)
            return 0
         end
      end
   end
end
Title:
Post by: Dessamator on 24 April, 2005, 00:37:02
--## Warn Bot
--## Pedido por ?
--## Feito por nErBoS

sBot = "!'U?????h??le'!?"

--## Tabela com as palavras a ser avisadas ##--
arrWord = {
   "a", "e", "i", "o", "u", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
}

function Main()
   frmHub:RegBot(katbot)
end

function ChatArrival(user, data)
   if not(user.bOperator) then
      data = string.sub(data,1,-2)
      for i=1, table.getn(arrWord) do
         if (string.find(data, arrWord[i])) then
            local s,e,talk = string.find(data, "%b<>%s+(.+)")
            SendPmToOps(sBot, "<"..user.sName.."> ("..user.sIP..") disse no Main: "..talk)
            return 0
         end
      end
   end
end

function ToArrival(user, data)
 if not (user.bOperator) then
      data = string.sub(data,1,-2)
      for i=1, table.getn(arrWord) do
         if (string.find(data, arrWord[i])) then
            local s,e,to = string.find(data, "$To:%s+(%S+)")
            local s,e,talk = string.find(data, "%b<>%s+(.+)")
            SendPmToOps(sBot, "<"..user.sName.."> ("..user.sIP..") disse em PVT ao utilizador "..to.." o seguinte: "..talk)
            return 0
         end
      end
   end
end


done !!,

quick conversion untested, :D
Title:
Post by: Markitos on 24 April, 2005, 17:13:58
It worked great thnks!!!
Title:
Post by: Dessamator on 24 April, 2005, 17:29:49
QuoteOriginally posted by Markitos
It worked great thnks!!!

yw , :)