Passive users have 2 x bigger 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

Passive users have 2 x bigger min share

Started by enema, 23 September, 2004, 20:15:52

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

enema

Hi!

I know, I probably keep smart side of the forum bussy all the time with my freekin' ideas, but I was drinkin beer and I noticed, that I have to many passive users... Hate that s*it... So I figured out, that it would be cool, if the passive users would have 2 x bigger min share than active users.... Or something like that. Is it possible???

P.S.

I am learning how to make scripts on my own, so maybe like 6 months later I will give you more of my weird ideas already finished... who knows  ;)

bastya_elvtars

Hope this is what you need...

minshareforpassive=1 -- min. share for passive users in Gigabytes

--- code below, dont edit

function NewUserConnected(user)
	if strfind(user.sMyInfoString,"M:P") then
		seeshare(user)
		return 1
	end
end

function DataArrival(user,data)
	if strsub(data, 1, 7) == "$MyINFO" then
		if strfind(user.sMyInfoString,"M:P") then
			seeshare(user)
			return 1
		end
	end
end

function seeshare(user)
	local _,_,shareinbytes=strfind(user.sMyInfoString, "$(%d+)%$")
	if shareinbytes You do not meet the share minimum for passive users. You are being disconnected.")
		user:Disconnect()
	end
end
Everything could have been anything else and it would have just as much meaning.

enema

It doesnt work :( Thats probably because Im using RoboCop.... Maybe creators of robocop will include this feature in further robocop editions....

NightLitch

haven't tried it but it should work...

-------------------------------------------------
-- Works like this:
-- Enter RC_MinShare for users
-- The Share will double for passive users
-------------------------------------------------
-- By: NightLitch (2004)
-------------------------------------------------
RC_MinShare = "1 GB"
-------------------------------------------------
-- Don't edit --
-------------------------------------------------
sUnit = {}
sUnit["KB"]= 1024
sUnit["MB"]= 1048576
sUnit["GB"]= 1073741824
sUnit["TB"]= 1099511627776

function Main()
   if tonumber(RC_MinShare) == nil then s,e,num,cur = string.find(RC_MinShare, "(%d+)%s+(%S+)") RC_MinShare = num * sUnit[cur] end
end

function DataArrival(user,data)
	if strsub(data, 1, 7) == "$MyINFO" then
		if strfind(data,"M:P") then
			local _,_,share = (data, "(%d+)%$%|$")
			if tonumber(share) < tonumber(RC_MinShare * 2) then
				user:SendData(" You do not meet the minimum share for passive users. You are being disconnected.")
				user:Disconnect()
				return 1
			end
		end
	end
end
//NL

enema

nope, somethings wrong

Syntax error: `)' expected;
  last token read: `,' at line 25 in string "-------------------------------------------------
..."

nErBoS

Hi,

Found some bug, try ou this...

-------------------------------------------------
-- Works like this:
-- Enter RC_MinShare for users
-- The Share will double for passive users
-------------------------------------------------
-- By: NightLitch (2004)
-------------------------------------------------
RC_MinShare = "1 GB"
-------------------------------------------------
-- Don't edit --
-------------------------------------------------
sUnit = {}
sUnit["KB"]= 1024
sUnit["MB"]= 1048576
sUnit["GB"]= 1073741824
sUnit["TB"]= 1099511627776

function Main()
   if tonumber(RC_MinShare) == nil then s,e,num,cur = strfind(RC_MinShare, "(%d+)%s+(%S+)") RC_MinShare = num * sUnit[cur] end
end

function DataArrival(user,data)
	if strsub(data, 1, 7) == "$MyINFO" then
		if strfind(data,"M:P") then
			local _,_,share = strfind(data, "(%d+)%$%|$")
			if tonumber(share) < tonumber(RC_MinShare * 2) then
				user:SendData(" You do not meet the minimum share for passive users. You are being disconnected.")
				user:Disconnect()
				return 1
			end
		end
	end
end

Best regards, nErBoS
--## nErBoS Spot ##--

NightLitch

nice thanks nErBoS, I forgot to change some parts from Lua 5 to Lua 4. hehe
//NL

nErBoS

Hi,

hehe i have notice that. I have to start playing with Lua 5 as well.

Best regards, nErBoS
--## nErBoS Spot ##--

enema

thanks guys, youre the best ;)

enema

btw, I dont wanna sound like a lamer, but what is lua 5 or lua 4 that you are talking about???

NightLitch

QuoteOriginally posted by enema
btw, I dont wanna sound like a lamer, but what is lua 5 or lua 4 that you are talking about???

different version of Lua, the programming language PtokaX uses...

PtokaX use: Lua 4.0.1

BCDC use: Lua 5.0.2

/NightLitch
//NL

Modifier

Hi.

i like that script and it worked fine, but is there any way to add an option so it doesn't check VIP or OP share.
i was looking script like that for long time and was glad to find it    :)

bastya_elvtars

QuoteOriginally posted by Modifier
Hi.

