blockleecher like in dch++
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

blockleecher like in dch++

Started by Leun, 25 September, 2005, 16:18:33

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Leun

hi,

I'am looking for a blockleechers script, like in dch++

QuoteBlockLeechers
Adds functionality to allow individual users to block people with a low (hub defined) share from downloading. Using this plugin, you can run a hub with a low minimum share but give big sharers an obvious advantage, hopefully creating an incentive for low sharers to spend some money on disks.
So is it possible to make a script were only VIPs can choose, if they let leech users, who share < 50gb by them

Hopefully someone can fix this script

Northwind

#1
There are already somekind of blocker use

but i think it's not wise use that kind of script, the spirit of dc is share and get... not to force share huge amount of stuff to get some...

I think users will leave if there is that kind of law :) but anyway it's your hub, your rules....


Leun

You're right Nothwind

this isn't the spirit of dc, but it was a request from some users with big shares. And it is up to the user if they enable or disable that function.

There are indeed some blocker but that are personal blockers for block a person by nick or ip, this script have to block everyone who shares less 50 gb....

Leun

I found a block script from Jiten, and I changed it a little bit.

I've now a little blockleecher script:

-- $Rev Blocker by jiten 
-- Added: Immune Table for Non-Operators
-- Changed: Normal and Reg Hub Check
-- some ideas taken from leech bot and ShaveShare v4.8 by Herodes
-- changed into "blockleecher" by leun



bot = "[BOT]Predator"

kb = 1024  
mb = 1024 ^ 2 
gb = 1024 ^ 3 

MinShare = 50*gb
tImmune = { ["[OP]Sjaakvaak"] = 1, ["[VIP]Neliz"] = 1, } -- Non-Operators Immune List (["nick"] = 1)

FileProfiles  = {
[-1] = 1, --Unregistered User
[0] = 1, --Master
[1] = 1, --Operator
[2] = 0, --Vip
[3] = 1, --Registered User
[4] = 0, --Moderator
[5] = 0, --NetFounder
}


DoShareUnits = function(intSize) --- Thanks to kepp and NotRambitWombat
	if 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 "nothing"
	end
end


function ConnectToMeArrival(curUser,data)
	if not tImmune[curUser.sName] then
		if curUser.iShareSize < MinShare or curUser.iSlots < MinSlots and FileProfiles[curUser.iProfile] == 1 then
			curUser:SendData("*** You have to share at least "..DoShareUnits(MinShare).." to download from users who share more as 50 gb.")
			return 1
		end
	end
end

RevConnectToMeArrival = ConnectToMeArrival


Now I've one request, I only need a function for VIPs to enable or disable this script for them.
So that each VIP can choose if they let leech or block users.

This is to difficult for me, hopefully comeone can help??

TTB

Hi!

Try thisone (note the extra table-file you need to make in the scripts folder):

-- $Rev Blocker by jiten  
-- Added: Immune Table for Non-Operators 
-- Changed: Normal and Reg Hub Check 
-- some ideas taken from leech bot and ShaveShare v4.8 by Herodes 
-- modded by leun 

-- TTB [17-10-05]
-- Added --> Blockleechers on every profile, by command and save settings in table [17-10-05] 
-- Note: Make a table in the file (settings) >>

--	Block = {
--	}

--## Settings ##--
file = "block.tbl"
blockcmd = "+blockleechers"

bot = "[BOT]Predator" 
 
kb = 1024   
mb = 1024 ^ 2  
gb = 1024 ^ 3

MinShare = 50*gb 

tImmune = { ["Sjaakvaak"] = 1, ["Neliz"] = 1, } -- Non-Operators Immune List (["nick"] = 1) 
 
FileProfiles  = { 
[-1] = 1, --Unregistered User 
[0] = 1, --Master 
[1] = 1, --Operator 
[2] = 0, --Vip 
[3] = 1, --Registered User 
[4] = 0, --Moderator 
[5] = 0, --NetFounder 
} 

