block download if not min share
 

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

block download if not min share

Started by -PT-B2S, 06 April, 2005, 08:44:44

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

-PT-B2S

i wanna know if there is somo kind of script that can block an user to make downloads, if he hasn't the minimum share, or minimum upload slots. i wanna let them enter the hub, to explain them how to share and put the slots, cause i'm from portugal, and somo users in my country don't understand english, so it's difficult to configure dc++. is there somo script like this? thnks

jiten

#1
Try this one:

--$Rev Blocker by jiten
--restriction for those who have less than MinSlots and MinShare
--some ideas taken from leech bot and ShaveShare v4.8 by Herodes

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

MinShare = 500*mb -- in MBs
MinSlots = 3

function DoShareUnits(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 curUser.iShareSize < MinShare or curUser.iSlots < MinSlots then
		curUser:SendData("*** You have to share at least "..DoShareUnits(MinShare).." and/or have "..MinSlots.." slots open to be able do download.")
		return 1
	end
end

RevConnectToMeArrival = ConnectToMeArrival

Cheers

Optimus

--$Rev Blocker by jiten
--restriction for those who have less than MinSlots and MinShare
--some ideas taken from leech bot and ShaveShare v4.8 by Herodes

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

MinShare = 500*mb -- in MBs
MinSlots = 3

function DoShareUnits(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 curUser.iShareSize < MinShare or curUser.iSlots < MinSlots then
		curUser:SendData("*** You have to share at least "..DoShareUnits(MinShare).." and/or have "..MinSlots.." slots open to be able do download.")
		return 1
	end
end

RevConnectToMeArrival = ConnectToMeArrival


local str1 = string.sub(data,1,4)
if BlockTriggs[str1] then

^^ this is not needed anymore with the new ptokax API

maybe this line is what you need RevConnectToMeArrival = ConnectToMeArrival

- Optimus

jiten

Thanks for the hint  ;)

Optimus


-PT-B2S

thank you very much. :)

jiten

yw  :]

PS: First post updated with Optimus' hint.

Krysalis

Hello jiten,

can u add check Hubcount?
And if the User in More he will also blocked?

jiten

Here you go:
--$Rev Blocker by jiten
--restriction for MinSlots, MinShare and MaxHubs
--some ideas taken from leech bot and ShaveShare v4.8 by Herodes

MinShare = 500*mb -- in MBs
MinSlots = 3
MaxHubs = 5

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 

ConnectToMeArrival = function(curUser,data)
	if curUser.iShareSize < MinShare then
		return curUser:SendData("*** You have to share at least "..DoShareUnits(MinShare).." to be able to download."),1
	elseif curUser.iSlots < MinSlots then
		return curUser:SendData("*** You must have "..MinSlots.." open slots to be able do download."),1
	elseif curUser.iHubs > MaxHubs then
		return curUser:SendData("*** You can't be in more than "..MaxHubs.." hubs to be able do download."),1
	end
end

RevConnectToMeArrival = ConnectToMeArrival
Best regards

Krysalis

Seems to work perfekt. Thank you ;-)

James

Hi

is it possible to change the first script from Jiten that the message "You have to share at least "..DoShareUnits(MinShare).." and/or have "..MinSlots" will send via pm to every user and not be shown in the mainchat?

jiten

QuoteOriginally posted by James
Hi

is it possible to change the first script from Jiten that the message "You have to share at least "..DoShareUnits(MinShare).." and/or have "..MinSlots" will send via pm to every user and not be shown in the mainchat?
Just replace:
curUser:SendData("*** You have to share at least "..DoShareUnits(MinShare).." and/or have "..MinSlots.." slots open to be able do download.")
with:
curUser:SendPM(frmHub:GetHubBotName(),"*** You have to share at least "..DoShareUnits(MinShare).." and/or have "..MinSlots.." slots open to be able do download.")

Cheers

James

Thanks Jiten

...but have this now :

Private message from PtokaX: *** You have to share at least 5.0 GB and/or have 2 slots open to be able do download.

This is in MainChat.
is it possible to have this in separate PM windows ?

jiten

QuoteOriginally posted by James
Thanks Jiten

...but have this now :

Private message from PtokaX: *** You have to share at least 5.0 GB and/or have 2 slots open to be able do download.

