Author Topic: Request for all-in-one slot,d/l, and u/l script if possible.  (Read 3049 times)

0 Members and 1 Guest are viewing this topic.

Offline crazytown232001

  • Junior Member
  • **
  • Posts: 18
  • Karma: +0/-0
Request for all-in-one slot,d/l, and u/l script if possible.
« on: 20 September, 2011, 02:44:51 »
I have searched the board extensively for what I am looking for.  I have found similar scripts, but not quite what I need for my hub.

Can someone please write a script that would allow editable settings for download maximum limits, upload minimum limits, and upload slot minimum limits that can be set differently for each profile?

Also, I am hoping it is possible to have it continue to check rather than just the initial connect and to actually show a message on disconnect explaining why they were disconnected.

The closest one I have found is this, but it doesn't quite do what I am hoping for:

Have2Limit - close, but doesn't allow all three limiters I am hoping for and doesn't allow setting each profile differently (only reg and non reg):

url=http://forum.ptokax.org/index.php?topic=5435#msg55600

I am wanting to reward VIP's (consistent sharers) with higher download speeds and require lower upload speeds, while punishing leechers with lower download speeds and require higher upload speeds and slots.

Kind of the opposite version of American Idiot's Upload limit {1024} script with more than just upload settings.

Thanks to anyone who will take this up.
« Last Edit: 20 September, 2011, 02:58:05 by crazytown232001 »

PtokaX forum

Request for all-in-one slot,d/l, and u/l script if possible.
« on: 20 September, 2011, 02:44:51 »

Offline crazytown232001

  • Junior Member
  • **
  • Posts: 18
  • Karma: +0/-0
Re: Request for all-in-one slot,d/l, and u/l script if possible.
« Reply #1 on: 23 September, 2011, 05:29:45 »
Thank a bunch for the response.  When I mention setting limits, I was to obtuse in my description.  I realize there is no way to limit speed between clients, but what I meant was on original connection, like when a hub checks the slots and won't let those connect who have less than required slots open, and instead, displays a message requesting them to open more slots.

I could do without it constantly checking and only check on connect, but I have been dropped from hubs when I was no longer sharing enough material (usually when my external harddrive was unplugged), so I know there has to be some way their script checked to make sure the settings weren't changed.  From looking at other scripts, I think it has to do with MyInfo requests or something.

Please let me know if you think it to be feasible or not.  Thanks again.

Offline crazytown232001

  • Junior Member
  • **
  • Posts: 18
  • Karma: +0/-0
Re: Request for all-in-one slot,d/l, and u/l script if possible.
« Reply #2 on: 24 September, 2011, 02:27:06 »
Actually, just PM'ed you with my current problem. 

I listed out the scripts I am playing with trying to make work.  I too originally thought I could "franken-stitch" 2 or 3 scripts together to accomplish my desired result.  Unfortunately, the closest I have come was your old 1024 limiter script, which seems to not work on the current version of Ptokax.  At least, it doesn't seem so.  I am always getting the message to increase upload speeds, no matter what I have them set to.

The one I am hoping to combine to is Twisted-Devil's script.  It has the functionality of limiting slots and shared, with options per profile.

Code: [Select]
-- Min-Share/sLOT Script
-- By Tw?sT?d-d?v?l    21/2/08
-- [] = Profile , {} = Minshare .
-- If setting minshare to KB,MB,GB or TB remember to change the message from set amount :)
-- Here is byte table (has best i can find)
-- 1024 = KB
-- 1048576 = MB
-- 1073741824 = GB
-- 1099511627776 = TB
-- Added redirect addy
-- Added Slot-Checking too
-------------------------------------------------------------
Bot = "Security"
Hub ="dchub://test.no-ip.org"
Bytes = 1073741824       
Share = {
[0] = {0},   -- Master
[1] = {0},   -- Operator
[2] = {20},   -- VIP
[3] = {40},   -- Registered
[-1] = {60},  -- Unreg
}
Slots = {
         [0] = {0},   -- Master
[1] = {0},   -- Operator
[2] = {2},   -- VIP
[3] = {4},   -- Registered
[-1] = {6},  -- Unreg
}
MinUpload = {
         [0] = {0},   -- Master
[1] = {0},   -- Operator
[2] = {40},   -- VIP
[3] = {80},   -- Registered
[-1] = {120},  -- Unreg
}

