PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: jiten on 18 August, 2004, 19:48:22

Title: report to vip's
Post by: jiten on 18 August, 2004, 19:48:22
how can i send the advertising reports to VIP's in this antipub? it only sends it to operators.

here's the code:

-- from NighLitch's NXS-3

BotName = "robot"

HubAddress = "hub.no-ip.com"

-- Set On/Off if user should be kicked for advertising / 1:on/0:off
ADKICK = 0

OKHUBS = {
}

ADVER = {
["serveftp"]=1 }

SITES = { "www.","http://","ftp://","irc.","cs." }

tabAdvert = {}
PMCount = {}
MainCount = {}
awayArray = {}
RegTable = {}
UserInfo = {}
TabTimers = {n=0}
KickTable = {}
BanTable = {}
WarnTable = {}
Online = {}
Counter = {}
TopKickers = {}

CmdErrorMsg = "*** Syntax error in command"
CmdErrorPar = " No parameter given."

function Main()

--REG BOTS--------------------------------------------------------------------------------------------------
   frmHub:RegBot(BotName)

function SMPM(curUser)
   if (MPM==1)  then
      curUser.SD = function(this,from,text)
            this:SendPM(from,text)
         end
   else
      curUser.SD = function(this,from,text)
            this:SendData(from,text)
         end
   end
   return curUser
end

