PtokaX forum

Archive => Archived 5.1 boards => Help with scripts => Topic started by: pulsar on 27 March, 2007, 03:30:13

Title: Leech Bot by jiten
Post by: pulsar on 27 March, 2007, 03:30:13
Leech Bot, Lua5  (thread: http://forum.ptokax.org/index.php?topic=4034.0)  <- closed thread
hi@all, good work, a very meaningful script! but it shows me a small error on line 62:

LeechBot-by.jiten.lua:62: attempt to index a nil value  ???

all my efforts to eliminate this error failed  ::)
Hubsoft: 0.3.5.1 LUA5
Title: Re: Leech Bot by jiten
Post by: blastbeat on 27 March, 2007, 19:17:58
Hi

i have the same problem, same hubsoft and no solution too...

Title: Re: Leech Bot by jiten
Post by: bastya_elvtars on 27 March, 2007, 19:24:32
Line 62 is
Code (lua) Select
user:SendData(sBot,"*** Error: You are not authorized to download from "..nick..".")
I don't see any error-source.
Title: Re: Leech Bot by jiten
Post by: pulsar on 27 March, 2007, 20:07:13
oh sry, i've forgotten i have 2 profiles more  ::)
the error are on line 60
Title: Re: Leech Bot by jiten
Post by: bastya_elvtars on 27 March, 2007, 22:09:09
K, the problem must be that the CTM goes to an offline user somehow. Try to replace the CTMArrival to this:
Code (lua) Select
CTMArrival = function(user,data)
local usr=GetItemByName(nick); if not usr then return end
local sFind
if string.sub(data,1,4) == "$Rev" then sFind = "(%S+)|$" elseif string.sub(data,1,4) == "$Con" then sFind = "%S+%s+(%S+)" end
local s,e,nick = string.find(data,sFind)
-- (user is blocked and can't download? OR user's profile can download from nick's? OR nick is blocked and can't upload?) AND (can immune user download from blocked nick?)
if (tBlocked[string.lower(user.sName)] or tIdxBlocked[user.iProfile][usr.iProfile] == 1 or tBlocked[string.lower(nick)]) then
if not (tImmune[string.lower(usr.sName)] and tImmune[string.lower(usr.sName)][string.lower(user.sName)]) then
user:SendData(sBot,"*** Error: You are not authorized to download from "..nick..".")
return 1
end
end
end
Title: Re: Leech Bot by jiten
Post by: pulsar on 28 March, 2007, 08:21:23
perfect! good job, big thx bastya  :)