PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: zinden on 13 November, 2004, 16:53:21

Title: Download blocker nonreg can download nonreg
Post by: zinden on 13 November, 2004, 16:53:21
Hello, i checked thru forum and i havent found any script that really match my query.

I Would like to have a downblocker script that blocks nonreg from download from reg and above.
nonreg can download from only other nonreg users.

They get a pm/main message when they try to connect to a reg user. if they try again then message arrives again.

Hopefully someone can make a script like that.
Title:
Post by: nErBoS on 15 November, 2004, 01:37:14
Hi,

Try out this one...

--## Made by [NL]Pur
--## Modded by nErBoS

sBot = "DLBlocker"

arrRC = {}

function Main()
    frmHub:EnableFullData(1)
end

function DataArrival(curUser, data)
if (strsub(data, 1, 15) == "$RevConnectToMe") then
local _,_,towho = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
if (curUser.iProfile == -1 and GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= -1) then
curUser:SendData(sBot, "You can only download from unreg users.")
  return 1
        elseif (towho ~= nil) then
arrRC[towho] = 1
end
elseif (strsub(data, 1, 12) == "$ConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
if (arrRC[curUser.sName] ~= nil) then
arrRC[curUser.sName] = nil
elseif (GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= -1) then
curUser:SendData(sBot, "You can only download from unreg users.")
  return 1
        end

end
end

Best regards, nErBoS
Title:
Post by: BeeR on 15 November, 2004, 17:32:28
QuoteOriginally posted by nErBoS
Hi,

Try out this one...

--## Made by [NL]Pur
--## Modded by nErBoS

sBot = "DLBlocker"

arrRC = {}

function Main()
    frmHub:EnableFullData(1)
end

function DataArrival(curUser, data)
if (strsub(data, 1, 15) == "$RevConnectToMe") then
local _,_,towho = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
if (curUser.iProfile == -1 and GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= -1) then
curUser:SendData(sBot, "You can only download from unreg users.")
  return 1
        elseif (towho ~= nil) then
arrRC[towho] = 1
end
elseif (strsub(data, 1, 12) == "$ConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
if (arrRC[curUser.sName] ~= nil) then
arrRC[curUser.sName] = nil
elseif (GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= -1) then
curUser:SendData(sBot, "You can only download from unreg users.")
  return 1
        end

end
end

Best regards, nErBoS
Hello nErBoS
Is it possible to modified this script so non-regged user not can dload and search..
if a user try to dload or search he/she should get this mess --> curUser:SendData(sBot, "You must be a regged user to download or search i this hub - talk to an OP to get regged.")
Title:
Post by: nErBoS on 16 November, 2004, 02:14:41
Hi,

Try out this one was made for another request but will do the same thing...

--## CHAT ONLY BOT
--## Requested by Bhuvan
--## Little modification for BeeR
--## Made By nErBoS

sBot = "CO-Bot"

arrString = {
"$Search",
"$SR",
"$ConnectToMe",
"$RevConnectToMe",
}

arrRC = {}

function Main()
frmHub:RegBot(sBot)
frmHub:EnableFullData(1)
end

function DataArrival(user, data)
if (strsub(data,1,11) == "$ConnectToMe") then
local s,e,who = strfind(data, "$ConnectToMe%s+(%S+)")
if (who ~= nil and arrRC[who] ~= nil) then
return 0
end
end
if (user.iProfile == -1 and (strsub(data,1,1) == "$" and strsub(data,1,4) ~= "$To:")) then
for i=1, getn(arrString) do
if (strsub(data,1,strlen(arrString[i])) == arrString[i]) then
user:SendData(sBot, "You must be a regged user to download or search i this hub - talk to an OP to get regged.")
return 1
end
end
elseif (strsub(data,1,15) == "$RevConnectToMe") then
arrRC[user.sName] = 1
end
end

Best regards, nErBoS
Title:
Post by: zinden on 16 November, 2004, 19:05:48
if the message should appear in pm instead of mainchat how do i write then?

Also add his nick like:   " nicky, you are not allowed to download from reg users only nonreg."

this request is for the first script nErBoS posted
Title:
Post by: bastya_elvtars on 16 November, 2004, 19:49:21
I hope this is what you mean.

--## Made by [NL]Pur
--## Modded by nErBoS


sBot = "DLBlocker"

pmnotif=1 -- set to 1 if you wanna notify a user in PM


arrRC = {}


function Main()
    frmHub:EnableFullData(1)
    frmHub:UnRegBot(sBot)
    if pmnotif==1 then
        frmHub:RegBot(sBot)
    end
end


function DataArrival(curUser, data)
if (strsub(data, 1, 15) == "$RevConnectToMe") then
local _,_,towho = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
if (curUser.iProfile == -1 and GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= -1) then
curUser:SendData(sBot, curUser.sName.." - you can only download from unregistered users.")
  return 1
        elseif (towho ~= nil) then
arrRC[towho] = 1
end
elseif (strsub(data, 1, 12) == "$ConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
if (arrRC[curUser.sName] ~= nil) then
arrRC[curUser.sName] = nil
elseif (GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= -1) then
curUser:SendData(sBot, curUser.sName.." - you can only download from unregistered users.")
  return 1
        end
end
end
Title:
Post by: Madman on 16 November, 2004, 20:02:56
Shoulnt it be
curUser:SendPM(sBot, curUser.sName.. " You can only download from unreg users.")

since he asked it to show in a pm instead of the main
and it might be requierd to reg the bot to or am i totaly wrong?
Title:
Post by: bastya_elvtars on 16 November, 2004, 20:05:41
QuoteOriginally posted by madman
Shoulnt it be
curUser:SendPM(sBot, curUser.sName.. " You can only download from unreg users.")

since he asked it to show in a pm instead of the main

edited above post
Title:
Post by: zinden on 16 November, 2004, 20:15:55
Thanks it worked like a charm  ;)
Title:
Post by: BeeR on 18 November, 2004, 06:46:51
QuoteOriginally posted by nErBoS
Hi,

Try out this one was made for another request but will do the same thing...

--## CHAT ONLY BOT
--## Requested by Bhuvan
--## Little modification for BeeR
--## Made By nErBoS

sBot = "CO-Bot"

arrString = {
"$Search",
"$SR",
"$ConnectToMe",
"$RevConnectToMe",
}

arrRC = {}

function Main()
frmHub:RegBot(sBot)
frmHub:EnableFullData(1)
end

function DataArrival(user, data)
if (strsub(data,1,11) == "$ConnectToMe") then
local s,e,who = strfind(data, "$ConnectToMe%s+(%S+)")
if (who ~= nil and arrRC[who] ~= nil) then
return 0
end
end
if (user.iProfile == -1 and (strsub(data,1,1) == "$" and strsub(data,1,4) ~= "$To:")) then
for i=1, getn(arrString) do
if (strsub(data,1,strlen(arrString[i])) == arrString[i]) then
user:SendData(sBot, "You must be a regged user to download or search i this hub - talk to an OP to get regged.")
return 1
end
end
elseif (strsub(data,1,15) == "$RevConnectToMe") then
arrRC[user.sName] = 1
end
end

Best regards, nErBoS
Thank you nErBoS :]