function DataArrival(curUser, data)
   SMPM(curUser)
      if ( strsub(data, 1, 1) == "<" ) then
      local _, _, msg = strfind(data, "^%b<>%s+(.*)|")
      if not curUser.bOperator then
         if SiteCheck(msg)==1 then
            return 0
         else
            if Verify(curUser.sName, msg) then
               local Lines = Verify(curUser.sName, msg)
               tabAdvert = nil
               tabAdvert = {}
               local s,e, adver = strfind(Lines, "[^#]#(%S+)$")
               if (FindAdver(adver) == "K") then
               return 0
               else
                  SendPmToOps (BotName,"Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in main: "..msg)
                  if ADKICK==1 then
                     SendPmToOps (BotName,"User has been kicked for Advertising.")
                     curUser:SendPM(BotName,"You were kicked for Advertising.")
                     curUser:TempBan()
                  else
                     curUser:SendPM(BotName,"Advertising Censored. Sorry.")
                  end
                  return 1
               end
            end
         end
         spam = 0
         if( strfind( strlower(data), "no",1,1) ) and ( strfind( strlower(data), "ip",1,1) ) then
            if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
         spam=spam+1; end; end;
         if( strfind( strlower(data), "my",1,1) ) and ( strfind( strlower(data), "ftp",1,1) ) then
            if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
         spam=spam+1; end; end;
         if( strfind( strlower(data), "dns",1,1) ) and ( strfind( strlower(data), "2",1,1) ) and ( strfind( strlower(data), "go",1,1) ) then
         spam=spam+1; end
         if( strfind( strlower(data), "dy",1,1) ) and ( strfind( strlower(data), "nu",1,1) ) then
            if( strfind( strlower(data), ".net",1,1) ) or ( strfind( strlower(data), ".com",1,1) ) then
         spam=spam+1;end; end
         if( strfind( strlower(data), "d n s a",1,1) ) or ( strfind( strlower(data), "d n s .",1,1) ) or ( strfind( strlower(data), "d n s 2",1,1) ) or ( strfind( strlower(data), "o d s .",1,1) ) or ( strfind( strlower(data), "d y n",1,1) ) then
         spam=spam+1;end
         if spam>0 then
            s,e,msg = strfind(data, "%b<> (.*)")
            SendPmToOps (BotName,"Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in main: "..msg)
            if ADKICK==1 then
               SendPmToOps (BotName,"User has been kicked for Advertising.")
               curUser:SendPM(BotName,"You were kicked for Advertising!")
               curUser:TempBan()
            else
               curUser:SendPM(BotName,"Advertising Censored. Sorry.")
            end
            return 1
         end
      end
      return MainCom(curUser,data)
   elseif strsub(data, 1, 4) == "$To: " then
      ToKickMsg(curUser, data)
      local s,e,to,from,text = strfind(data,    "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
      if to == BotName then
         return BotCom(curUser, data)
      else
         to = GetItemByName(to)
         if not curUser.bOperator then
            local _, _, msg = strfind(text, "^%b<>%s+(.*)|")
            if SiteCheck(msg)==1 then
               return 0
            else
               if Verify(curUser.sName, msg) then
                  local Lines = Verify(curUser.sName, msg)
                  tabAdvert = nil
                  tabAdvert = {}
                  local s,e, adver = strfind(Lines, "[^#]#(%S+)$")
                  if (FindAdver(adver) == "K") then
                  return 0
                  else
                     SendPmToOps (BotName,"Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in PVT: "..msg)
                     if ADKICK==1 then
                        SendPmToOps (BotName,"User has been kicked for advertising.")
                        curUser:SendPM(BotName,"You were kicked for Advertising!")
                        curUser:TempBan()
                     else
                        curUser:SendPM(BotName,"Advertising Censored. Sorry.")
                     end
                     return 1
                  end
               end
            end
         end
         spam = 0
         if( strfind( strlower(data), "no",1,1) ) and ( strfind( strlower(data), "ip",1,1) ) then
            if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
         spam=spam+1; end; end;
         if( strfind( strlower(data), "my",1,1) ) and ( strfind( strlower(data), "ftp",1,1) ) then
            if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
         spam=spam+1; end; end;
         if( strfind( strlower(data), "dns",1,1) ) and ( strfind( strlower(data), "2",1,1) ) and ( strfind( strlower(data), "go",1,1) ) then
         spam=spam+1; end
         if( strfind( strlower(data), "dy",1,1) ) and ( strfind( strlower(data), "nu",1,1) ) then
            if( strfind( strlower(data), ".net",1,1) ) or ( strfind( strlower(data), ".com",1,1) ) then
         spam=spam+1;end; end
         if( strfind( strlower(data), "d n s a",1,1) ) or ( strfind( strlower(data), "d n s .",1,1) ) or ( strfind( strlower(data), "d n s 2",1,1) ) or ( strfind( strlower(data), "o d s .",1,1) ) or ( strfind( strlower(data), "d y n",1,1) ) then
         spam=spam+1;end
         if spam>0 then
            s,e,msg = strfind(data, "%b<> (.*)")
            SendPmToOps (BotName,"Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in PVT: "..msg)
            if ADKICK==1 then
               SendPmToOps (BotName,"User has been  kicked for advertising.")
               curUser:SendPM(BotName,"You were kicked for Advertising!")
               curUser:TempBan()
            else
               curUser:SendPM(BotName,"Advertising Censored. Sorry.")
            end
            return 1
         end
      end

   end
end


function MainCom(curUser,data)
   data=strsub(data,1,strlen(data)-1)
   local _,_,cmd = strfind(data, "%b<>%s+(%S+)")
   if not cmd then cmd = "0" end
   if (strsub(cmd, 1, 1) ~= Prefix1 and strsub(cmd, 1, 1) ~= Prefix2) then
      return 0
   else
      cmd = strlower(cmd)
      if strlen(cmd) > 1 then
         cmd=strsub(cmd,2,strlen(cmd))
         local SendCom = (Com(curUser,data,cmd))
         if not SendCom then
            return 1
         else
            return SendCom
         end
      end
   end
end

function BotCom(curUser, data)
   data=strsub(data,1,strlen(data)-1)
   _,_,cmd = strfind(data,"$%b<>%s+(%S+)")
   if not cmd then cmd = "0" end
   if (strsub(cmd, 1, 1) ~= Prefix1 and strsub(cmd, 1, 1) ~= Prefix2) then
      return 0
   else
      cmd = strlower(cmd)
      cmd=strsub(cmd,2,strlen(cmd))
      local SendCom = (Com(curUser,data,cmd))
      if not SendCom then
         return 1
      else
         return SendCom
      end
   end
end

function SiteCheck(msg)
   for value,index in SITES do
      if strfind(msg,index) then
         return 1
      end
   end
end

function FindAdver(adver)
   for v2,i2 in OKHUBS do
      if strfind(adver,v2) then
         return "K"
      end
   end
end


function Verify(userdata, msg)
   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 value, key in ADVER do
      if (strfind(Lines, strlower(value), 1, 1)) then
         return Lines
      end
   end
end

function ToKickMsg(curUser, data)
   if strfind(data,"You are being kicked because:") then
      local _,_, Name,Op,Reason = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$<%S+> You are being kicked because:%s+(.*)|")
      OpCheck = GetItemByName(Op)
      if OpCheck~=nil and OpCheck.bOperator then
         vUser = GetItemByName(Name)
         if KicksRegVipOp(vUser,curUser)==0 then
            return 1
         end
         if vUser~=nil then
            SaveKickBanInfo(curUser.sName,vUser.sName,Reason,KickTable,KickFile, "KickTable")
         end
      end
   end
end

end
Title:
Post by: nErBoS on 18 August, 2004, 22:10:24
Hi,

Done...

BotName = "robot"

HubAddress = "hub.no-ip.com"

-- Set On/Off if user should be kicked for advertising / 1:on/0:off
ADKICK = 0

OKHUBS = {
}

ADVER = {
["serveftp"]=1 }

SITES = { "www.","http://","ftp://","irc.","cs." }

tabAdvert = {}
PMCount = {}
MainCount = {}
awayArray = {}
RegTable = {}
UserInfo = {}
TabTimers = {n=0}
KickTable = {}
BanTable = {}
WarnTable = {}
Online = {}
Counter = {}
TopKickers = {}

CmdErrorMsg = "*** Syntax error in command"
CmdErrorPar = " No parameter given."

function Main()

--REG BOTS--------------------------------------------------------------------------------------------------
frmHub:RegBot(BotName)

function SMPM(curUser)
if (MPM==1) then
curUser.SD = function(this,from,text)
this:SendPM(from,text)
end
else
curUser.SD = function(this,from,text)
this:SendData(from,text)
end
end
return curUser
end

function DataArrival(curUser, data)
SMPM(curUser)
if ( strsub(data, 1, 1) == "<" ) then
local _, _, msg = strfind(data, "^%b<>%s+(.*)|")
if not curUser.bOperator then
if SiteCheck(msg)==1 then
return 0
else
if Verify(curUser.sName, msg) then
local Lines = Verify(curUser.sName, msg)
tabAdvert = nil
tabAdvert = {}
local s,e, adver = strfind(Lines, "[^#]#(%S+)$")
if (FindAdver(adver) == "K") then
return 0
else
SendPmToOps (BotName,"Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in main: "..msg)
SendToVips("Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in main: "..msg)
if ADKICK==1 then
SendPmToOps (BotName,"User has been kicked for Advertising.")
SendToVips("User has been kicked for Advertising.")
curUser:SendPM(BotName,"You were kicked for Advertising.")
curUser:TempBan()
else
curUser:SendPM(BotName,"Advertising Censored. Sorry.")
end
return 1
end
end
end
spam = 0
if( strfind( strlower(data), "no",1,1) ) and ( strfind( strlower(data), "ip",1,1) ) then
if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
spam=spam+1; end; end;
if( strfind( strlower(data), "my",1,1) ) and ( strfind( strlower(data), "ftp",1,1) ) then
if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
spam=spam+1; end; end;
if( strfind( strlower(data), "dns",1,1) ) and ( strfind( strlower(data), "2",1,1) ) and ( strfind( strlower(data), "go",1,1) ) then
spam=spam+1; end
if( strfind( strlower(data), "dy",1,1) ) and ( strfind( strlower(data), "nu",1,1) ) then
if( strfind( strlower(data), ".net",1,1) ) or ( strfind( strlower(data), ".com",1,1) ) then
spam=spam+1;end; end
if( strfind( strlower(data), "d n s a",1,1) ) or ( strfind( strlower(data), "d n s .",1,1) ) or ( strfind( strlower(data), "d n s 2",1,1) ) or ( strfind( strlower(data), "o d s .",1,1) ) or ( strfind( strlower(data), "d y n",1,1) ) then
spam=spam+1;end
if spam>0 then
s,e,msg = strfind(data, "%b<> (.*)")
SendPmToOps (BotName,"Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in main: "..msg)
SendToVips("Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in main: "..msg)
if ADKICK==1 then
SendPmToOps (BotName,"User has been kicked for Advertising.")
SendToVips("User has been kicked for Advertising.")
curUser:SendPM(BotName,"You were kicked for Advertising!")
curUser:TempBan()
else
curUser:SendPM(BotName,"Advertising Censored. Sorry.")
end
return 1
end
end
return MainCom(curUser,data)
elseif strsub(data, 1, 4) == "$To: " then
ToKickMsg(curUser, data)
local s,e,to,from,text = strfind(data, "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
if to == BotName then
return BotCom(curUser, data)
else
to = GetItemByName(to)
if not curUser.bOperator then
local _, _, msg = strfind(text, "^%b<>%s+(.*)|")
if SiteCheck(msg)==1 then
return 0
else
if Verify(curUser.sName, msg) then
local Lines = Verify(curUser.sName, msg)
tabAdvert = nil
tabAdvert = {}
local s,e, adver = strfind(Lines, "[^#]#(%S+)$")
if (FindAdver(adver) == "K") then
return 0
else
SendPmToOps (BotName,"Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in PVT: "..msg)
SendToVips("Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in PVT: "..msg)
if ADKICK==1 then
SendPmToOps (BotName,"User has been kicked for advertising.")
SendToVips("User has been kicked for advertising.")
curUser:SendPM(BotName,"You were kicked for Advertising!")
curUser:TempBan()
else
curUser:SendPM(BotName,"Advertising Censored. Sorry.")
end
return 1
end
end
end
end
spam = 0
if( strfind( strlower(data), "no",1,1) ) and ( strfind( strlower(data), "ip",1,1) ) then
if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
spam=spam+1; end; end;
if( strfind( strlower(data), "my",1,1) ) and ( strfind( strlower(data), "ftp",1,1) ) then
if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
spam=spam+1; end; end;
if( strfind( strlower(data), "dns",1,1) ) and ( strfind( strlower(data), "2",1,1) ) and ( strfind( strlower(data), "go",1,1) ) then
spam=spam+1; end
if( strfind( strlower(data), "dy",1,1) ) and ( strfind( strlower(data), "nu",1,1) ) then
if( strfind( strlower(data), ".net",1,1) ) or ( strfind( strlower(data), ".com",1,1) ) then
spam=spam+1;end; end
if( strfind( strlower(data), "d n s a",1,1) ) or ( strfind( strlower(data), "d n s .",1,1) ) or ( strfind( strlower(data), "d n s 2",1,1) ) or ( strfind( strlower(data), "o d s .",1,1) ) or ( strfind( strlower(data), "d y n",1,1) ) then
spam=spam+1;end
if spam>0 then
s,e,msg = strfind(data, "%b<> (.*)")
SendPmToOps (BotName,"Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in PVT: "..msg)
SendToVips("Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in PVT: "..msg)
if ADKICK==1 then
SendPmToOps (BotName,"User has been kicked for advertising.")
SendToVips("User has been kicked for advertising.")
curUser:SendPM(BotName,"You were kicked for Advertising!")
curUser:TempBan()
else
curUser:SendPM(BotName,"Advertising Censored. Sorry.")
end
return 1
end
end

end
end


function MainCom(curUser,data)
data=strsub(data,1,strlen(data)-1)
local _,_,cmd = strfind(data, "%b<>%s+(%S+)")
if not cmd then cmd = "0" end
if (strsub(cmd, 1, 1) ~= Prefix1 and strsub(cmd, 1, 1) ~= Prefix2) then
return 0
else
cmd = strlower(cmd)
if strlen(cmd) > 1 then
cmd=strsub(cmd,2,strlen(cmd))
local SendCom = (Com(curUser,data,cmd))
if not SendCom then
return 1
else
return SendCom
end
end
end
end

function BotCom(curUser, data)
data=strsub(data,1,strlen(data)-1)
_,_,cmd = strfind(data,"$%b<>%s+(%S+)")
if not cmd then cmd = "0" end
if (strsub(cmd, 1, 1) ~= Prefix1 and strsub(cmd, 1, 1) ~= Prefix2) then
return 0
else
cmd = strlower(cmd)
cmd=strsub(cmd,2,strlen(cmd))
local SendCom = (Com(curUser,data,cmd))
if not SendCom then
return 1
else
return SendCom
end
end
end

function SiteCheck(msg)
for value,index in SITES do
if strfind(msg,index) then
return 1
end
end
end

function FindAdver(adver)
for v2,i2 in OKHUBS do
if strfind(adver,v2) then
return "K"
end
end
end


function Verify(userdata, msg)
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 value, key in ADVER do
if (strfind(Lines, strlower(value), 1, 1)) then
return Lines
end
end
end

function ToKickMsg(curUser, data)
if strfind(data,"You are being kicked because:") then
local _,_, Name,Op,Reason = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$<%S+> You are being kicked because:%s+(.*)|")
OpCheck = GetItemByName(Op)
if OpCheck~=nil and OpCheck.bOperator then
vUser = GetItemByName(Name)
if KicksRegVipOp(vUser,curUser)==0 then
return 1
end
if vUser~=nil then
SaveKickBanInfo(curUser.sName,vUser.sName,Reason,KickTable,KickFile, "KickTable")
end
end
end
end

end

function SendToVips(msg)
local usr,aux
for aux, usr in GetUsersByProfile("VIP") do
if (GetItemByName(usr) ~= nil) then
GetItemByName(usr):SendPM(BotName, msg)
end
end
end

Best regards, nErBoS
Title:
Post by: jiten on 19 August, 2004, 10:12:35
thanks Nerbos! it is working well.
well, i have a new request too:

i wanted to combine this antipub with the Seiya's KVIP (the one where you can choose the VIP's that are able to kick). so, the pub report would be sent only to those VIP's that are in the file /logs/svip.txt and not to all of them.

the svip.txt looks like this:

supervip = {["Etler"]=1,}
Title:
Post by: nErBoS on 19 August, 2004, 15:31:24
Hi,

Ok, try out this then...

BotName = "robot"

HubAddress = "hub.no-ip.com"

-- Set On/Off if user should be kicked for advertising / 1:on/0:off
ADKICK = 0

OKHUBS = {
}

ADVER = {
["serveftp"]=1 }

SITES = { "www.","http://","ftp://","irc.","cs." }

tabAdvert = {}
PMCount = {}
MainCount = {}
awayArray = {}
RegTable = {}
UserInfo = {}
TabTimers = {n=0}
KickTable = {}
BanTable = {}
WarnTable = {}
Online = {}
Counter = {}
TopKickers = {}
supervip = {}
fSuperVip = "logs/svip.txt" -- Path of file that contains SuperVips

CmdErrorMsg = "*** Syntax error in command"
CmdErrorPar = " No parameter given."

function Main()

--REG BOTS--------------------------------------------------------------------------------------------------
frmHub:RegBot(BotName)

function SMPM(curUser)
LoadFromFile(fSuperVip)
if (MPM==1) then
curUser.SD = function(this,from,text)
this:SendPM(from,text)
end
else
curUser.SD = function(this,from,text)
this:SendData(from,text)
end
end
return curUser
end

function DataArrival(curUser, data)
SMPM(curUser)
if ( strsub(data, 1, 1) == "<" ) then
local _, _, msg = strfind(data, "^%b<>%s+(.*)|")
if not curUser.bOperator then
if SiteCheck(msg)==1 then
return 0
else
if Verify(curUser.sName, msg) then
local Lines = Verify(curUser.sName, msg)
tabAdvert = nil
tabAdvert = {}
local s,e, adver = strfind(Lines, "[^#]#(%S+)$")
if (FindAdver(adver) == "K") then
return 0
else
SendPmToOps (BotName,"Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in main: "..msg)
SendToVips("Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in main: "..msg)
if ADKICK==1 then
SendPmToOps (BotName,"User has been kicked for Advertising.")
SendToVips("User has been kicked for Advertising.")
curUser:SendPM(BotName,"You were kicked for Advertising.")
curUser:TempBan()
else
curUser:SendPM(BotName,"Advertising Censored. Sorry.")
end
return 1
end
end
end
spam = 0
if( strfind( strlower(data), "no",1,1) ) and ( strfind( strlower(data), "ip",1,1) ) then
if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
spam=spam+1; end; end;
if( strfind( strlower(data), "my",1,1) ) and ( strfind( strlower(data), "ftp",1,1) ) then
if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
spam=spam+1; end; end;
if( strfind( strlower(data), "dns",1,1) ) and ( strfind( strlower(data), "2",1,1) ) and ( strfind( strlower(data), "go",1,1) ) then
spam=spam+1; end
if( strfind( strlower(data), "dy",1,1) ) and ( strfind( strlower(data), "nu",1,1) ) then
if( strfind( strlower(data), ".net",1,1) ) or ( strfind( strlower(data), ".com",1,1) ) then
spam=spam+1;end; end
if( strfind( strlower(data), "d n s a",1,1) ) or ( strfind( strlower(data), "d n s .",1,1) ) or ( strfind( strlower(data), "d n s 2",1,1) ) or ( strfind( strlower(data), "o d s .",1,1) ) or ( strfind( strlower(data), "d y n",1,1) ) then
spam=spam+1;end
if spam>0 then
s,e,msg = strfind(data, "%b<> (.*)")
SendPmToOps (BotName,"Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in main: "..msg)
SendToVips("Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in main: "..msg)
if ADKICK==1 then
SendPmToOps (BotName,"User has been kicked for Advertising.")
SendToVips("User has been kicked for Advertising.")
curUser:SendPM(BotName,"You were kicked for Advertising!")
curUser:TempBan()
else
curUser:SendPM(BotName,"Advertising Censored. Sorry.")
end
return 1
end
end
return MainCom(curUser,data)
elseif strsub(data, 1, 4) == "$To: " then
ToKickMsg(curUser, data)
local s,e,to,from,text = strfind(data, "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
if to == BotName then
return BotCom(curUser, data)
else
to = GetItemByName(to)
if not curUser.bOperator then
local _, _, msg = strfind(text, "^%b<>%s+(.*)|")
if SiteCheck(msg)==1 then
return 0
else
if Verify(curUser.sName, msg) then
local Lines = Verify(curUser.sName, msg)
tabAdvert = nil
tabAdvert = {}
local s,e, adver = strfind(Lines, "[^#]#(%S+)$")
if (FindAdver(adver) == "K") then
return 0
else
SendPmToOps (BotName,"Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in PVT: "..msg)
SendToVips("Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in PVT: "..msg)
if ADKICK==1 then
SendPmToOps (BotName,"User has been kicked for advertising.")
SendToVips("User has been kicked for advertising.")
curUser:SendPM(BotName,"You were kicked for Advertising!")
curUser:TempBan()
else
curUser:SendPM(BotName,"Advertising Censored. Sorry.")
end
return 1
end
end
end
end
spam = 0
if( strfind( strlower(data), "no",1,1) ) and ( strfind( strlower(data), "ip",1,1) ) then
if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
spam=spam+1; end; end;
if( strfind( strlower(data), "my",1,1) ) and ( strfind( strlower(data), "ftp",1,1) ) then
if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
spam=spam+1; end; end;
if( strfind( strlower(data), "dns",1,1) ) and ( strfind( strlower(data), "2",1,1) ) and ( strfind( strlower(data), "go",1,1) ) then
spam=spam+1; end
if( strfind( strlower(data), "dy",1,1) ) and ( strfind( strlower(data), "nu",1,1) ) then
if( strfind( strlower(data), ".net",1,1) ) or ( strfind( strlower(data), ".com",1,1) ) then
spam=spam+1;end; end
if( strfind( strlower(data), "d n s a",1,1) ) or ( strfind( strlower(data), "d n s .",1,1) ) or ( strfind( strlower(data), "d n s 2",1,1) ) or ( strfind( strlower(data), "o d s .",1,1) ) or ( strfind( strlower(data), "d y n",1,1) ) then
spam=spam+1;end
if spam>0 then
s,e,msg = strfind(data, "%b<> (.*)")
SendPmToOps (BotName,"Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in PVT: "..msg)
SendToVips("Report: <"..curUser.sName.."> ("..curUser.sIP..") is advertising in PVT: "..msg)
if ADKICK==1 then
SendPmToOps (BotName,"User has been kicked for advertising.")
SendToVips("User has been kicked for advertising.")
curUser:SendPM(BotName,"You were kicked for Advertising!")
curUser:TempBan()
else
curUser:SendPM(BotName,"Advertising Censored. Sorry.")
end
return 1
end
end

end
end


function MainCom(curUser,data)
data=strsub(data,1,strlen(data)-1)
local _,_,cmd = strfind(data, "%b<>%s+(%S+)")
if not cmd then cmd = "0" end
if (strsub(cmd, 1, 1) ~= Prefix1 and strsub(cmd, 1, 1) ~= Prefix2) then
return 0
else
cmd = strlower(cmd)
if strlen(cmd) > 1 then
cmd=strsub(cmd,2,strlen(cmd))
local SendCom = (Com(curUser,data,cmd))
if not SendCom then
return 1
else
return SendCom
end
end
end
end

function BotCom(curUser, data)
data=strsub(data,1,strlen(data)-1)
_,_,cmd = strfind(data,"$%b<>%s+(%S+)")
if not cmd then cmd = "0" end
if (strsub(cmd, 1, 1) ~= Prefix1 and strsub(cmd, 1, 1) ~= Prefix2) then
return 0
else
cmd = strlower(cmd)
cmd=strsub(cmd,2,strlen(cmd))
local SendCom = (Com(curUser,data,cmd))
if not SendCom then
return 1
else
return SendCom
end
end
end

function SiteCheck(msg)
for value,index in SITES do
if strfind(msg,index) then
return 1
end
end
end

function FindAdver(adver)
for v2,i2 in OKHUBS do
if strfind(adver,v2) then
return "K"
end
end
end


function Verify(userdata, msg)
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 value, key in ADVER do
if (strfind(Lines, strlower(value), 1, 1)) then
return Lines
end
end
end

function ToKickMsg(curUser, data)
if strfind(data,"You are being kicked because:") then
local _,_, Name,Op,Reason = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$<%S+> You are being kicked because:%s+(.*)|")
OpCheck = GetItemByName(Op)
if OpCheck~=nil and OpCheck.bOperator then
vUser = GetItemByName(Name)
if KicksRegVipOp(vUser,curUser)==0 then
return 1
end
if vUser~=nil then
SaveKickBanInfo(curUser.sName,vUser.sName,Reason,KickTable,KickFile, "KickTable")
end
end
end
end

end

function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end

function SendToVips(msg)
local usr,aux
for usr, aux in supervip do
if (GetItemByName(usr) ~= nil) then
GetItemByName(usr):SendPM(BotName, msg)
end
end
end

Best regards, nErBoS
Title:
Post by: jiten on 19 August, 2004, 18:50:13
hi there.
the last request about reports to specific vips doesn't work. it doesn't even send it to all vips like the first one does.
can you check it again nerbos?
thanks for the help man.
Title:
Post by: nErBoS on 19 August, 2004, 18:54:05
Hi,

Little bug in the path name, i have fixed the script above.

Best regards, nErBoS
Title:
Post by: jiten on 19 August, 2004, 19:08:06
now it works 100%.
thanks! you're the man!
Title:
Post by: jiten on 22 October, 2004, 10:51:34
Hi there.
Well, I've two requests for this script.

1. That after x kicks the user would be banned;
2. That all the VIP kicks would be logged in txt/kick.log in the Robocop 9b pattern. Example:

KickLog = {
   ["Mario"] = "10/22/2004 10:49:19 User Mario (127.0.0.1) kicked 1 time(s) by VIP Paulo - Reason: No reason given!",
}

Thanks in advance,

jiten
Title:
Post by: jiten on 24 October, 2004, 19:07:46
anyone?
Title:
Post by: nErBoS on 31 October, 2004, 17:39:07
Hi,

The first request can be made, but about the second one i don't see any commad to the VIP user kick, or you want to log the kicks made by this script ???

Best regards, nErBoS
Title:
Post by: jiten on 01 November, 2004, 09:55:51
Hi there.
Yes, I wanted to log all the kicks made by this script in the Robocop 9b pattern. In fact, all the disconnects made by the K-VIP's to the users with lower profile.
Thanks in advance.

Regards,

jiten
Title:
Post by: NightLitch on 01 November, 2004, 12:26:54
I don't want so sound mean but, Almost every line on your script Jiten is from NXS-3, I would appriciate my name being mentioned in the -- Comment Info.

No hard feelings / NightLitch
Title:
Post by: nErBoS on 01 November, 2004, 18:31:48
Hi,

When i said to log the kicks of the script, i ment that the kick is made by the BOT not by a VIP. About the NL post i am 100% accord.

Best regards, nErBoS
Title:
Post by: jiten on 01 November, 2004, 19:29:51
My bad, NL. I forgot to comment. Sorry about that. It's done now.

About this script, well, the kicks are done by the BOT.

Regards,

jiten
Title:
Post by: nErBoS on 02 November, 2004, 02:42:34
Hi,

OK then, so it doesn't matter to save in the kick log with the BOTNAME as kicker ??

Best regards, nErBoS
Title:
Post by: jiten on 02 November, 2004, 08:52:14
Well, i'm going to try to explain it again.
I wanted to log all the disconnects done by the K-Vips through this script, so that when using the !showkicklog command of Robocop 9b, I'd get them shown there. Just like an addition.

The log would have to show who was disconnected by whom (not the BOTNAME). The log file should look like this:

KickLog = {
["fluke1"] = "10/25/2004 20:29:51 User fluke1 (196.46.10.82) kicked 1 time(s) by K-VIP [_Method_K!d_] - Reason: Muda A Description",

}

Regards,

jiten
Title:
Post by: nErBoS on 02 November, 2004, 14:25:16
Hi,

So we get back to the same, the script doesn't have any command, all disconnects and kicks of this script is made by the BOT, not by an user.

Best regards, nErBoS
Title:
Post by: jiten on 02 November, 2004, 17:25:53
I made a mistake in the thread to post.
In fact, those 2 requests were for Seiya's K-VIP script --> here (http://board.univ-angers.fr/thread.php?threadid=2278&boardid=15&sid=798edb2cf3293000811279c7864adfce&page=1)

That's why it didn't make sense. Sorry about that.

Regards,

jiten
Title:
Post by: nErBoS on 02 November, 2004, 23:58:08
Hi,

I have been taking a look at the script and remenber that i can't work with the kicklog of RoboCop, because every time RoboCop saves the info, will overwrite the info added by the KVip, so i can only make the ban thing, ok ??

Best regards, nErBoS
Title:
Post by: jiten on 03 November, 2004, 08:46:50
Well, if that isn't possible, can the kicks be logged in a different file like logs/vkick.log and and accessed by a command like !vkicklog?

Thanks in advance.

Regards,

jiten
Title:
Post by: nErBoS on 03 November, 2004, 13:26:57
Hi,

I see different scripts in the topic, you want me to modifiy the plop script or seya script ??

Best regards, nErBoS
Title:
Post by: jiten on 03 November, 2004, 14:23:22
I would like you to modify Seiya's one.

Best regards,

jiten
Title:
Post by: nErBoS on 04 November, 2004, 01:59:46
Hi,

Try out this one then...

-- K-VIP by Seiya
-- Version 1.0
-- add kick to the VIP you want
-- without creating a new profile
-- Added by request a kick log and its command !vkicklog (made by nErBoS)
-- Added by request a Ban to a x amout of Kicks (made by nErBoS)

sBot = "@Dohko"

savevipkick = "logs/svip.txt" -- you have to create a svip.txt file ine the ptokax\scripts\logs directory
fVipLog = "viplog.dat"
arrVipLog = {}
iBan = 4 -- Times of Kick equal to a ban
supervip = {}

function Main()
LoadFromFile(fVipLog)
end

function dosavesupervip(user,data)
writeto(savevipkick) ;
write("supervip = {");
for a,b in supervip do
if b then
write(format("[%q]=",a)..b..",");
end
end
write("}" );
writeto();
end

function DataArrival (user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd,Name = strfind( data, "%b<>%s+(%S+)%s+(%S+)" )
victim = GetItemByName(Name)
if cmd == "!vipkick" then
if victim.iProfile == 2 then
if supervip[victim.sName] == nil then
supervip[victim.sName] = 1
dosavesupervip()
SendPmToOps(sBot,"The Op "..user.sName.." give the K-VIP status to"..victim.sName)
victim:SendPM(sBot,"congratulations, You've been upgrated to K-VIP. Just have a look at your right click for kick command")
else
supervip[victim.sName] = supervip[victim.sName] + 1
dosavesupervip()
SendPmToOps(sBot,"The Op "..user.sName.." give the K-VIP status to"..victim.sName)
victim:SendPM(sBot,"congratulations, You've been upgrated to K-VIP. Just have a look at your right click for kick command")
end
else
user:SendData(sBot,"The user "..victim.sName.." isn't a VIP yet. It can't be upgrated to K-VIP")
end
return 1
elseif cmd == "!vipunkick" then
if victim.iProfile == 2 then
if supervip[victim.sName] ~= 0 then
supervip[victim.sName] = 0
dosavesupervip()
SendPmToOps(sBot,"The Op "..user.sName.." has just revoked "..victim.sName.." from k-VIP")
victim:SendPM(sBot,"You've been revoked from K-VIP")
end
else
user:SendData(sBot,"The user "..victim.sName.." isn't a K-VIP.")
end
return 1
end
s,e,cmd,Name,reason = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s*(.*)" )
victim = GetItemByName(Name)
if cmd == "!kik" then
if supervip[user.sName] ~= 0 then
if victim.iProfile == -1 or victim.iProfile == 3 then
SendToAll(sBot,"The K-VIP "..user.sName.." kick "..victim.sName.." - reason : "..reason)
victim:SendPM(Sbot,"You've been kicked by the K-VIP "..user.sName.." - reason : "..reason)
if (arrVipLog[victim.sName] == nil) then
arrVipLog[victim.sName] = {}
arrVipLog[victim.sName]["KICK"] = "The K-VIP "..user.sName.." kick "..victim.sName.." - reason : "..reason
arrVipLog[victim.sName]["TIMES"] = 1
else
arrVipLog[victim.sName]["TIMES"] = arrVipLog[victim.sName][TIMES] + 1
arrVipLog[victim.sName]["KICK"] = "The K-VIP "..user.sName.." kick "..victim.sName.." - reason : "..reason
end
if (arrVipLog[victim.sName]["TIMES"] > iBan) then
victim:SendPM(Sbot,"You have been kicked "..iBan.." times. You are being banned.")
victim:Ban()
else
victim:TempBan()
victim:Disconnect()
end
SaveToFile(fVipLog , arrVipLog , "arrVipLog")
else
user:SendData(sBot,"You can't kick an OP or VIP")
end
else
user:SendData(sBot,"You're not allowed to use this command")
end
return 1
end
s,e,cmd = strfind( data, "%b<>%s+(%S+)")
if (cmd == "!vkicklog" and user.bOperator) then
local sTmp,victim,table = "The Kicks Log made by Vips:\r\n\r\n"
for victim, table in arrVipLog do
sTmp = sTmp.."Victim: "..victim.." ## Kick: "..table["KICK"].." ## Kicked: "..table["TIMES"].."\r\n"
end
user:SendPM(sBot, sTmp)
return 1
end
end
end


function NewUserConnected(user,data)
if supervip[user.sName] ~= 0 then
user:SendData("$UserCommand 1 2 K-VIP\\Kick$<%[mynick]> !kik %[nick] %[line:Motif du kick]||")
end
end

function OpConnected(user,data)
if user.iProfile == 0 or user.iProfile == 4 then
user:SendData("$UserCommand 1 2 Master commandes\\K-VIP\\Add K-VIP$<%[mynick]> !vipkick %[nick]||")
user:SendData("$UserCommand 1 2 Master commandes\\K-VIP\\Del K-VIP$<%[mynick]> !vipunkick %[nick]||")
end
end

function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");

assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");

sTab = sTab or "";
sTmp = ""

sTmp = sTmp..sTab..sTableName.." = {\n"

for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

if(type(value) == "table") then
sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end

sTmp = sTmp..",\n"
end

sTmp = sTmp..sTab.."}"
return sTmp
end

function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end

function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end

If it works OK post it in the KVip topic please.

Best regards, nErBoS
Title: Error
Post by: jiten on 04 November, 2004, 08:51:17
Well, when I try to kick for the 2nd time i get this error:

Syntax error: table index is nil
stack traceback:
   1:  function `DataArrival' at line 79 [file `...Desktop\robo9b\scripts\seiya.lua']


By the way, the script that I would like you to modify was the latest KVIP from Seiya's, version 1.6. This one is the first one, with some bugs.

Thanks in advance.

jiten
Title:
Post by: nErBoS on 05 November, 2004, 01:19:16
Hi,

Changed to the version wanted...

-- K-VIP by Seiya
-- Version 1.6
-- add kick to the VIP you want
-- without creating a new profile
-- fix bug : all vip have the command
-- fix bug : Kvip which is degrated can't use anymore the kik command
-- fix bug : load (don't laugh) the svip.txt file when starting the script
-- fix bug : VIP can't add/revoke VIP to/from K-VIP anymore
-- add the userinfo command
-- Added by request a kick log and its command !vkicklog (made by nErBoS)
-- Added by request a Ban to a x amout of Kicks (made by nErBoS)


sBot = "@Dohko"

savevipkick = "logs/svip.txt" -- you have to create a svip.txt file ine the ptokax\scripts\logs directory
supervip = {}
fVipLog = "viplog.dat"
arrVipLog = {}
iBan = 4 -- Times of Kick equal to a ban

function Main()
loadfile(savevipkick)
LoadFromFile(fVipLog)
end

function dosavesupervip(user,data)
writeto(savevipkick) ;
write("supervip = {");
for a,b in supervip do
if b then
write(format("[%q]=",a)..b..",");
end
end
write("}" );
writeto();
end


function DataArrival (user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd,Name = strfind( data, "%b<>%s+(%S+)%s+(%S+)" )
victim = GetItemByName(Name)
if cmd == "!vipkick" and ((user.iProfile == 0) or (user.iProfile == 4)) then
if victim.iProfile == 2 then
if supervip[victim.sName] == nil then
supervip[victim.sName] = 1
dosavesupervip()
SendPmToOps(sBot,"The Op "..user.sName.." give the K-VIP status to"..victim.sName)
victim:SendPM(sBot,"congratulations, You've been upgrated to K-VIP. Just have a look at your right click for kick command")
else
supervip[victim.sName] = supervip[victim.sName] + 1
dosavesupervip()
SendPmToOps(sBot,"The Op "..user.sName.." give the K-VIP status to "..victim.sName)
victim:SendPM(sBot,"congratulations, You've been upgrated to K-VIP. Just reconnect to have the kick command in your right click")
end
else
user:SendData(sBot,"The user "..victim.sName.." isn't a VIP yet. It can't be upgrated to K-VIP")
end
return 1
elseif cmd == "!vipunkick" and ((user.iProfile == 0) or (user.iProfile == 4)) then
if victim.iProfile == 2 then
if supervip[victim.sName] ~= 0 then
supervip[victim.sName] = 0
dosavesupervip()
SendPmToOps(sBot,"The Op "..user.sName.." has just revoked "..victim.sName.." from k-VIP")
victim:SendPM(sBot,"You've been revoked from K-VIP")
end
else
user:SendData(sBot,"The user "..victim.sName.." isn't a K-VIP.")
end
return 1
elseif cmd == "!inf" then
if ((user.iProfile == 2) and (supervip[user.sName] == 1)) or (user.iProfile == 0) or (user.iProfile == 4) then
UserInfo(user,data)
else
user:SendData(sBot,"You're not allowed to use this command")
end
return 1
end
s,e,cmd,Name,reason = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s*(.*)" )
victim = GetItemByName(Name)
if cmd == "!kik" then
if (supervip[user.sName] == 1) and (user.iProfile == 2) then
if victim.iProfile == -1 or victim.iProfile == 3 then
SendToAll(sBot,"The K-VIP "..user.sName.." kick "..victim.sName.." - reason : "..reason)
victim:SendPM(Sbot,"You've been kicked by the K-VIP "..user.sName.." - reason : "..reason)
if (arrVipLog[victim.sName] == nil) then
arrVipLog[victim.sName] = {}
arrVipLog[victim.sName]["KICK"] = "The K-VIP "..user.sName.." kick "..victim.sName.." - reason : "..reason
arrVipLog[victim.sName]["TIMES"] = 1
else
arrVipLog[victim.sName]["TIMES"] = arrVipLog[victim.sName]["TIMES"] + 1
arrVipLog[victim.sName]["KICK"] = "The K-VIP "..user.sName.." kick "..victim.sName.." - reason : "..reason
end
if (arrVipLog[victim.sName]["TIMES"] > iBan) then
victim:SendPM(Sbot,"You have been kicked "..iBan.." times. You are being banned.")
arrVipLog[victim.sName]["TIMES"] = 0
victim:Ban()
else
victim:TempBan()
victim:Disconnect()
end
SaveToFile(fVipLog , arrVipLog , "arrVipLog")
else
user:SendData(sBot,"You can't kick an OP or VIP")
end
else
user:SendData(sBot,"You're not allowed to use this command")
end
return 1
end
s,e,cmd = strfind( data, "%b<>%s+(%S+)")
if (cmd == "!vkicklog" and user.bOperator) then
local sTmp,victim,table = "The Kicks Log made by Vips:\r\n\r\n"
for victim, table in arrVipLog do
sTmp = sTmp.."Victim: "..victim.." ## Kick: "..table["KICK"].." ## Kicked: "..table["TIMES"].."\r\n"
end
user:SendPM(sBot, sTmp)
return 1
end
end
end

function NewUserConnected(user,data)
if (supervip[user.sName] == 0) or (supervip[user.sName] == nil) then
else
if user.iProfile == 2 then
user:SendData("$UserCommand 1 2 K-VIP\\Kick$<%[mynick]> !kik %[nick] %[line:Motif du kick]||")
user:SendData("$UserCommand 1 2 K-VIP\\UserInfo$<%[mynick]> !inf %[nick]||")
end
end
end

function OpConnected(user,data)
if user.iProfile == 0 or user.iProfile == 4 then
user:SendData("$UserCommand 1 2 Master commands\\K-VIP\\Add K-VIP$<%[mynick]> !vipkick %[nick]||")
user:SendData("$UserCommand 1 2 Master commands\\K-VIP\\Del K-VIP$<%[mynick]> !vipunkick %[nick]||")
user:SendData("$UserCommand 1 2 Master commands\\K-VIP\\UserInfo$<%[mynick]> !inf %[nick]||")
end
end

function loadfile (savevipkick)
assert(readfrom(savevipkick))
dostring(read("*all"))
readfrom()
end

function UserInfo(user, data)
s,e,cmd,who = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s*")
local usr = GetItemByName(who)
if usr == nil then
return 1
end
if usr.iProfile == 4 then
profile = "Admin"
elseif usr.iProfile == -1 then
profile = "User"
elseif usr.iProfile == 0 then
profile = "Master"
elseif usr.iProfile == 1 then
profile = "Operator"
elseif usr.iProfile == 2 and supervip[usr.sName] == 0 then
profile = "VIP"
elseif usr.iProfile == 2 and supervip[usr.sName] == 1 then
profile = "K-VIP"
elseif usr.iProfile == 3 then
profile = "Reg"
else
profile = "Unknown"
end


user:SendPM(sBot, "? Name: "..who.." |")
user:SendPM(sBot, "? Profile: "..profile.." |")
user:SendPM(sBot, "? IP: "..usr.sIP.." |")

_,b, dcver = strfind(usr.sMyInfoString,"V:(%x+.%x+)")
if (strfind(usr.sMyInfoString,"_,b, dcgui = strfind(usr.sMyInfoString,"V:(%x+.%x+.%x+)")
clienttype = "DCGUI"
version = dcgui
elseif (strfind(usr.sMyInfoString,"_,b, nm201 = strfind(usr.sMyInfoString,"V:(%x+.%x+)")
clienttype = "Neo-Modus"
version = nm201
elseif (strfind(usr.sMyInfoString,"<+")) then
if strfind(usr.sMyInfoString,"clienttype = "oDC"
version = dcver
elseif strfind(usr.sMyInfoString,"V:0.%x+%a") then
clienttype = "czDC++"
version = dcver
elseif strfind(usr.sMyInfoString,"L:") or strfind(usr.sMyInfoString,"B:") then
clienttype = "BCDC++"
version = dcver
elseif (strfind(usr.sMyInfoString,"<++")) then
clienttype = "DC++"
version = dcver
end
else
user:SendPM(sBot, "? NMDC1 or BlackDC")
return 1
end

if version == nil then user:SendPM(sBot, "? NMDC1 or BlackDC") return 1 end

user:SendPM(sBot, "? Client: "..clienttype.." v"..version)
-- active or pasive
if strfind(usr.sMyInfoString,"M:A") then
mode = "active"
user:SendPM(sBot, "? Mode: "..mode)
elseif strfind(usr.sMyInfoString,"M:P") then
mode = "pasive"
user:SendPM(sBot, "? Mode: "..mode)
end
-- slot info
_,b, slots = strfind(usr.sMyInfoString,"S:(%x+)")
if slots ~= nil then
user:SendPM(sBot, "? "..slots.." - Slot(s) |")
end
-- hub info
_,b, guest = strfind(usr.sMyInfoString,"H:(%x+)/")
if guest == nil then
_,b, hubs = strfind(usr.sMyInfoString,"H:(%x+)")
if hubs ~= nil then
user:SendPM(sBot, "? "..hubs.." - Hub(s) |")
end
else
_,b, opped = strfind(usr.sMyInfoString,"H:%x+/%x+/(%x+)")
_,b, regged = strfind(usr.sMyInfoString,"H:%x+/(%x+)/")
if regged ~= nil then
user:SendPM(sBot, "? "..guest.." - Hub(s) as user |")
user:SendPM(sBot, "? "..regged.." - Hub(s) as VIP |")
user:SendPM(sBot, "? "..opped.." - Hub(s) as Op |")
end
end

end

function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");

assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");

sTab = sTab or "";
sTmp = ""

sTmp = sTmp..sTab..sTableName.." = {\n"

for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

if(type(value) == "table") then
sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end

sTmp = sTmp..",\n"
end

sTmp = sTmp..sTab.."}"
return sTmp
end

function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end

function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end

Best regards, nErBoS
Title: Error
Post by: jiten on 05 November, 2004, 09:26:49
Thanks for the update, nErBoS.
Well, the K-VIP log works fine, but, when I try to kick for the second time, I always get the same error, so, not being able to kick. This is the error:

Syntax error: table index is nil
stack traceback:
1: function `DataArrival' at line 94 [file `...Desktop\robo9b\scripts\seiya.lua']

Best regards,

jiten
Title:
Post by: nErBoS on 06 November, 2004, 20:26:25
Hi,

I have fixed, try it please.

Best regards, nErBoS
Title:
Post by: jiten on 07 November, 2004, 12:17:59
Thanks! The script is working perfectly.

Well, there's just one small and last request.
Is it possible to reset the Kick TIMES after a certain period?
It's that after removing the ban to that user, any kicks made after that, result in a ban, because TIMES > iBan.

Thanks in advance.

Best regards,

jiten
Title:
Post by: nErBoS on 07 November, 2004, 18:25:49
Hi,

So you want to reset the kick count when the person is banned, right ???

Best regards, nErBoS
Title:
Post by: jiten on 07 November, 2004, 19:32:00
Yups!
Title:
Post by: nErBoS on 08 November, 2004, 01:14:31
Hi,

I have edited the script above.

Best regards, nErBoS