PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: lulante on 25 October, 2005, 18:15:08

Title: Please Help
Post by: lulante on 25 October, 2005, 18:15:08
Something wrong


BotName = "test"

function Main()
frmHub:EnableSearchData(1)
end

Files = {
["rape"]="Do not share sick porn!",
["incest"]="NO incest movies-pictures here!",
["childsex"]="NO sick Porn inhere!",
["childporn"]="NO sick orn inhere!",
["underage"]="NO sick Porn inhere!",
["nazi"]="NO nazi related material here!",
["animalsex"]="NO Animalsex files here!",
["svastika"]="NO Nazi/white power music HERE!!!",
[".temp.mp3"]="NO sharing of incomplete downloads",
["_INCOMPLETE_"]="NO sharing of incomplete downloads",
["download123456789.dat"]="NO sharing of incomplete downloads",
["part.met"]="NO sharing of incomplete downloads",
[".getright"]="NO sharing of incomplete downloads"
[".vob"]="NO sharing of incomplete downloads"
[".dll"]="NO sharing of system files"
[".com"]="NO sharing of system files"
[".ini"]="NO sharing of system files"
}

Kicked = {}

function NewUserConnected(user)
if( Kicked[user.sName] == 1 ) then
Kicked[user.sName] = nil
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*)|$" )
if( nick == BotName and Kicked[user.sName] == nil ) then
Kicked[user.sName] = 1
Reason = FindWhat(data)
SendPmToNick("[NL[DSNHO]trucker", BotName, "*** User "..user.sName.." kicked. Reason: "..Reason)
user:SendPM(BotName, "You were kicked. "..Reason)
user:Disconnect()
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
Title:
Post by: Madman on 25 October, 2005, 18:58:43
The script has allready been converted and updated... Search for Bad files or somethign like that....
Title: Something wrong
Post by: lulante on 27 October, 2005, 15:28:17
hello
something wrong

llegalist.lua:22: `}' expected (to close `{' at line 8) near `['

Please help
Title:
Post by: bastya_elvtars on 27 October, 2005, 16:14:47
QuoteOriginally posted by lulante
hello
something wrong

llegalist.lua:22: `}' expected (to close `{' at line 8) near `['

Please help

Care to post the code?
Title:
Post by: 6Marilyn6Manson6 on 27 October, 2005, 16:39:19
QuoteOriginally posted by bastya_elvtars
QuoteOriginally posted by lulante
hello
something wrong

llegalist.lua:22: `}' expected (to close `{' at line 8) near `['

Please help

Care to post the code?

yeah post code :D
Title:
Post by: DJ Bert on 27 October, 2005, 20:06:12
You have to close some lines, wenn not close a line then you got that error.
This should work.

BotName = "test"

function Main()
frmHub:EnableSearchData(1)
end

Files = {
["rape"]="Do not share sick porn!",
["incest"]="NO incest movies-pictures here!",
["childsex"]="NO sick Porn inhere!",
["childporn"]="NO sick orn inhere!",
["underage"]="NO sick Porn inhere!",
["nazi"]="NO nazi related material here!",
["animalsex"]="NO Animalsex files here!",
["svastika"]="NO Nazi/white power music HERE!!!",
[".temp.mp3"]="NO sharing of incomplete downloads",
["_INCOMPLETE_"]="NO sharing of incomplete downloads",
["download123456789.dat"]="NO sharing of incomplete downloads",
["part.met"]="NO sharing of incomplete downloads",
[".getright"]="NO sharing of incomplete downloads",
[".vob"]="NO sharing of incomplete downloads",
[".dll"]="NO sharing of system files",
[".com"]="NO sharing of system files",
[".ini"]="NO sharing of system files",
}

Kicked = {}

function NewUserConnected(user)
if( Kicked[user.sName] == 1 ) then
Kicked[user.sName] = nil
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*)|$" )
if( nick == BotName and Kicked[user.sName] == nil ) then
Kicked[user.sName] = 1
Reason = FindWhat(data)
SendPmToNick("[NL[DSNHO]trucker", BotName, "*** User "..user.sName.." kicked. Reason: "..Reason)
user:SendPM(BotName, "You were kicked. "..Reason)
user:Disconnect()
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



For lua 5 search for Advanced BadFile Search (nightlitch)
Title:
Post by: bastya_elvtars on 28 October, 2005, 03:29:23
Damn, he sent me the code via e-mail.

Don't do this next time please, I cannot offer support in e-mail (should be in my sig?)

BotName = "test"

function Main()
frmHub:EnableSearchData(1)
end

Files = {
["rape"]="Do not share sick porn!",
["incest"]="NO incest movies-pictures here!",
["childsex"]="NO sick Porn inhere!",
["childporn"]="NO sick orn inhere!",
["underage"]="NO sick Porn inhere!",
["nazi"]="NO nazi related material here!",
["animalsex"]="NO Animalsex files here!",
["svastika"]="NO Nazi/white power music HERE!!!",
[".temp.mp3"]="NO sharing of incomplete downloads",
["_INCOMPLETE_"]="NO sharing of incomplete downloads",
["download123456789.dat"]="NO sharing of incomplete downloads",
["part.met"]="NO sharing of incomplete downloads",
[".getright"]="NO sharing of incomplete downloads"
[".vob"]="NO sharing of incomplete downloads"
[".dll"]="NO sharing of system files"
[".com"]="NO sharing of system files"
[".ini"]="NO sharing of system files"
}

Kicked = {}

function NewUserConnected(user)
if( Kicked[user.sName] == 1 ) then
Kicked[user.sName] = nil
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*)|$" )
if( nick == BotName and Kicked[user.sName] == nil ) then
Kicked[user.sName] = 1
Reason = FindWhat(data)
SendPmToNick("[NL[DSNHO]trucker", BotName, "*** User "..user.sName.." kicked. Reason: "..Reason)
user:SendPM(BotName, "You were kicked. "..Reason)
user:Disconnect()
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
Title:
Post by: Mardeg on 28 October, 2005, 08:12:39
well you did ask him to *post* it :)
Title:
Post by: Mojma on 28 October, 2005, 18:31:50
Hi guys,

