PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: witch on 14 September, 2004, 09:25:59

Title: illegalist1_by_nerbos.lua
Post by: witch on 14 September, 2004, 09:25:59
Hi there!
I using very nice script of Nerbos, but time to time i've that error:

Syntax error: attempt to concat local `path' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 171 [file `D:\PtokaX\NEW\scripts\illegalist1_by_nerbos.lua']

Here the code:
__________________________________________________________________________________________
-- Simple Illegalist v0.1
-- Created by Ptaczek, Jan-3, 2003
-- Searches for specified patterns. Useful for illegal share checking
-- some changes by Skippy and RabidWombat and OpiumVolage and trucker
-- add tables warn and kick by nErBoS

BotName = "...::TripBot::..."

function Main()
--frmHub:RegBot(BotName)
frmHub:EnableSearchData(1)
end

Files = {
["childsex"]="NO sick Porn inhere!",
["childporn"]="NO sick kid Porn inhere!",
["underage"]="NO sick kid Porn inhere!",
["animalsex"]="NO Animalsex files here!",
["svastika"]="NO Nazi/white power music HERE!!!",
[".temp.mp3"]="NO sharing of incomplete Audiogalaxy downloads",
["_INCOMPLETE_"]="NO sharing of incomplete WinMX downloads",
["INCOMPLETE~"]="NO sharing of incomplete Soulseek downloads",
[".GETRIGHT"]="NO sharing of incomplete GetitRight downloads",
["install.log"]="NO sharing of installed games, programs, wav, vob, dll, sys etc. files",
["download123456789.dat"]="NO sharing of incomplete Kazza downloads",
["part.met"]="NO sharing of incomplete eDonky downloads",
[".getright"]="NO sharing of incomplete downloads",
["share faker"]="NO tools for fake sharing allowed",
["share hacker"]="No tools for fake sharing allowed",
["Hacking"]="NO tools for hacking allowed"}

warn = {}
kick = {}
usersimune = {
"[???][NL]GePe",
"[???][NL]Hasjmann",
"[???][NL]-Luke",
"[???][NL]redwitch",
"[???][UK]John",
"[???][NL]ZeroX]",
"[???][NL]WizzCat",
"[???]-=Akela=-",
"[???]AiR",
"[???]Bull??T??????",
"[???]Dennis",
"[???]Geroni",
"[???]HsH",
"[???]plop",
"[???]Queeny",
"[???]three80",
"[???]T?M??r?V?ll?R",
"(NL)Janto",
"[NL]Coco",
"[NL]cpu_point",
"[NL]Dark_bad_girl",
"[NL]DiGARiX",
"[NL]Donna[eric]",
"[NL]fuego_gt",
"[NL]itsmeleo",
"[NL]janeb",
"[NL]jobsoft",
"[NL]Mazda626",
"[NL]movieman",
"[NL]Raymond",
"[NL]Spikey",
"[NL]SuusTweety",
"[NL]voodoo",
"[TGA]G-DIGGA",
"[UKD]jiorgee",
"DoJiN",
"hhps",
"iLluSiOn",
"kepp2",
"KoReNWoLF",
"MisteryT",
"Quaraf",
"Serima",
"speedman[psv]",
"TeQuilla",
"TheWickedRabbit",
"TiMeTrAVelleR",} -- Usres you want to not be checked

kicklog = "kicks.txt" -- In script folder
main = "Active" --- write Deactive and will not send the kicks and bans to the main


function NewUserConnected(user)
if (warn[user.sName] == nil or warn[user.sName] == 4) then
warn[user.sName] = 0
end
if (kick[user.sName] == nil or kick[user.sName] == 4) then
kick[user.sName] = 0
end

for i,v in Files do
user:SendData("$Search Hub:"..BotName.." F?F?0?1?"..i)
end
end

function DataArrival(user, data)
 