Blockleechers = {
[-1] = 0, --Unregistered User 
[0] = 1, --Master 
[1] = 1, --Operator 
[2] = 1, --Vip 
[3] = 0, --Registered User 
[4] = 1, --Moderator 
[5] = 1, --NetFounder 
} 

--## Code, no settings! ##--

-- Tables // loading --
temptable = {}
assert(loadfile(file))()

-- Standard functions -- 
function ChatArrival(curUser,data)
	data = string.sub(data,1,string.len(data)-1)
	s,e,cmd = string.find(data,"%b<>%s+(%S+)")
	if cmd and string.lower(cmd) ~= nil then
		if (string.lower(cmd) == blockcmd) and Blockleechers[curUser.iProfile] == 1 then
			local _,_,_,onoff = string.find( data,"%b<>%s+(%S+)%s+(%S+)%s*")
			if onoff and string.lower(onoff)=="on" then
				if Block[curUser.sName] == 1 then
					curUser:SendData(bot,"Blockleechers has already been enabled for you!")
				else
					status = 1
					tableadd(curUser,status)
					curUser:SendData(bot,"Blockleechers has been ENABLED for you!")
				end
			elseif onoff and string.lower(onoff)=="off" then
				if Block[curUser.sName] == nil then
					curUser:SendData(bot,"Blockleechers has already been disabled for you!")
				else
					status = 2
					tableadd(curUser,status)
					curUser:SendData(bot,"Blockleechers has been DISABLED for you!")
				end
			else
				if Block[curUser.sName] == nil then
					stat = "OFF"
				else
					stat = "ON"
				end
				curUser:SendData(bot,"To enable/disable blockleechers, type : "..blockcmd.." [on]/[off]. At this moment, your setting is: "..stat..".")
			end
			return 1
		end
	end
end

function tableadd(curUser,status)
local mijntabel = "Block"
	if status == 1 then
		Block[curUser.sName]={}
		Block[curUser.sName]=1
	elseif status == 2 then
		Block[curUser.sName]=nil
	end
	WriteFile(Block,mijntabel,file)
end
 
function ConnectToMeArrival(curUser,data) 
	if not tImmune[curUser.sName] then 
		if curUser.iShareSize < MinShare or curUser.iSlots < MinSlots and FileProfiles[curUser.iProfile] == 1 then 
			local _,_,hoi,target = string.find(data, "(%S+)%s+(%S+)%s+(.*)")
			if temptable[curUser.sName] == nil then
				curUser:SendData("*** You have to share at least "..DoShareUnits(MinShare).." to download from "..target..".") 
				temptable[curUser.sName] = 1
				return 1 
			else
				return 1
			end
		end 
	end 
end

function UserDisconnected(curUser,data)
	if temptable[curUser.sName] ~= nil then
		temptable[curUser.sName] = nil
	end
end
 
RevConnectToMeArrival = ConnectToMeArrival  

-- Convert functions --
DoShareUnits = function(intSize) --- Thanks to kepp and NotRambitWombat 
	if 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 "nothing" 
	end 
end 

-- Write functions --
function WriteFile(table, tablename, file)
	local handle = io.open(file, "w")
	Serialize(table, tablename, handle)
  	handle:close()
end

function Serialize(tTable, sTableName, hFile, sTab)
	sTab = sTab or "";
	hFile:write(sTab..sTableName.." = {\n" );
	for key, value in tTable do
		local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
		if(type(value) == "table") then
			Serialize(value, sKey, hFile, sTab.."\t");
		else
			local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
			hFile:write(sTab.."\t"..sKey.." = "..sValue);
		end
		hFile:write(",\n");
	end
	hFile:write(sTab.."}");
end
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

Leun

Thnx TTB,

This script worked perfect  :D
great workt !!!!!!!

SMF spam blocked by CleanTalk