i like that script and it worked fine, but is there any way to add an option so it doesn't check VIP or OP share.
i was looking script like that for long time and was glad to find it    :)

to which?
Everything could have been anything else and it would have just as much meaning.

Modifier

#13
that passive users minshare script, so it doesn't check passive OPs and VIPs share.
I have couple OP who are passive but i don't want that they have to share cause one of them is also hubowner and she want to keep her upload speed free for the hub.


hope you understand, cause my english ain't so good

Modifier

Could somebody help me for that script ?

Madman

#15
Try This.... =)
-------------------------------------------------
-- Works like this:
-- Enter RC_MinShare for users
-- The Share will double for passive users
-------------------------------------------------
-- By: NightLitch (2004)
-- Modded By Madman (2004)
-- Check What Profiles
-- Based On NightLitch's Ultimate Client Check
-------------------------------------------------
RC_MinShare = "1 GB"
-------------------------------------------------
-- Check What Profiles?
-------------------------------------------------
User = 1
Reg = 1
Vip = 0
Op = 0
Master = 0
-------------------------------------------------
-- Don't edit --
-------------------------------------------------
sUnit = {}
sUnit["KB"]= 1024
sUnit["MB"]= 1048576
sUnit["GB"]= 1073741824
sUnit["TB"]= 1099511627776

Profiles = {
	[-1] = 1, -- regular user
	[3] = 2, -- registered user
	[2] = 3,  -- vip user
	[1] = 4, -- operator
	[0] = 5, -- master/admin
}

Check = {
	[1] = {[1] = User},
	[2] = {[1] = Reg},
	[3] = {[1] = Vip},
	[4] = {[1] = Op},
	[5] = {[1] = Master},
}

function Main()
   if tonumber(RC_MinShare) == nil then s,e,num,cur = strfind(RC_MinShare, "(%d+)%s+(%S+)") RC_MinShare = num * sUnit[cur] end
end

function DataArrival(user,data)
	if Check[Profiles[user.iProfile] ][1]==1 then
		if strsub(data, 1, 7) == "$MyINFO" then
			if strfind(data,"M:P") then
				local _,_,share = strfind(data, "(%d+)%$%|$")
				if tonumber(share) < tonumber(RC_MinShare * 2) then
					user:SendData(" You do not meet the minimum share for passive users. You are being disconnected.")
					user:Disconnect()
					return 1
				end
			end
		end
	end
end
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Modifier

Thank you for that.   :)

Modifier

It gives me some error when it has been on for a couple of minutes ?

Syntax error: table index is nil
stack traceback:
   1:  function `DataArrival' at line 50

Madman

I know what makes the error...
Do you run Robocop or some other big bot?
if not RC then open my the Profiles.dat in Notepad and copy everything in it...
Then i can fix the error =)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Modifier

i have RC9.0C running, is that what cause that error ?

Madman

Kind of...
I Added The Profiles
NetFounder and Moderator

-------------------------------------------------
-- Works like this:
-- Enter RC_MinShare for users
-- The Share will double for passive users
-------------------------------------------------
-- By: NightLitch (2004)
-- Modded By Madman (2004)
-- Check What Profiles
-- Based On NightLitch's Ultimate Client Check
-- Added RC Profiles
-------------------------------------------------
RC_MinShare = "1 GB"
-------------------------------------------------
-- Check What Profiles?
-------------------------------------------------
User = 1
Reg = 1
Vip = 0
Op = 0
Master = 0
Moderator = 0
NetFounder = 0
-------------------------------------------------
-- Don't edit --
-------------------------------------------------
sUnit = {}
sUnit["KB"]= 1024
sUnit["MB"]= 1048576
sUnit["GB"]= 1073741824
sUnit["TB"]= 1099511627776

Profiles = {
	[-1] = 1, -- regular user
	[3] = 2, -- registered user
	[2] = 3,  -- vip user
	[1] = 4, -- operator
	[0] = 5, -- master/admin
	[4] = 6,   -- Moderator
	[5] = 7,   -- NetFounder
}

Check = {
	[1] = {[1] = User},
	[2] = {[1] = Reg},
	[3] = {[1] = Vip},
	[4] = {[1] = Op},
	[5] = {[1] = Master},
	[6] = {[1] = Moderator},
	[7] = {[1] = NetFounder},

}

function Main()
	if tonumber(RC_MinShare) == nil then s,e,num,cur = strfind(RC_MinShare, "(%d+)%s+(%S+)") RC_MinShare = num * sUnit[cur] end
end

function DataArrival(user,data)
	if Check[Profiles[user.iProfile] ][1]==1 then
		if strsub(data, 1, 7) == "$MyINFO" then
			if strfind(data,"M:P") then
				local _,_,share = strfind(data, "(%d+)%$%|$")
				if tonumber(share) < tonumber(RC_MinShare * 2) then
					user:SendData(" You do not meet the minimum share for passive users. You are being disconnected.")
					user:Disconnect()
					return 1
				end
			end
		end
	end
end
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Modifier

Thanks, i'll test it now

SMF spam blocked by CleanTalk