if( strsub(data, 1, 3) == "$SR" ) then
_,_,nick = strfind( data, "\05(%S*)|$" )
local s,e,path = strfind(data, "$SR%s+%S+%s+(.+)%x+%s+%x+/%x+")
if( nick == BotName) then
   for i=1,getn(usersimune) do
   if (user.bOperator or user.sName == usersimune) then
   return 1
   end
   end
   if (GetProfileName(user.iProfile) == "VIP") then
      if (kick[user.sName] == 3) then
         ClearNill(user)
         kick[user.sName] = kick[user.sName] + 1
         Reason = FindWhat(data)
         SendPmToNick("[NL]trucker", BotName, "*** User "..user.sName.." got ban. Reason: "..Reason.." FILE: "..path)
         user:SendPM(BotName,"You have been banned. "..Reason)
         if (main == "Active" ) then
            SendToAll(BotName, "The user "..user.sName.." is been banned for "..Reason)
         end
         if (main == "Deactive") then
            return 1
         end
         user:Ban()
      elseif (warn[user.sName] == 3 or kick[user.sName] == 1 or kick[user.sName] == 2) then
         ClearNill(user)
         warn[user.sName] = warn[user.sName] + 1
         kick[user.sName] = kick[user.sName] + 1
         Reason = FindWhat(data)
         SendPmToNick("[NL]trucker", BotName, "*** User "..user.sName.." got "..kick[user.sName].." kicks. Reason: "..Reason.." FILE: "..path)
         user:SendPM(BotName,"You have been kicked "..kick[user.sName].." time(s) at 3 you will be ban. "..Reason.." FILE: "..path)
         appendto(kicklog)
         write("\r\n"..user.sName.."|"..Reason.."|"..path.."|"..kick[user.sName].."|"..GetTime())
         writeto()
         if (main == "Active" ) then
            SendToAll(BotName, "The user "..user.sName.." is been kicked for "..Reason)
         end
         if (main == "Deactive") then
            return 1
         end
         user:TempBan()
      elseif (warn[user.sName] == 0 or warn[user.sName] == 1 or warn[user.sName] == 2) then
         ClearNill(user)
         warn[user.sName] = warn[user.sName] + 1
         Reason = FindWhat(data)
         SendPmToNick("[NL]trucker", BotName, "*** User "..user.sName.." got "..warn[user.sName].." warns. Reason: "..Reason.." FILE: "..path)
         user:SendPM(BotName, "You have been warned "..warn[user.sName].." time(s) at 3 you will be kicked. "..Reason.." FILE: "..path)
         user:SendPM(BotName, "You can come back when you have corrected the problem")
         user:SendPM(BotName, "Disconnected...")
         user:Disconnect()
      end
   elseif not(user.bOperator and GetProfileName(user.iProfile) == "VIP" and user.sName == usersimune) then --this will solve the double log i think
      if (kick[user.sName] == 3) then
         ClearNill(user)
         kick[user.sName] = kick[user.sName] + 1
         Reason = FindWhat(data)
         SendPmToNick("[NL]trucker", BotName, "*** User "..user.sName.." got ban. Reason: "..Reason.." FILE: "..path)
         user:SendPM(BotName,"You have been banned. "..Reason)
         if (main == "Active" ) then
            SendToAll(BotName, "The user "..user.sName.." is been banned for "..Reason)
         end
         if (main == "Deactive") then
            return 1
         end
         user:Ban()
      elseif (kick[user.sName] == 0 or kick[user.sName] == 1 or kick[user.sName] == 2) then
         ClearNill(user)
         kick[user.sName] = kick[user.sName] + 1
         user:SendData(Bot, kick[user.sName])
         Reason = FindWhat(data)
         SendPmToNick("[NL]trucker", BotName, "*** User "..user.sName.." got "..kick[user.sName].." kicks. Reason: "..Reason.." FILE: "..path)
         user:SendPM(BotName,"You have been kicked "..kick[user.sName].." time(s) at 3 you will be ban. "..Reason.." FILE: "..path)
         appendto(kicklog)
         write("\r\n"..user.sName.."|"..Reason.."|"..path.."|"..kick[user.sName].."|"..GetTime())
         writeto()
         if (main == "Active" ) then
            SendToAll(BotName, "The user "..user.sName.." is been kicked for "..Reason)
         end
         if (main == "Deactive") then
            return 1
         end
         user:TempBan()
      end
   end
end
end
end

function FindWhat(data)
for i,v in Files do
if( strfind(strlower(data), i) ) then
return v
end
end
return "Other files"
end  

function GetTime()
   s = date("%S")
   h = date("%H")
   m = date("%M")
   d = date("%d")
   mm = date("%m")
   y = date("%y")
   Date = "Day: "..d.."/"..mm.."/20"..y.." Hour: "..h..":"..m..":"..s
   return Date

end

function ClearNill(user)
   if (warn[user.sName] == nil) then
      warn[user.sName] = 0
   end
   if (kick[user.sName] == nil) then
      kick[user.sName] = 0
   end
