PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: -PT-B2S on 06 April, 2005, 08:44:44

Title: block download if not min share
Post by: -PT-B2S on 06 April, 2005, 08:44:44
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
Title:
Post by: jiten on 06 April, 2005, 11:12:16
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
Title:
Post by: Optimus on 06 April, 2005, 11:32:18
--$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
Title:
Post by: jiten on 06 April, 2005, 12:09:01
Thanks for the hint  ;)
Title:
Post by: Optimus on 06 April, 2005, 12:22:05
yw jiten
Title: thnks
Post by: -PT-B2S on 06 April, 2005, 13:44:33
thank you very much. :)
Title:
Post by: jiten on 06 April, 2005, 13:57:12
yw  :]

PS: First post updated with Optimus' hint.
Title:
Post by: Krysalis on 10 June, 2005, 12:12:11
Hello jiten,

can u add check Hubcount?
And if the User in More he will also blocked?
Title:
Post by: jiten on 10 June, 2005, 12:28:36
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
Title:
Post by: Krysalis on 10 June, 2005, 13:43:08
Seems to work perfekt. Thank you ;-)
Title:
Post by: James on 11 June, 2005, 10:19:32
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?
Title:
Post by: jiten on 11 June, 2005, 10:34:44
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
Title:
Post by: James on 11 June, 2005, 11:07:13
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 ?
Title:
Post by: jiten on 11 June, 2005, 11:15:14
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
Title:
Post by: James on 11 June, 2005, 11:26:10
yes...now works:D:D:D

  Thanks for helping.
Title:
Post by: James on 11 June, 2005, 23:02:06
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
Title:
Post by: jiten on 11 June, 2005, 23:14:03
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
Title:
Post by: James on 12 June, 2005, 08:45:38
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
Title:
Post by: blackwings on 12 June, 2005, 08:53:27
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.
Title:
Post by: jiten on 12 June, 2005, 09:54:31
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
Title:
Post by: James on 12 June, 2005, 10:00:41
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
Title:
Post by: blackwings on 12 June, 2005, 10:09:08
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
Title:
Post by: James on 12 June, 2005, 11:40:16
Yes Blackwings :D:D:D

now works...

Very Thanks to : Jiten @ Blackwings

greets James
Title:
Post by: ?[-?Genius?-]? on 19 June, 2005, 16:55:37
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
Title:
Post by: jiten on 19 June, 2005, 18:26:25
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
Title:
Post by: Xanus on 24 July, 2005, 16:00:05
Sorry guys, is it me or is it still allowed downloads even with 0 mbs of share ?
I've tested.

Btw, is it possible to extend a not alowed profile also to the search's use ?



Cyaaaa [[[]]