MaxDownload = {
         [0] = {1000},   -- Master
[1] = {1000},   -- Operator
[2] = {300},   -- VIP
[3] = {200},   -- Registered
[-1] = {100},  -- Unreg
}

--------------------------------------------------------------

function MyINFOArrival(user,data)
Core.GetUserAllData(user)
if Share[user.iProfile] then
local minShare = Share[user.iProfile][1]*Bytes
local minNr = Share[user.iProfile][1]
if user.iShareSize < minShare then
Core.SendToNick(user.sNick,"<"..Bot.."> Sorry.  Your level requires

you to have "..minNr.." GB Minimal share.\n".. "\t<"..Bot..">To get to a higher level, share more files, more often.")
Core.Disconnect(user)
        end

--------------------------------------------------------------

                if Slots[user.iProfile] then
local minSlots = Slots[user.iProfile][1]
local minNr = Slots[user.iProfile][1]
if user.iSlots < minSlots then
Core.SendToNick(user.sNick,"<"..Bot.."> Sorry.  Your level requires
you to have "..minNr.." slots open.\n".. "\t<"..Bot..">To get to a higher level, share more files, more often.")
Core.Disconnect(user)
        end

--------------------------------------------------------------

if MinUpload[user.iProfile] then
local minUpload =


--------------------------------------------------------------

if MaxDownload[user.iProfile] then
local maxDownload =


--------------------------------------------------------------

end
       end
end

Obviously, I have to fill in code for the Upload and Download limiting sections.  I am trying to decipher bastya_elvtars's code, as it is for the current Ptokax and seems to pull the upload limits using a function I have no idea of.

Code: [Select]
function checklimit(user)
if string.find(user.sMyInfoString,"[BLU]") then
local upstream
local _,_,Slots = string.find(user.sMyInfoString, "H:[^,]+,S:(%d+).*>")
local _,_,limit1 = string.find(user.sMyInfoString,"[BLU]:(%d+)")
local _,_,limit2 = string.find(user.sMyInfoString,"F:%d+/(%d+)")

...

function investigate(user)
if checklevel > userlevels[user.iProfile] then
local limit = checklimit(user)
if not limit or limit > upload_limit then
user:SendData("LimitChk","Please set your upload limit to a maximum of "..upload_limit.." kB/s in your client. If you do not have a client capable of limiting, look at [URL]http://utrum.dyndns.org:8000/[/URL]")

If someone could point me to the part that actually pulls the upload limit from the MyINFO or sMyInfoString, that would be great.  If anyone knows the method to pull from the download string, I would really appreciate that info too.  I am pretty sure it would be very similar to the upload limit request, but a different parameter likely.

Thanks.
« Last Edit: 24 September, 2011, 09:56:16 by crazytown232001 »

Offline crazytown232001

  • Junior Member
  • **
  • Posts: 18
  • Karma: +0/-0
Re: Request for all-in-one slot,d/l, and u/l script if possible.
« Reply #3 on: 24 September, 2011, 13:47:42 »
Ok.  Stumbled onto your updated Uplimit file.

I have set up what I thought would work for the minimum upload part.  It loads without errors, but doesn't seem to kick me out if my upload is too low.

Can anyone help? 

Current script I have been working with:

Code: [Select]
-- All-In-One Script
-- Compilation of scripts from Tw?sT?d-d?v?l and American Idiot
-- [] = Profile , {} = Minshare .
-- If setting minshare to KB,MB,GB or TB remember to change the message from set amount :)
-- Here is byte table (has best i can find)
-- 1024 = KB
-- 1048576 = MB
-- 1073741824 = GB
-- 1099511627776 = TB
-- Added redirect addy
-- Added Slot-Checking too
-------------------------------------------------------------
Bot = "Security"
Hub ="dchub://test.no-ip.org"
Bytes = 1073741824       
Share = {
[0] = {0},       -- Master
[1] = {0},       -- Operator
[2] = {20},     -- VIP
[3] = {40},     -- Registered
[-1] = {60},    -- Unreg
}
Slots = {
         [0] = {0},       -- Master
[1] = {0},       -- Operator
[2] = {2},       -- VIP
[3] = {4},       -- Registered
[-1] = {6},      -- Unreg
}
MinUpload = {
         [0] = {0},                 -- Master
[1] = {0},                 -- Operator
[2] = {1024*60},     -- VIP
[3] = {1024*90},     -- Registered
[-1] = {1024*120},  -- Unreg
}

MaxDownload = {
         [0] = {1024*1000},  -- Master
[1] = {1024*1000},  -- Operator
[2] = {1024*300},    -- VIP
[3] = {1024*200},    -- Registered
[-1] = {1024*100},   -- Unreg
}

--------------------------------------------------------------
--Share

function MyINFOArrival(user,data)
Core.GetUserAllData(user)
if Share[user.iProfile] then
local minShare = Share[user.iProfile][1]*Bytes
local minNr = Share[user.iProfile][1]
if user.iShareSize < minShare then
Core.SendToNick(user.sNick,"<"..Bot.."> Sorry.  Your level requires

you to have "..minNr.." GB Minimal share.\n".. "\t<"..Bot..">To get to a higher level, share more files, more often.")
Core.Disconnect(user)
        end

--------------------------------------------------------------
--Slots

                if Slots[user.iProfile] then
local minSlots = Slots[user.iProfile][1]
local minNr = Slots[user.iProfile][1]
if user.iSlots < minSlots then
Core.SendToNick(user.sNick,"<"..Bot.."> Sorry.  Your level requires
you to have "..minNr.." slots open.\n".. "\t<"..Bot..">To get to a higher level, share more files, more often.")
Core.Disconnect(user)
        end

--------------------------------------------------------------
--MinUpload

-- Set minimum upload limit required, in bits/sec. [1024*10 = 10Kb./s]
local minlimit = MinUpload[user.iProfile][1]

UserConnected = function(user)
local val = Core.GetUserValue(user,22)
val = tonumber(val) or 0
if val < minlimit then

Core.SendToNick(user.sNick,"<"..Bot.."> Sorry.  Your levelrequires you to have

"..MinUpload.." kb/s minimal upload limit.\n".. "\tTo get to a higher level, share more files, more often.")
Core.Disconnect(user)
end

RegConnected,OpConnected,MyINFOArrival = UserConnected,UserConnected,UserConnected
end


--------------------------------------------------------------
--MaxDownload

-- Set maximum download limit required, in bits/sec. [1024*10 = 10Kb./s]
local maxlimit = MaxUpload[user.iProfile][1]

UserConnected2 = function(user)
local val = Core.GetUserValue(user,22)
val = tonumber(val) or 0
if val > maxlimit then

Core.SendToNick(user.sNick,"<"..Bot.."> Sorry.  Your level requires you to have

"..MaxUpload.." kb/s maximum download limit.\n".. "\tTo get to a higher level, share more files, more often.")
Core.Disconnect(user)
end

RegConnected,OpConnected,MyINFOArrival = UserConnected2,UserConnected2,UserConnected2
end

--------------------------------------------------------------
end
end
end

OK.  I know this isn't right.  Like I mentioned, the upload limiter isn't dropping users who's limits are too low.  As for the download section, I still don't know how to check download limit settings.  I think the check is done here:

Code: [Select]
UserConnected = function(user)
local val = Core.GetUserValue(user,22)
val = tonumber(val) or 0
if val > maxlimit then

But if so, I have no clue what (user,22) is.  I assume 22 is a pointer to the upload limiter.  If this is true, does anyone know the download limiter?

Can someone check this and tell me what is wrong with it?
« Last Edit: 24 September, 2011, 13:52:50 by crazytown232001 »

Offline the-master

  • Triple Ace
  • **
  • Posts: 220
  • Karma: +10/-15
Re: Request for all-in-one slot,d/l, and u/l script if possible.
« Reply #4 on: 26 September, 2011, 18:24:02 »
And besides all American Idiot said, You can't meassure the upload speed by script, perhaps the users are uploading to several users you can't see or know and the measurement is incorrect.. this is simply bullsh*t
keep on sharing :)
dchub://kickincountryhub.no-ip.org

Offline crazytown232001

  • Junior Member
  • **
  • Posts: 18
  • Karma: +0/-0
Re: Request for all-in-one slot,d/l, and u/l script if possible.
« Reply #5 on: 27 September, 2011, 10:15:45 »
Thanks American Idiot for all your help!  After practically learning LUA, I finally got it working.  Had to use Legacy DC:PRO client to get the tags I want, but it is working perfectly now. 

Sorry for the misunderstanding about Ptokax stripping tag.  My dumbass didn't have the Upload and Download limits set in DC:PRO, so no tags were shown.  As soon as I set them, the F:x/y tags popped right up.

Now for the big question...does anyone know a more recent client with download tag available? 

The other option for me is to go through open source code of my favorite client, FlylinkDC, and try to find where the tags are set, and then add a tag that pulls the download limit.  If I mimic DC:PRO with an "F" tag, I should be able to use my same script.

Thanks again.

Offline crazytown232001

  • Junior Member
  • **
  • Posts: 18
  • Karma: +0/-0
Re: Request for all-in-one slot,d/l, and u/l script if possible.
« Reply #6 on: 28 September, 2011, 07:44:36 »
Since this is a niche kind of deal, I will post my LUA on request.  If no one is interested, it probably isn't worth it.

I also modified the karma script so that it is a point system, letting profile specific people add or subtract points from a member.

I set mine so my Admins (Ops) and myself (Master) can add or remove points.  I took out all the cutesy messages and removed the time related function so points can be added and subtracted freely.

The members have the option to view the Points Board, but that is all.

I will likely tinker with it so once someone's points go to zero or below, it unregisters them and disconnects them.  Registration is required to connect to my hub.

Let me know if anyone wants the script posted.  Otherwise I won't post it since it kind of goes against most peoples' ideas that hubs are only for sharing freely.

I would love to believe this concept too, but human nature takes a big dump right in the middle of it.  :'( Say hypothetically, my hub shared porn (that can't be, of course, since that would be pirating ::)), but out of the 20 members, only 3 actually purchased and shared any material.  The other 17 just waited for these folks to share out their new contributions each month, and then sucked their bandwidth dry getting all they can from these generous souls.

Say you could put your contributors in a VIP profile and leechers in a Guest profile.  Say you could keep the guests at low download levels and high upload levels, and vice-versa for your VIPs.  Say you explained that contributing something, anything, could bump you up to higher profile levels.  Say new material shared earned you points, and not contributing anything over a month caused you to lose points.  If you lose all your points, you get bumped off and have to reregister (registration/membership requires sharing at least one new thing).

You can see how this would make the hub community much better.  No bottlenecks with queues of leeches downloading from VIPs.  Incentives to move from a lurker/leecher to a participating member.

At least it seems good in my eyes. :P  To each his own, though.  I realize I've taken the hub concept way past what it was ever meant to be, but it was fun at least.

Thanks again for all good advise and guidance. :D

Offline crazytown232001

  • Junior Member
  • **
  • Posts: 18
  • Karma: +0/-0
Re: Request for all-in-one slot,d/l, and u/l script if possible.
« Reply #7 on: 06 October, 2011, 16:45:12 »
I got a programmer to modify DC++ so it has the upload and download limit in tag.  He also modified script so that it works more effectively.  If this is requested by anyone, I will be happy to post it.  Thanks.

PtokaX forum

Re: Request for all-in-one slot,d/l, and u/l script if possible.
« Reply #7 on: 06 October, 2011, 16:45:12 »