Author Topic: Allow nonregged to download from other nonregged  (Read 1895 times)

0 Members and 1 Guest are viewing this topic.

Offline Belial

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Allow nonregged to download from other nonregged
« on: 18 November, 2003, 13:27:17 »
I have got a hold on a script that only allows regged users to download and search
What i want it to do is also let nonregged download and search from nonregged users
Meaning regged users can download, search from all (regged & nonregged) but nonregged can only download, search from nonregged users

Who can make this script to do this things im totally blank about this.....

Here is the code from the original author.
Code: [Select]
-- LEECHBLOCKER 02 -- for PtokaX TD4
---------------------
-- Created by SAMPLERman - HUB: samplerman.no-ip.info
-- 5/August/2003
-- Based on an idea by OpiumVolage and RabidWombat
-- And thanks AGAIN to RabidWombat for new ideas

-- This LUA script prevents users that are not registered in the hub (=aliens)
-- from connecting to other users (for downloading).
-- New users (=aliens) can chat, upload and be searched. They just can't download.

-- This way your previously private hub can again be public.

-- Optionally, the script also blocks searches (from nonregged users).
-- However, it is recommended that you allow everyone to search your hub, so that
-- new users know what they are missing.

-- NEW in version 02:
-- To allow an alien to download for 1 session, OPs can type this command:
-- !letleech

-- To do for next version:
-- Optionally, aliens can download off of other aliens

-- There are 2 kinds of hubs:
-- 1) Open hubs for sharing anything
-- 2) Small hubs that concentrate on a special interest (e.g. classical sheet music)

-- This script is NOT recommended for hub kind #1, where it is enough to
-- control how many GB users are sharing.
-- Because in hub type #1 there is no point in registering users, this script
-- should be adapted to make shared amount the criteria for letting download.
-- Even better, for hub type #1 users who share little should be allowed to download
-- from other people who share little.
-- Freedom is a strength of the Direct Connect community; please do not cut into
-- people's freedom except when absolutely necessary.
-- This script is only for closed hubs with a very specific subject.

-------------------------------
-- SOURCES OF SCRIPTING INFO --
-------------------------------
-- Scripting.txt (comes with PtokaX)
-- http://lua.bcs-solutions.de/
-- LUA reference manual 4.0.pdf

----------------------
-- GLOBAL VARIABLES -- make changes here only
----------------------
smDebugging = "0" -- Default is "0" (silent mode). "1" sends msgs to OPs
smBlockSearches = "0" -- Default is "0" (do not block searches)
smBlockSearchExceptions = { "scores", "sheet music" }

MsgToAliens = "\t\t\t*** warning***\r\n\t"..
"YOU ARE UNABLE TO DOWNLOAD IN THIS HUB\r\n\t"..
"Only registered users can download.\r\n\t"..
"You still can search and chat...\r\n\t"..
"...but the hub won't let you download until you register.\r\n"..
"\tIn order to become a registered member:\r\n\t"..
"1) Share classical sheet music in a separate folder called SCORES\r\n\t"..
"2) only then, ask an OP for a password.\r\n\t"..
"We hope you will join us."

LetLeechCommand = "!letleech"

----------------------------------
-- Do not change anything below --
----------------------------------
smBot = frmHub:GetHubBotName() -- This line gets bot name from PtokaX hubsoftware;
-- therefore, your Hub Bot should be enabled.

ToBlock = { "^$ConnectToMe%s(%S+)", "^$RevConnectToMe%s(%S+)", "^$Search%s+(%S+)"}
LetLeech = {}

--// This function is called when hub or script starts
function Main()
frmHub:EnableFullData(1)
frmHub:UnregBot(smBot)
frmHub:RegBot(smBot)
--// If thus configured, remove search from blocking table:
if smBlockSearches == "0" then
for i,v in ToBlock do
if v == "^$Search%s+(%S+)" then ToBlock[i] = nil end
end
end
end

--// This function is fired when a new user (non-OP) finishes login
function NewUserConnected(user)
if user.iProfile == -1 then
user:SendPM(smBot,"\r\n"..MsgToAliens)
end
end

--// This function is fired when new data arrives
function DataArrival (user, data)

--// See if data is the !letleech command:
if strsub(data, 1, 1) == "<" then
local line=strsub(data,1,strlen(data)-1) -- remove last char
local s,e,cmd = strfind(line, "%b<>%s+(%S+)")
local s,e,arg = strfind(line, "%b<>%s+%S+%s+(%S+)")
if strlower(cmd)==strlower(LetLeechCommand) then
if user.iProfile ~= 0 and user.iProfile ~= 1 then
SendToAll(smBot, "...but you are not an OP!")
return nil
end
who = GetItemByName(arg)
if not who then
SendToOps(smBot, arg.." is not online.")
return 1
end
if who.iProfile ~= -1 then
SendToOps(smBot, arg.." is registered and does not need a leech license.")
return 1
end
LetLeech[arg] = 1
SendToOps(smBot,arg.." has been granted a special leech license.")
who:SendData(smBot,arg..", you are now authorized to download for this session.")
return 1
end
end

--// See if data should be blocked:
for _,blockstring in ToBlock do
local _, _, who = strfind(data, blockstring)
if who then return smBlock(user,data,who) end
end
end

function smBlock(user,data,who)
local report
local profnam = GetProfileName(user.iProfile)
if profnam then
profnam = strlower(profnam)
else
profnam = "alien"
end
--// Activity by Masters, OPs, VIPs and REGs are just reported to OPs:
--// Also, searches pass if they are in the exception list:
--// Data also passes if user is in LetLeech list:
if (user.iProfile ~= -1) or smMatchException(data)
or IsInLeechList(user) then
report = "\t"..user.sName.." ("..profnam..") sends:\r\n\t"..data
smDebugToOPs(report)
return nil
end
--// Alien (not registered) users get blocked:
local report = "\tBlocked from "..user.sName.." ("..
profnam.."):\r\n\t"..data
smDebugToOPs(report)
return 1
end

function smMatchException(data)
if strfind (data, "^$Search%s+(%S+)") then
for _,exceptword in smBlockSearchExceptions do
if strfind (strlower(data), strlower(exceptword)) then
return 1
end
end
end
return nil
end

function IsInLeechList(user)
for i,v in LetLeech do
if i == user.sName then return 1 end
end
return nil
end

function smDebugToOPs(data)
if smDebugging == "1" then
SendToOps(smBot,data)
end
end
 

Hope that someone have the courage and try making this right

Belial

PtokaX forum

Allow nonregged to download from other nonregged
« on: 18 November, 2003, 13:27:17 »

Offline Jorgesc

  • Junior Member
  • **
  • Posts: 15
  • Karma: +0/-0
Changes
« Reply #1 on: 05 January, 2005, 16:30:44 »
Hi men, good script.

But, you can make a change.

1.- Send PM to nonreg user when this try to download.


Sorry my english.   :D

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 752
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
(No subject)
« Reply #2 on: 05 January, 2005, 17:47:52 »
Code: [Select]
--## Made by [NL]Pur

--## Modded by nErBoS

--## and bastya_elvtars




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
« Last Edit: 05 January, 2005, 17:48:10 by bastya_elvtars »
Everything could have been anything else and it would have just as much meaning.

PtokaX forum

(No subject)
« Reply #2 on: 05 January, 2005, 17:47:52 »