PtokaX forum

Development Section => LUA & PtokaX-Scripting-Interface => Topic started by: Op on 09 April, 2006, 15:04:16

Title: Please help convert to lua 5
Post by: Op on 09 April, 2006, 15:04:16
function Main()
frmHub:EnableFullData(1)
end

function DataArrival(curUser, data)
if (strsub(data, 1, 15) == "$RevConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
if GetItemByName(towho) and GetItemByName(towho).bOperator then
curUser:SendData("*** Tienes que estar registrado para descargar de un OP/You must get registered to be able to download from an OP")
return 1
end
elseif (strsub(data, 1, 12) == "$ConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
if GetItemByName(towho) and GetItemByName(towho).bOperator then
curUser:SendData("*** Tienes que estar registrado para descargar de un OP/You must get registered to be able to download from an OP")
return 1
end
end
end
Title: Re: Please convert to lua 5
Post by: jiten on 09 April, 2006, 15:09:56
There are several scripts already converted to LUA 5.0/5.1 that support this.

Search the forum for: "Leech block" or "Leech Bot".
Title: Re: Please convert to lua 5
Post by: Op on 09 April, 2006, 15:13:46
Quote from: jiten on 09 April, 2006, 15:09:56
There are several scripts already converted to LUA 5.0/5.1 that support this.

Search the forum for: "Leech block" or "Leech Bot".


Please blocker download user to OP
Title: Re: Please help convert to lua 5
Post by: jiten on 09 April, 2006, 15:36:24
Give this a try:

--[[

Operator Download Blocker - LUA 5.0/5.1 by jiten (4/9/2006)

]]--

CTMArrival = function(user,data)
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)
local nick = GetItemByName(nick)
if nick and nick.bOperator then
return user:SendData(frmHub:GetHubBotName(),"*** Error: You are not authorized to download from an Operator!"), 1
end
end

ConnectToMeArrival = CTMArrival
RevConnectToMeArrival = CTMArrival
Title: Re: Please help convert to lua 5
Post by: Op on 09 April, 2006, 16:08:10
thank you  ;D
Title: Re: Download blocker of master to OP
Post by: Op on 09 April, 2006, 16:42:12
Quote from: jiten on 09 April, 2006, 15:36:24
Give this a try:

--[[

Operator Download Blocker - LUA 5.0/5.1 by jiten (4/9/2006)

]]--

CTMArrival = function(user,data)
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)
local nick = GetItemByName(nick)
if nick and nick.bOperator then
return user:SendData(frmHub:GetHubBotName(),"*** Error: You are not authorized to download from an Operator!"), 1
end
end

ConnectToMeArrival = CTMArrival
RevConnectToMeArrival = CTMArrival


Download blocker user to OP, yes

Download blocker of master to OP, of OP to OP :(

Please help


Title: Re: Please help convert to lua 5
Post by: Thor on 09 April, 2006, 16:53:20
It also block all CTM included OPs and masters, so nobody can download from OPs, nor the other OPs.