This is in MainChat.
is it possible to have this in separate PM windows ?
Have you ticked "Popup messages from users that are not online" and unticked "Ignore messages from users that are not online" in File - Settings - Advanced ? Or, is that bot registered?

Cheers

James

yes...now works:D:D:D

  Thanks for helping.

James

i have another beg:

Is it possible to change the script for it could make exeptions for RegUser and Ops? It is cause of Sharesize and number of slots.

Thanks for your awaiting help,

greets James

jiten

Give this a try:
--$Rev Blocker by jiten
-- restriction for MinSlots, MinShare and MaxHubs
-- Added: Immune Table for Non-Operators
-- some ideas taken from leech bot and ShaveShare v4.8 by Herodes

MinShare = 500*mb -- in MBs
MinSlots = 3
MaxHubs = 5
tImmune = { ["nick1"] = 1, ["nick2"] = 1, } -- Non-Operators Immune List (["nick"] = 1)

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 

ConnectToMeArrival = function(curUser,data)
	if not tImmune[curUser.sName] or not curUser.bOperator then
		if curUser.iShareSize < MinShare then
			return curUser:SendData("*** You have to share at least "..DoShareUnits(MinShare).." to be able to download."),1
		elseif curUser.iSlots < MinSlots then
			return curUser:SendData("*** You must have "..MinSlots.." open slots to be able do download."),1
		elseif curUser.iHubs > MaxHubs then
			return curUser:SendData("*** You can't be in more than "..MaxHubs.." hubs to be able do download."),1
		end
	end
end

RevConnectToMeArrival = ConnectToMeArrival

Cheers

James

Hi

have this Script end DownloadBloker works ,but Immune User works not... (have PtokaX-16.05...maybe is this my Problem)

--$Rev Blocker by jiten
--restriction for those who have less than MinSlots and MinShare
--Added: Immune Table for Non-Operators
--some ideas taken from leech bot and ShaveShare v4.8 by Herodes

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

MinShare = 5120*mb -- in MBs
MinSlots = 2
tImmune = { ["EL_DIABLO"] = 1, ["nick2"] = 1, } -- Non-Operators Immune List (["nick"] = 1)

function DoShareUnits(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 curUser.iShareSize < MinShare or curUser.iSlots < MinSlots then
      curUser:SendPM(frmHub:GetHubBotName(),"*** Sorry , Du musst "..DoShareUnits(MinShare).." und "..MinSlots.." offene slots haben um downloaden zu k?nnen.")
      return 1
   end
end

RevConnectToMeArrival = ConnectToMeArrival

blackwings

QuoteOriginally posted by James
Hi

have this Script end DownloadBloker works ,but Immune User works not... (have PtokaX-16.05...maybe is this my Problem)
why it doesn't work is because you didn't copy the whole script in that jiten posted in his last post.


jiten

QuoteOriginally posted by blackwings
QuoteOriginally posted by James
Hi

have this Script end DownloadBloker works ,but Immune User works not... (have PtokaX-16.05...maybe is this my Problem)
why it doesn't work is because you didn't copy the whole script in that jiten posted in his last post.
Indeed, there are some parts he didn't copy.
That's why it isn't working.

Best regards

James

well I use the full script (the last one by jiten) and the download blocker works but immune doesn't. Could it be that the script needs a part with userprofiles? Like 1 for Ops, 2 for regs, 3 for user and so on ????

--$Rev Blocker by jiten
-- restriction for MinSlots, MinShare and MaxHubs
-- Added: Immune Table for Non-Operators
-- some ideas taken from leech bot and ShaveShare v4.8 by Herodes


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

MinShare = 500*mb -- in MBs
MinSlots = 3
MaxHubs = 5
tImmune = { ["EL_DIABLO"] = 1, ["nick2"] = 1, } -- Non-Operators Immune List (["nick"] = 1)

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

ConnectToMeArrival = function(curUser,data)
   if not tImmune[curUser.sName] or not curUser.bOperator then
      if curUser.iShareSize < MinShare then
         return curUser:SendData("*** You have to share at least "..DoShareUnits(MinShare).." to be able to download."),1
      elseif curUser.iSlots < MinSlots then
         return curUser:SendData("*** You must have "..MinSlots.." open slots to be able do download."),1
      elseif curUser.iHubs > MaxHubs then
         return curUser:SendData("*** You can't be in more than "..MaxHubs.." hubs to be able do download."),1
      end
   end
end

RevConnectToMeArrival = ConnectToMeArrival

blackwings

#21
QuoteOriginally posted by James
well I use the full script (the last one by jiten) and the download blocker works but immune doesn't. Could it be that the script needs a part with userprofiles? Like 1 for Ops, 2 for regs, 3 for user and so on ????
no, this script only check people who isn't a op or have a username in the immune list. I don't really see why the immunelist doesn't work.

this shouldn't make a difference, but try this =
--$Rev Blocker by jiten
-- restriction for MinSlots, MinShare and MaxHubs
-- Added: Immune Table for Non-Operators
-- some ideas taken from leech bot and ShaveShare v4.8 by Herodes


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

MinShare = 500*mb -- in MBs
MinSlots = 3
MaxHubs = 5
tImmune = { ["EL_DIABLO"] = 1, ["nick2"] = 1, } -- Non-Operators Immune List (["nick"] = 1)

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

ConnectToMeArrival = function(curUser,data)
	if not curUser.bOperator then
		if not tImmune[curUser.sName] then
			if curUser.iShareSize < MinShare then
				return curUser:SendData("*** You have to share at least "..DoShareUnits(MinShare).." to be able to download."),1
			elseif curUser.iSlots < MinSlots then
				return curUser:SendData("*** You must have "..MinSlots.." open slots to be able do download."),1
			elseif curUser.iHubs > MaxHubs then
				return curUser:SendData("*** You can't be in more than "..MaxHubs.." hubs to be able do download."),1
			end
		end
	end
end 

RevConnectToMeArrival = ConnectToMeArrival


James

Yes Blackwings :D:D:D

now works...

Very Thanks to : Jiten @ Blackwings

greets James

?[-?Genius?-]?

Hi

Is possible this.   1/1/1 User and vip cont for max hubs, but Operator no count. Insert this in the script for me please.

Tanks :)
 