it is possible to do, convert this script into LUA5, please?
Beacuse Nightlitch's Advanced BadFile Search don't work :(

  THX in advance
Title:
Post by: Markitos on 28 October, 2005, 19:43:55
QuoteOriginally posted by Mojma
Hi guys,

it is possible to do, convert this script into LUA5, please?
Beacuse Nightlitch's Advanced BadFile Search don't work :(

  THX in advance
This is my try...
1st - i get this error Ptokax 0.3.3.21\scripts\asas.lua:6: attempt to call method `EnableSearchData' (a nil value), i saw the script interface text and didnt find some simillar to that.
2nd - dunno if i have to use ChatArrival or SrArrival
BotName = "test"


function Main()

frmHub:EnableSearchData(1)

end



Files = {

["rape"]="Do not share sick porn!",

["incest"]="NO incest movies-pictures here!",

["childsex"]="NO sick Porn inhere!",

["childporn"]="NO sick orn inhere!",

["underage"]="NO sick Porn inhere!",

["nazi"]="NO nazi related material here!",

["animalsex"]="NO Animalsex files here!",

["svastika"]="NO Nazi/white power music HERE!!!",

[".temp.mp3"]="NO sharing of incomplete downloads",

["_INCOMPLETE_"]="NO sharing of incomplete downloads",

["download123456789.dat"]="NO sharing of incomplete downloads",

["part.met"]="NO sharing of incomplete downloads",

[".getright"]="NO sharing of incomplete downloads",

[".vob"]="NO sharing of incomplete downloads",

[".dll"]="NO sharing of system files",

[".com"]="NO sharing of system files",

[".ini"]="NO sharing of system files",

}



Kicked = {}



function NewUserConnected(user)

if( Kicked[user.sName] == 1 ) then

Kicked[user.sName] = nil

end

for i,v in Files do

user:SendData("$Search Hub:"..BotName.." F?F?0?1?"..i)

end

end



function ChatArrival(user, data)

if( string.sub(data, 1, 3) == "$SR" ) then

_,_,nick = string.find( data, "\05(%S*)|$" )

if( nick == BotName and Kicked[user.sName] == nil ) then

Kicked[user.sName] = 1

Reason = FindWhat(data)

SendPmToNick("[NL[DSNHO]trucker", BotName, "*** User "..user.sName.." kicked. Reason: "..Reason)

user:SendPM(BotName, "You were kicked. "..Reason)

user:Disconnect()

end

end

end



function FindWhat(data)

for i,v in Files do

if( string.find(string.lower(data), i) ) then

return v

end

end

return "Other files"
end

Cheers...
Title:
Post by: Dessamator on 28 October, 2005, 23:26:36
Enablesearchdata is no longer used in the new ptokax.

and for this :
function ChatArrival(user, data)

if( string.sub(data, 1, 3) == "$SR" ) then


, this :
SRArrival(User, Data)            - Incoming search reply from user. If script return 1 hub don't process data.


 is used for that.
Title:
Post by: DJ Bert on 28 October, 2005, 23:57:30
This works perfect
---------------------------------------------------------------------------------------------------
-- Advanced BadFile Active Search // Stripped from Thor 6
-- By: NightLitch 2005-03-04
---------------------------------------------------------------------------------------------------
tBadFiles = {
{".dctmp" , "NO sharing of incomplete downloads"},
{"dctmp" , "NO sharing of incomplete downloads"},
{"dctmp.antifrag" , "NO sharing of incomplete downloads"},
{"antifrag" , "NO sharing of incomplete downloads"},
{".temp.mp3" , "NO sharing of incomplete downloads"},
{"_INCOMPLETE_" , "NO sharing of incomplete downloads"},
{"incomplete" , "NO sharing of incomplete downloads"},
{"download123456789.dat" , "NO sharing of incomplete downloads"},
{"r@ygold" , "NO sharing of sick porn here"},
{"part.met" , "NO sharing of incomplete downloads"},
{".getright" , "NO sharing of incomplete downloads"},
{"preteen" , "NO sharing of preteen / underage porn"},
{"kiddy porn" , "NO sharing of kiddy / underage porn"},
{"underage" , "NO sharing of kiddy / underage porn"},
{"Program Files" , "NO sharing of installed / packed programs or games"},
{"virscan .dat" , "NO sharing of installed / packed programs or games"},
{"Netlimiter" , "NO sharing of installed / packed programs or games"},
}
---------------------------------------------------------------------------------------------------
--// Don't Edit below this point if you don't now what you are doing
---------------------------------------------------------------------------------------------------
tTimer = {}

function Main()
RegTimer(SearchForBadFiles, 20 * 1000, "ActiveBadFileSearch")  -- Active Search Each 20 Sec
SetTimer(1000)
StartTimer()
end

function OnTimer()
for i=1,table.getn(tTimer) do
tTimer[i][3] = tTimer[i][3] + 1
if tTimer[i][3] > tTimer[i][2] then
tTimer[i][3]=1
tTimer[i][1]()
end
end
end

function SRArrival(sUser,sData)
local _,_,From,Path,FileSize,FreeSlots,TotalSlots,Who = string.find(sData, "^%$SR%s+(%S+)%s+(.*)(%d+)%s+(%d+)%/(%d+).*(%S+)%|$")
if tCall["BadFileSearch"] then pcall(tCall["BadFileSearch"],sUser,Path,Who,FileSize) end
end

tCall = {}
tCall["BadFileSearch"] = function(sUser,Path,Who,FileSize)
if sUser.bOperator then return 0 end
if Who == "SlotFetch" then
local FileFound, FileReason = BadFiles(Path)
if FileFound then
sUser:SendData(frmHub:GetHubBotName(), "*** You have been kicked for "..FileReason..". "..Path.." "..Units(FileSize))
SendToOps(frmHub:GetHubBotName(), "*** User "..sUser.sName.." has been kicked for "..FileReason..". "..Path.." "..Units(FileSize))
sUser:TempBan()
end
end
end

RegTimer = function(Function,Interval,str)
local tmpTrig = Interval / 1000
table.insert(tTimer,{Function,tmpTrig,1,str})
end

Units = function(intSize)
if tonumber(intSize) ~= 0 then
local tUnits = { "Bytes", "KB", "MB", "GB", "TB" }
intSize = tonumber(intSize);
local sUnits;
for index = 1, table.getn(tUnits) do
if(intSize < 1024) then
sUnits = tUnits[index];
break;
else
intSize = intSize / 1024;
end
end
return string.format("%0.1f %s",intSize, sUnits);
else
return "0 Bytes"
end
end

BadFiles = function(PathStr)
for i = 1, table.getn(tBadFiles) do
if string.find(PathStr, tBadFiles[i][1]) then
return 1,tBadFiles[i][2]
end
end
return nil, "Other Files"
end

SearchForBadFiles = function()
if t == nil then
t =1
if tBadFiles[t] then
SendToAll("$Search "..frmHub:GetHubIp()..":"..frmHub:GetHubUdpPort().." F?F?0?1?"..tBadFiles[t][1])
end
elseif t > table.getn(tBadFiles) then
t = nil
else
t = t+1
if tBadFiles[t] then
SendToAll("$Search "..frmHub:GetHubIp()..":"..frmHub:GetHubUdpPort().." F?F?0?1?"..tBadFiles[t][1])
else
t = 0
end
end
end



Grtzzz

DJ Bert
Title:
Post by: Markitos on 29 October, 2005, 18:23:38
QuoteOriginally posted by Dessamator
Enablesearchdata is no longer used in the new ptokax.

and for this :
function ChatArrival(user, data)

if( string.sub(data, 1, 3) == "$SR" ) then


, this :
SRArrival(User, Data)            - Incoming search reply from user. If script return 1 hub don't process data.


 is used for that.
Thnks dessamator!
Title:
Post by: Dessamator on 29 October, 2005, 18:42:38
Ur Welcome.