end
__________________________________________________________________________________________

Thanx in advince !
Title:
Post by: bastya_elvtars on 14 September, 2004, 10:46:05
IMHO you should not use the script at all. USe ADLSearch from DCDM.

Second, post it monospaced, as a CODE. The i will edit it for ya.
Title:
Post by: nErBoS on 14 September, 2004, 23:52:00
Hi,

Fixed i hope...

--## Simple Welcomer Bot
--## Requested by stuCkwe
--## Made by nErBoS

-- Simple Illegalist v0.1
-- Created by Ptaczek, Jan-3, 2003
-- Searches for specified patterns. Useful for illegal share checking
-- some changes by Skippy and RabidWombat and OpiumVolage and trucker
-- add tables warn and kick by nErBoS

BotName = "...::TripBot::..."

function Main()
--frmHub:RegBot(BotName)
frmHub:EnableSearchData(1)
end

Files = {
["childsex"]="NO sick Porn inhere!",
["childporn"]="NO sick kid Porn inhere!",
["underage"]="NO sick kid Porn inhere!",
["animalsex"]="NO Animalsex files here!",
["svastika"]="NO Nazi/white power music HERE!!!",
[".temp.mp3"]="NO sharing of incomplete Audiogalaxy downloads",
["_INCOMPLETE_"]="NO sharing of incomplete WinMX downloads",
["INCOMPLETE~"]="NO sharing of incomplete Soulseek downloads",
[".GETRIGHT"]="NO sharing of incomplete GetitRight downloads",
["install.log"]="NO sharing of installed games, programs, wav, vob, dll, sys etc. files",
["download123456789.dat"]="NO sharing of incomplete Kazza downloads",
["part.met"]="NO sharing of incomplete eDonky downloads",
[".getright"]="NO sharing of incomplete downloads",
["share faker"]="NO tools for fake sharing allowed",
["share hacker"]="No tools for fake sharing allowed",
["Hacking"]="NO tools for hacking allowed"}

warn = {}
kick = {}
usersimune = {
"[???][NL]GePe",
"[???][NL]Hasjmann",
"[???][NL]-Luke",
"[???][NL]redwitch",
"[???][UK]John",
"[???][NL]ZeroX]",
"[???][NL]WizzCat",
"[???]-=Akela=-",
"[???]AiR",
"[???]Bull??T??????",
"[???]Dennis",
"[???]Geroni",
"[???]HsH",
"[???]plop",
"[???]Queeny",
"[???]three80",
"[???]T?M??r?V?ll?R",
"(NL)Janto",
"[NL]Coco",
"[NL]cpu_point",
"[NL]Dark_bad_girl",
"[NL]DiGARiX",
"[NL]Donna[eric]",
"[NL]fuego_gt",
"[NL]itsmeleo",
"[NL]janeb",
"[NL]jobsoft",
"[NL]Mazda626",
"[NL]movieman",
"[NL]Raymond",
"[NL]Spikey",
"[NL]SuusTweety",
"[NL]voodoo",
"[TGA]G-DIGGA",
"[UKD]jiorgee",
"DoJiN",
"hhps",
"iLluSiOn",
"kepp2",
"KoReNWoLF",
"MisteryT",
"Quaraf",
"Serima",
"speedman[psv]",
"TeQuilla",
"TheWickedRabbit",
"TiMeTrAVelleR",} -- Usres you want to not be checked

kicklog = "kicks.txt" -- In script folder
main = "Active" --- write Deactive and will not send the kicks and bans to the main


function NewUserConnected(user)
if (warn[user.sName] == nil or warn[user.sName] == 4) then
warn[user.sName] = 0
end
if (kick[user.sName] == nil or kick[user.sName] == 4) then
kick[user.sName] = 0
end

for i,v in Files do
user:SendData("$Search Hub:"..BotName.." F?F?0?1?"..i)
end
end