[code]
--$Rev Blocker by jiten
-- restriction for MinSlots, MinShare and MaxHubs
-- Added: Immune Table for Non-Operators
-- some ideas taken from leech bot and ShaveShare v4.8 by Herodes

MinShare = 500*mb -- in MBs
MinSlots = 3
MaxHubs = 5
tImmune = { ["nick1"] = 1, ["nick2"] = 1, } -- Non-Operators Immune List (["nick"] = 1)

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

ConnectToMeArrival = function(curUser,data)
   if not tImmune[curUser.sName] or not curUser.bOperator then
      if curUser.iShareSize < MinShare then
         return curUser:SendData("*** You have to share at least "..DoShareUnits(MinShare).." to be able to download."),1
      elseif curUser.iSlots < MinSlots then
         return curUser:SendData("*** You must have "..MinSlots.." open slots to be able do download."),1
      elseif curUser.iHubs > MaxHubs then
         return curUser:SendData("*** You can't be in more than "..MaxHubs.." hubs to be able do download."),1
      end
   end
end

RevConnectToMeArrival = ConnectToMeArrival
[\CODE]

[][][] Genius

jiten

Give this a try:
--$Rev Blocker by jiten
-- restriction for MinSlots, MinShare and MaxHubs
-- Added: Immune Table for Non-Operators
-- Changed: Normal and Reg Hub Check
-- some ideas taken from leech bot and ShaveShare v4.8 by Herodes


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

MinShare = 500*mb -- in MBs
MinSlots = 3
MaxHubs = 5
tImmune = { ["EL_DIABLO"] = 1, ["nick2"] = 1, } -- Non-Operators Immune List (["nick"] = 1)

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

ConnectToMeArrival = function(curUser,data)
	if not curUser.bOperator then
		if not tImmune[curUser.sName] then
			if curUser.iShareSize < MinShare then
				return curUser:SendData("*** You have to share at least "..DoShareUnits(MinShare).." to be able to download."),1
			elseif curUser.iSlots < MinSlots then
				return curUser:SendData("*** You must have "..MinSlots.." open slots to be able do download."),1
			elseif (curUser.iNormalHubs + curUser.iRegHubs) > MaxHubs then
				return curUser:SendData("*** You can't be in more than "..MaxHubs.." hubs to be able do download."),1
			end
		end
	end
end 

RevConnectToMeArrival = ConnectToMeArrival

Regards,

jiten

SMF spam blocked by CleanTalk