PtokaX forum

Archive => Archived 5.0 boards => Help with scripts => Topic started by: Tw?sT?d-d?v on 16 November, 2005, 23:20:08

Title: can you convert please
Post by: Tw?sT?d-d?v on 16 November, 2005, 23:20:08
Hi scripters .... found this script and wandered if you can convert to lua 5 please ..... and if its worth using

-- sneaky anti advertising bot by plop
-- it replaces the url's users post for your own.   lol
-- let them work for you, instead of against you
-- thx again for the hints from rabidwombat


WEBSITE = "http://www.undergroundempires.tk/"
HUBADRESS ="empires.mine.nu"

OKSITES = { ["http://www.optimaldc.tk/"] = 1, ["http://www.empiresdc.tk/"] = 1 }

OKHUBS = { ["empires.mine.nu"] = 1, ["optimal.mine.nu"] = 1, ["empires.mine.nu"] = 1}

function DataArrival(user, data)
   if user.iProfile == -1 or user.iProfile == 3 then
      if (strsub(data, 1, 1) == "<") then
      --if not(strsub(data, 1, 4) == "$To:") then
         data = strsub(data, 1, (strlen(data)-1))
         local s,e,msg,webadver,msg2 = strfind(data, "%b<>%s(.*)http://([^%.]+%.[^%.]+%.%S+)(.*)$")
         if webadver ~= nil then
            local s,e,webby = strfind(webadver, "(%S+%.[^%.]+%.%a+)/.*")
            if webby == nil then webby = webadver end
            if OKSITES[webby] == nil then
               SendToAll(user.sName, msg..WEBSITE..msg2)
               return 1
            end
         else
            local s,e,msg,webadver,msg2 = strfind(data, "%b<>%s(.*)(www+%.[^%.]+%.%S+)(.*)$")
            if webadver ~= nil then
               local s,e,webby = strfind(webadver, "(%S+%.[^%.]+%.%a+)/.*")
               if webby == nil then webby = webadver end
               if OKSITES[webby] == nil then
                  SendToAll(user.sName, msg..WEBSITE..msg2)
                  return 1
               end
            else
               local s,e, adver = strfind(data, "%b<>%s(%S+%.[^%.]+%.[^%.]+)")
               if adver ~= nil then
                  local s,e,hubby = strfind(adver, "(%S+%.[^%.]+%.%a+)/.*")
                  if hubby == nil then hubby = adver end
                  if OKHUBS[hubby] == nil then
                     SendToAll(user.sName, HUBADRESS)
                     return 1
                  end
               else
                  local s,e,msg,adver,msg2 = strfind(data, "%b<>%s(.*)%s([^%.]+%.[^%.]+%.%S+)(.*)$")
                  if adver ~= nil then
                     local s,e,hubby = strfind(adver, "(%S+%.[^%.]+%.%a+)/.*")
                     if hubby == nil then hubby = adver end
                     if OKHUBS[hubby] == nil then
                        SendToAll(user.sName, msg.." "..HUBADRESS..msg2)
                        return 1
                     end
                  end
               end
            end
         end
      else
         --local s,e,to,text = strfind(data, "%$To: (%S+) From: %S %$(.+)$")
                            local s,e,to,text = strfind(data,    "%$To:%s(%S+)%sFrom:%s%S+%s$(.*)$")
         if(to == nil) then return 0 end
         to = GetItemByName(to)
         if to.iProfile == -1 or to.iProfile == 3 then
            text = strsub(text, 1, (strlen(text)-1))
            local s,e,msg,webadver,msg2 = strfind(text, "%b<>%s(.*)http://([^%.]+%.[^%.]+%.%S+)(.*)$")
            if webadver ~= nil then
               local s,e,webby = strfind(webadver, "(%S+%.[^%.]+%.%a+)/.*")
               if webby == nil then webby = webadver end
               if OKSITES[webby] == nil then
                  SendPmToNick(to.sName, user.sName, msg..WEBSITE..msg2)
                  return 1
               end
            else
               local s,e,msg,webadver,msg2 = strfind(text, "%b<>%s(.*)(www+%.[^%.]+%.%S+)(.*)$")
               if webadver ~= nil then
                  local s,e,webby = strfind(webadver, "(%S+%.[^%.]+%.%a+)/.*")
                  if webby == nil then webby = webadver end
                  if OKSITES[webby] == nil then
                     SendPmToNick(to.sName, user.sName, msg..WEBSITE..msg2)
                     return 1
                  end
               else
                  local s,e, adver = strfind(text, "%b<>%s(%S+%.[^%.]+%.[^%.]+)")
                  if adver ~= nil then
                     local s,e,hubby = strfind(adver, "(%S+%.[^%.]+%.%a+)/.*")
                     if hubby == nil then hubby = adver end
                     if OKHUBS[hubby] == nil then
                        SendPmToNick(to.sName, user.sName, HUBADRESS)
                        return 1
                     end
                  else
                     local s,e,msg,adver,msg2 = strfind(text, "%b<>%s(.*)%s([^%.]+%.[^%.]+%.%S+)(.*)$")
                     if adver ~= nil then
                        local s,e,hubby = strfind(adver, "(%S+%.[^%.]+%.%a+)/.*")
                        if hubby == nil then hubby = adver end
                        if OKHUBS[hubby] == nil then
                           SendPmToNick(to.sName, user.sName, msg.." "..HUBADRESS..msg2)
                           return 1
                        end
                     end
                  end
               end
            end
         end
      end
   end