function DataArrival(user, data)
if( strsub(data, 1, 3) == "$SR" ) then
_,_,nick = strfind( data, "\05(%S*)|$" )
local s,e,path = strfind(data, "$SR%s+%S+%s+(.+)%x+%s+%x+/%x+")
if( nick == BotName and path ~= nil) then
for i=1,getn(usersimune) do
if (user.bOperator or user.sName == usersimune[i]) then
return 1
end
end
if (GetProfileName(user.iProfile) == "VIP") then
if (kick[user.sName] == 3) then
ClearNill(user)
kick[user.sName] = kick[user.sName] + 1
Reason = FindWhat(data)
SendPmToNick("[NL]trucker", BotName, "*** User "..user.sName.." got ban. Reason: "..Reason.." FILE: "..path)
user:SendPM(BotName,"You have been banned. "..Reason)
if (main == "Active" ) then
SendToAll(BotName, "The user "..user.sName.." is been banned for "..Reason)
end
if (main == "Deactive") then
return 1
end
user:Ban()
elseif (warn[user.sName] == 3 or kick[user.sName] == 1 or kick[user.sName] == 2) then
ClearNill(user)
warn[user.sName] = warn[user.sName] + 1
kick[user.sName] = kick[user.sName] + 1
Reason = FindWhat(data)
SendPmToNick("[NL]trucker", BotName, "*** User "..user.sName.." got "..kick[user.sName].." kicks. Reason: "..Reason.." FILE: "..path)
user:SendPM(BotName,"You have been kicked "..kick[user.sName].." time(s) at 3 you will be ban. "..Reason.." FILE: "..path)
appendto(kicklog)
write("\r\n"..user.sName.."|"..Reason.."|"..path.."|"..kick[user.sName].."|"..GetTime())
writeto()
if (main == "Active" ) then
SendToAll(BotName, "The user "..user.sName.." is been kicked for "..Reason)
end
if (main == "Deactive") then
return 1
end
user:TempBan()
elseif (warn[user.sName] == 0 or warn[user.sName] == 1 or warn[user.sName] == 2) then
ClearNill(user)
warn[user.sName] = warn[user.sName] + 1
Reason = FindWhat(data)
SendPmToNick("[NL]trucker", BotName, "*** User "..user.sName.." got "..warn[user.sName].." warns. Reason: "..Reason.." FILE: "..path)
user:SendPM(BotName, "You have been warned "..warn[user.sName].." time(s) at 3 you will be kicked. "..Reason.." FILE: "..path)
user:SendPM(BotName, "You can come back when you have corrected the problem")
user:SendPM(BotName, "Disconnected...")
user:Disconnect()
end
elseif not(user.bOperator and GetProfileName(user.iProfile) == "VIP" and user.sName == usersimune[i]) then --this will solve the double log i think
if (kick[user.sName] == 3) then
ClearNill(user)
kick[user.sName] = kick[user.sName] + 1
Reason = FindWhat(data)
SendPmToNick("[NL]trucker", BotName, "*** User "..user.sName.." got ban. Reason: "..Reason.." FILE: "..path)
user:SendPM(BotName,"You have been banned. "..Reason)
if (main == "Active" ) then
SendToAll(BotName, "The user "..user.sName.." is been banned for "..Reason)
end
if (main == "Deactive") then
return 1
end
user:Ban()
elseif (kick[user.sName] == 0 or kick[user.sName] == 1 or kick[user.sName] == 2) then
ClearNill(user)
kick[user.sName] = kick[user.sName] + 1
user:SendData(Bot, kick[user.sName])
Reason = FindWhat(data)
SendPmToNick("[NL]trucker", BotName, "*** User "..user.sName.." got "..kick[user.sName].." kicks. Reason: "..Reason.." FILE: "..path)
user:SendPM(BotName,"You have been kicked "..kick[user.sName].." time(s) at 3 you will be ban. "..Reason.." FILE: "..path)
appendto(kicklog)
write("\r\n"..user.sName.."|"..Reason.."|"..path.."|"..kick[user.sName].."|"..GetTime())
writeto()
if (main == "Active" ) then
SendToAll(BotName, "The user "..user.sName.." is been kicked for "..Reason)
end
if (main == "Deactive") then
return 1
end
user:TempBan()
end
end
end
end
end

function FindWhat(data)
for i,v in Files do
if( strfind(strlower(data), i) ) then
return v
end
end
return "Other files"
end

function GetTime()
s = date("%S")
h = date("%H")
m = date("%M")
d = date("%d")
mm = date("%m")
y = date("%y")
Date = "Day: "..d.."/"..mm.."/20"..y.." Hour: "..h..":"..m..":"..s
return Date

end

function ClearNill(user)
if (warn[user.sName] == nil) then
warn[user.sName] = 0
end
if (kick[user.sName] == nil) then
kick[user.sName] = 0
end
end


Best regards, nErBoS
Title:
Post by: witch on 15 September, 2004, 00:17:45
Thanx nErBoS dude!!!
I will give it try  :D