Help with the script antipub
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Help with the script antipub

Started by Re@SoN, 11 February, 2005, 00:57:27

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Re@SoN

hi!
i have this script of antipub in my hub but give me a error:
Syntax error: bad argument #1 to `gsub' (string expected, got nil)
stack traceback:
   1:  function `gsub' [C]
   2:  function `DataArrival' at line 96 [file `...U B =\?? MeXcaL - HUB  ??\scripts\M?X - PuB.lua']


this is the script:

--====[ Advertising Shield ]====--
-- Version: 10
-- By: NightLitch
-- Date: 2004-03-23
-- Translated by [PT]CableGuy
----------------------------------------------------
-- Set Botname
BotName = "? M?X?PuB ?"
-- Altera a ac??o do script ( 0=Aviso / 1=Desligar / 2=Kickar / 3=Banir)
Action = 3
-- Coloca os hubs PERMITIDOS aqui...
OkHubs = {
"MeXcaL.mine.nu",  
}
-- Links permitidos ...
Sites = {
"www.",
"http://",
"ftp://",
"irc.",
"cs.",
}
-- PUB PROIBIDA enviada em pvt/mainchat...
Adver = {
"ip",
"myftp",
"dyndns",
"dns2go",
"dynip",
"d2g",
"dynu",
"mine",
"kick-ass",
"sytes",
"homeip",
"mine",
"serveftp",
"servebeer",
"ass",
"gotdns",
"udgnet",
}
-- Extens?es pertencentes ? PUB PROIBIDA...
Ext = {
"com",
"net",
"org",
"se",
"nu",
}
-- Caract?res que possam ser usados entre as letras da PUB... (exemplo: h*u*b*.*n*o*-*i*p*.*c*o*m)
CharCh = {
["%(dot%)"]=".",
["dot"]=".",
["%(%-%)"]="-",
["#"]="",
["!"]="",
["+"]="",
["%-"]="",
["*"]="",
["/"]="",
[" '"]="",
}
---------------------------------------------------------------
-- N?O EDITAR DAQUI PARA BAIXO --
tabAdvert = {}

function Main()
   frmHub:RegBot(BotName)
end

function DataArrival(curUser, data)
   local Msg = ""
   if strsub(data, 1, 1) == "<" and not strfind(data,"> !") and not curUser.bOperator then
      local _, _,line = strfind(data, "^%b<>%s+(.*)")
      Msg = line
      for i,v in CharCh do
             line=gsub(line, i, v)
      end
      if CheckAdver(curUser,line,"no main-chat, e escreveu: ",Msg)==1 then
         return 1
      end
   elseif ( strsub(data, 1, 4) == "$To:" ) then
      local _,_,to,from,line = strfind(data,    "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
      Msg = line
      for i,v in CharCh do
             line=gsub(line, i, v)
      end
      if CheckAdver(curUser,line,"em MP para "..to..", e escreveu: ",Msg)==1 then
         return 1
      end
   elseif (strsub(data,1,7) == "$MyINFO") then
      local _,_,line = strfind(data, "%$MyINFO %$ALL %S+%s+(.*)<")
      Msg = line
      for i,v in CharCh do
             line=gsub(line, i, v)
      end
      if CheckAdver(curUser,line,"na descri??o da TAG",Msg)==1 then
         return 1
      end
   end
end

function CheckAdver(curUser,line,msg,Msg)
   local adver,extension = Verify(curUser.sName, line,Adver), Verify(curUser.sName, line,Ext)
   if adver and extension and OkAdver(adver)~=1 then
      tabAdvert = nil
      tabAdvert = {}
      local action = DoDisc(curUser,msg,line)
      SendToOps("",curUser.sName.." ( "..curUser.sIP.." )  foi "..action.." por PUBlicidade "..msg..": "..Msg)
      return 1
   end
end

function DoDisc(curUser,msg,line)
   if Action==0 then
      curUser:SendPM(BotName,"Foste avisado por PUB "..msg..": "..line) return "Warned"
   elseif Action==1 then
      curUser:SendPM(BotName,"Foste desligado por PUB "..msg..": "..line)
      curUser:Disconnect() return "Disconnected"
   elseif Action==2 then
      curUser:SendPM(BotName,"Foste kikcado por PUB "..msg..": "..line)
      curUser:TempBan() return "Kicked"
   elseif Action==3 then
      curUser:SendPM(BotName,"Foste banido por PUB "..msg..": "..line)
      curUser:Ban() return "Banned"
   end
end

function OkAdver(adver)
   for i,v in OkHubs do
      if strfind(adver,v) then
         return 1
      end
   end
end

function Verify(userdata, msg,table)
   if not msg then return end
   tmp =""
   gsub(strlower(msg), "([a-?0-9.:%-])", function(x) tmp = tmp..x end)
   if not tabAdvert[userdata] then
      tabAdvert[userdata] = { iClock = clock(), l1 = "", l2 = "", l3 = "", l4= "", l5= "",l6= "",l7= "",l8= "",l9 = tmp}
   else
      tabAdvert[userdata].iClock = clock()
      tabAdvert[userdata].l1 = tabAdvert[userdata].l2
      tabAdvert[userdata].l2 = tabAdvert[userdata].l3
      tabAdvert[userdata].l3 = tabAdvert[userdata].l4
      tabAdvert[userdata].l4 = tabAdvert[userdata].l5
      tabAdvert[userdata].l5 = tabAdvert[userdata].l6
      tabAdvert[userdata].l6 = tabAdvert[userdata].l7
      tabAdvert[userdata].l7 = tabAdvert[userdata].l8
      tabAdvert[userdata].l8 = tabAdvert[userdata].l9
      tabAdvert[userdata].l9 = tmp
   end
   local Lines = tabAdvert[userdata].l1.."#"..tabAdvert[userdata].l2.."#"..tabAdvert[userdata].l3.."#"..tabAdvert[userdata].l4.."#"..tabAdvert[userdata].l5.."#"..tabAdvert[userdata].l6.."#"..tabAdvert[userdata].l7.."#"..tabAdvert[userdata].l8.."#"..tabAdvert[userdata].l9
   for key, value in table do
      if (strfind(Lines, strlower(value), 1, 1)) then
         return 1
      end
   end
end

Re@SoN

could anyone help me please??

SMF spam blocked by CleanTalk