end
Title:
Post by: 6Marilyn6Manson6 on 17 November, 2005, 07:39:38
Hi, try this: (Not Tested)

-- sneaky anti advertising bot by plop
-- it replaces the url's users post for your own.   lol
-- let them work for you, instead of against you
-- thx again for the hints from rabidwombat
-- Converted by 6Marilyn6Manson6 by 17/11/2005

WEBSITE = "http://www.undergroundempires.tk/"
HUBADRESS ="empires.mine.nu"

OKSITES = { ["http://www.optimaldc.tk/"] = 1, ["http://www.empiresdc.tk/"] = 1 }
OKHUBS = { ["empires.mine.nu"] = 1, ["optimal.mine.nu"] = 1, ["empires.mine.nu"] = 1}

function ChatArrival(user, data)
if user.iProfile == -1 or user.iProfile == 3 then
data = string.sub(data, 1, (string.len(data)-1))
local s,e,msg,webadver,msg2 = string.find(data, "%b<>%s(.*)[URL]http://[/URL]([^%.]+%.[^%.]+%.%S+)(.*)$")
if webadver ~= nil then
local s,e,webby = string.find(webadver, "(%S+%.[^%.]+%.%a+)/.*")
if webby == nil then webby = webadver end
if OKSITES[webby] == nil then
SendToAll(user.sName, msg..WEBSITE..msg2)
return 1
end
else
local s,e,msg,webadver,msg2 = string.find(data, "%b<>%s(.*)(www+%.[^%.]+%.%S+)(.*)$")
if webadver ~= nil then
local s,e,webby = string.find(webadver, "(%S+%.[^%.]+%.%a+)/.*")
if webby == nil then webby = webadver end
if OKSITES[webby] == nil then
SendToAll(user.sName, msg..WEBSITE..msg2)
return 1
end
else
local s,e, adver = string.find(data, "%b<>%s(%S+%.[^%.]+%.[^%.]+)")
if adver ~= nil then
local s,e,hubby = string.find(adver, "(%S+%.[^%.]+%.%a+)/.*")
if hubby == nil then hubby = adver end
if OKHUBS[hubby] == nil then
SendToAll(user.sName, HUBADRESS)
return 1
end
else
local s,e,msg,adver,msg2 = string.find(data, "%b<>%s(.*)%s([^%.]+%.[^%.]+%.%S+)(.*)$")
if adver ~= nil then
local s,e,hubby = string.find(adver, "(%S+%.[^%.]+%.%a+)/.*")
if hubby == nil then hubby = adver end
if OKHUBS[hubby] == nil then
SendToAll(user.sName, msg.." "..HUBADRESS..msg2)
return 1
end
end
end
end
end
else
local s,e,to,text = string.find(data,    "%$To:%s(%S+)%sFrom:%s%S+%s$(.*)$")
if(to == nil) then return 0 end
to = GetItemByName(to)
if to.iProfile == -1 or to.iProfile == 3 then
text = string.sub(text, 1, (string.len(text)-1))
local s,e,msg,webadver,msg2 = string.find(text, "%b<>%s(.*)[URL]http://[/URL]([^%.]+%.[^%.]+%.%S+)(.*)$")
if webadver ~= nil then
local s,e,webby = string.find(webadver, "(%S+%.[^%.]+%.%a+)/.*")
if webby == nil then webby = webadver end
if OKSITES[webby] == nil then
SendPmToNick(to.sName, user.sName, msg..WEBSITE..msg2)
return 1
end
else
local s,e,msg,webadver,msg2 = string.find(text, "%b<>%s(.*)(www+%.[^%.]+%.%S+)(.*)$")
if webadver ~= nil then
local s,e,webby = string.find(webadver, "(%S+%.[^%.]+%.%a+)/.*")
if webby == nil then webby = webadver end
if OKSITES[webby] == nil then
SendPmToNick(to.sName, user.sName, msg..WEBSITE..msg2)
return 1
end
else
local s,e, adver = string.find(text, "%b<>%s(%S+%.[^%.]+%.[^%.]+)")
if adver ~= nil then
local s,e,hubby = string.find(adver, "(%S+%.[^%.]+%.%a+)/.*")
if hubby == nil then hubby = adver end
if OKHUBS[hubby] == nil then
SendPmToNick(to.sName, user.sName, HUBADRESS)
return 1
end
else
local s,e,msg,adver,msg2 = string.find(text, "%b<>%s(.*)%s([^%.]+%.[^%.]+%.%S+)(.*)$")
if adver ~= nil then
local s,e,hubby = string.find(adver, "(%S+%.[^%.]+%.%a+)/.*")
if hubby == nil then hubby = adver end
if OKHUBS[hubby] == nil then
SendPmToNick(to.sName, user.sName, msg.." "..HUBADRESS..msg2)
return 1
end
end
end
end
end
end
end
end

C ya
Title:
Post by: Tw?sT?d-d?v on 17 November, 2005, 18:05:32
cheers 6Marilyn6Manson6 gonna test it now  :D
Title:
Post by: 6Marilyn6Manson6 on 17 November, 2005, 18:53:42
QuoteOriginally posted by (uk)jay
cheers 6Marilyn6Manson6 gonna test it now  :D


:D