average share script
 

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

average share script

Started by V1per, 21 September, 2006, 10:15:34

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

V1per

hi,i've been away from ptokax for a couple of years now & just recently returned,i used this board quite a lot & see that things have changed a lot too! anyway 1 of my favourite scripts back then was the average share that Herodes kindly made for me & i was wondering if anyone would be so kind to convert it for me to 5.1,thnx   :)

Code:
-- AverageShare Bot
-- request: ? Viper ?
-- script Herodes // 4:15 pm 31-5-2004
-- a little fix :P stupid mistake ...
-- fixed the display of mb, gb, tb
-- added categorized messages for Below(10 gb, 25 gb, 50 gb, 100 gb) 
-- 			and Above( 50 gb, 100gb, 250gb, 500gb)
kb = 1024
mb = (1024^2)
gb = (1024^3)
tb = (1024^4)

function NewUserConnected(user, data)
	AverageShare(user)
end

function AverageShare(user)
local s,e,share = strfind(user.sMyInfoString, "$(%d+)%$")						-- user share from MyInfo	(bytes)
hubshare = frmHub:GetCurrentShareAmount()							-- hubshare 		(bytes)
userCount = frmHub:GetUsersCount()								-- Usercount
	fullShare = tonumber(share+hubshare)									-- hubshare + usershare 	(bytes)
	unfAvShare = tonumber(fullShare/userCount)								-- average share		(bytes per user)
	difShareAbove = tonumber(share) - tonumber(unfAvShare)							-- determining what's above the av. share
	difShareBelow = tonumber(unfAvShare) - tonumber(share)							-- determining what's below the av. share
		hubShr = ProperUnits(fullShare)								-- formatting the hubshare...
		avhubShr = ProperUnits(unfAvShare)								-- formatting the average share...
		AboveShr = ProperUnits(difShareAbove)								-- formatting the above dif...
		BelowShr = ProperUnits(difShareBelow)								-- formatting the below dif...

	Msg = "\r\n-=?- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "			
	Msg = Msg.."\r\n-=?=- \t"..userCount.." Users in the hub are currently sharing "..hubShr.." giving an average of "..avhubShr.." each."		-- default message
	if tonumber(share) >= unfAvShare then									-- for the users above average
		Msg = Msg.."\r\n-=?=-\tYou are "..AboveShr.." above the Average per user share... you're immense!!!"
		if tonumber(share/gb) >= 50 and tonumber(share/gb) < 100 then					-- for the users between 50gb and 100gb
			Msg = Msg.."\r\n-=?=-\tYou have boosted the average up,you're amazing!!!"		
		elseif tonumber(share/gb) >= 100 and tonumber(share/gb) < 250 then 					-- for the users between 100gb and 250gb
			Msg = Msg.."\r\n-=?=-\tYou have boosted the average up,There are people that will pay for your share!!!"
		elseif tonumber(share/gb) >= 250 and tonumber(share/gb) < 500 then 					-- for the users between 250gb and 100gb
			Msg = Msg.."\r\n-=?=-\tYou have boosted the average up,There are people that will kill for your share!!!"
		elseif tonumber(share/gb) >= 500 then 								-- for the users above 500gb
			Msg = Msg.."\r\n-=?=-\tThere are people that will die for your share, or even a slot!!!"
		end
	Msg = Msg.."\r\n-=?=-\t ... and yes we need you here!  ;)"
	end
	if tonumber(share) < unfAvShare then									-- for the users below average
		Msg = Msg.."\r\n-=?=-\tYou are "..BelowShr.." below the Average share... try to get more stuff in ur share & be above average!"
		if tonumber(share/gb) >= 10 and tonumber(share/gb) < 25 then					-- for the users between 10gb and 25gb
			Msg = Msg.."\r\n-=?=-\tYou are VERY small !!!"
		elseif tonumber(share/gb) >= 25 and tonumber(share/gb) < 50 then 					-- for the users between 25gb and 50gb
			Msg = Msg.."\r\n-=?=-\tYou are small!!!"
		elseif tonumber(share/gb) >= 50 and tonumber(share/gb) < 100 then			 		-- for the users between 50gb and 100gb
			Msg = Msg.."\r\n-=?=-\tI bet you can try harder to raise your sharesize!!!"
		elseif tonumber(share/gb) >= 100 then								-- for the users above 100gb
			Msg = Msg.."\r\n-=?=-\tIt's not that your share ain't big, it's that there are bigger!!!"
		end
	Msg = Msg.."\r\n-=?=-\t ... still,... your most welcome!  ;)"
	end
	Msg = Msg.."\r\n-=?- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
user:SendData("ShareBot", Msg)
end

function ProperUnits(data)
if tonumber(data) >= (1024^2) and tonumber(data) < (1024^3) then
	FormattedData = format("%0.2f", (data/(1024^2))).." MB"
elseif tonumber(data) >= (1024^3) and tonumber(data) < (1024^4) then 
	FormattedData = format("%0.2f", (data/(1024^3))).." GB"
elseif tonumber(data) >= (1024^4) then 
	FormattedData = format("%0.2f", (data/(1024^4))).." TB"
else FormattedData = format("%0.2f", (data/(1024))).." KB"
end
return FormattedData
end


Psycho_Chihuahua

PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

V1per

thnx psycho,i did miss that when searching through,but the average share one is more personal making the user feel that they can add more by not being up to average & it does work,i remember the hubs share almost doubled within a few months of puting that script in,the recordbot only shows the top sharer & says nothing really to the user about their share & how good or bad the size is,i tried Mutor's share tool too,that was quite amusing but wasnt a real average only based on what you decided was average,thnx again

Herodes

#3
V1per requested to take some time with the script,... so here it is ..
it is not tested so please do the honours.. report if there are any problems... ;)

-- AverageShare Bot
-- request: ¤ Viper ¤
-- script Herodes // 4:15 pm 31-5-2004
-- a little fix :P stupid mistake ...
-- fixed the display of mb, gb, tb
-- added categorized messages for Below(10 gb, 25 gb, 50 gb, 100 gb)
-- 			and Above( 50 gb, 100gb, 250gb, 500gb)
--- touched by Herodes again on 22-09-2006
-- made for Lua 5.x ... upon Viper's request ;)


function NewUserConnected(user, data)
	local ProperUnits = function( i )
	local i = tonumber(i)
	if i >= (1024^2) then
		if i >= (1024^3) then
			if i >= (1024^4) then return string.format("%.2f", (data/(1024^4))).." TB"; end
				return string.format("%.2f", (data/(1024^3))).." GB"
			end; return string.format("%.2f", (data/(1024^2))).." MB"
		end;return string.format("%.2f", (data/(1024))).." KB"
	end
	if user.iShareSize > 0 then
		local iAverageShare = frmHub:GetCurrentShareAmount() / frmHub:GetUsersCount()
		local m = "\r\n-=¦- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
		m = m.."\r\n-=¦=- \t"..frmHub:GetUsersCount().." Users in the hub are currently sharing "..frmHub:GetCurrentShareAmount().." giving an average of "..ProperUnits(iAverageShare).." each."
		if user.iShare >= iAverageShare then
			m = m.."\r\n-=¦=-\tYou are "..(ProperUnits( user.iShareSize - iAverageShare )).." above the Average per user share... you're immense!!!"
			local iShare = ( user.iShare / 1024^3)
			if iShare >= 50 then
				if iShare >= 100 then
					if iShare >=250 then
						if iShare >= 500 then m = m.."\r\n-=¦=-\tThere are people that will die for your share, or even a slot!!!"
						else m = m.."\r\n-=¦=-\tYou have boosted the average up,There are people that will kill for your share!!!"
						end
					else m = m.."\r\n-=¦=-\tYou have boosted the average up,There are people that will pay for your share!!!"
					end
				else m = m.."\r\n-=¦=-\tYou have boosted the average up,you're amazing!!!"
				end
			end
			m = m.."\r\n-=¦=-\t ... and yes we need you here!  ;)"
		elseif user.iShareSize < iAverageShare then
			m = m.."\r\n-=¦=-\tYou are "..(ProperUnits( iAverageShare - user.iShareSize) ).." below the Average share... try to get more stuff in ur share & be above average!"
			local iShare = (user.iShareSize / 1024^3)
			if iShare >= 10 then
				if iShare >= 25 then
					if iShare >= 50 then
						if iShare >= 100 then m = m.."\r\n-=¦=-\tIt's not that your share ain't big, it's that there are bigger!!!"
						else m = m.."\r\n-=¦=-\tI bet you can try harder to raise your sharesize!!!"
						end
					else m = m.."\r\n-=¦=-\tYou are small!!!"
					end
				else m = m.."\r\n-=¦=-\tYou are VERY small !!!"
				end
			end
			m = m.."\r\n-=¦=-\t ... still,... your most welcome!  ;)"
		end
		user:SendData( "ShareBot", m.."\r\n-=¦- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " )
	end
end

OpConnected = NewUserConnected

Psycho_Chihuahua

There is an Error somewhere Herodes

[12:39] Syntax ...\0.3.5.1c.lua5.0.3\scripts\avrgshr.lua:13: attempt to compare number with nil
stack traceback:
	...\0.3.5.1c.lua5.0.3\scripts\avrgshr.lua:13: in function `NewUserConnected'
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Herodes

Quote from: Psycho_Chihuahua on 22 September, 2006, 12:40:46
There is an Error somewhere Herodes

[12:39] Syntax ...\0.3.5.1c.lua5.0.3\scripts\avrgshr.lua:13: attempt to compare number with nil
stack traceback:
	...\0.3.5.1c.lua5.0.3\scripts\avrgshr.lua:13: in function `NewUserConnected'

Thx Psycho,... post edited...

Psycho_Chihuahua

still something wrong m8 ;)

Error Lua 5.1.1
[13:36] Syntax ...\0.3.5.1a.lua5.1.1\scripts\avrgshr.lua:23: division by zero
stack traceback:
	...\0.3.5.1a.lua5.1.1\scripts\avrgshr.lua:23: in function <...\0.3.5.1a.lua5.1.1\scripts\avrgshr.lua:12>


Error Lua 5.0.3
[13:38] Syntax ...\0.3.5.1a.lua5.0.3\scripts\avrgshr.lua:23: division by zero
stack traceback:
	...\0.3.5.1a.lua5.0.3\scripts\avrgshr.lua:23: in function `OpConnected'


Hope it helps you find the bugger bug ;)
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Herodes

#7
Thx again Psycho... I was waiting for this one to come up,... I hoped it didn't, but it did ...
so here is the update ;)
-- AverageShare Bot
-- request: ¤ Viper ¤
-- script Herodes // 4:15 pm 31-5-2004
-- a little fix :P stupid mistake ...
-- fixed the display of mb, gb, tb
-- added categorized messages for Below(10 gb, 25 gb, 50 gb, 100 gb)
-- 			and Above( 50 gb, 100gb, 250gb, 500gb)
--- touched by Herodes again on 22-09-2006
-- made for Lua 5.x ... upon Viper's request ;)
-- Thx to Psycho_Chihuahua for testing this out and giving feedback...

function NewUserConnected(user, data)

	local ProperUnits = function( i )
		local i = tonumber(i)
		if i == 0 then return "0.00 KB"; end
		if i >= (1024^2) then
			if i >= (1024^3) then
				if i >= (1024^4) then return string.format("%.2f", (i/(1024^4))).." TB"; end
				return string.format("%.2f", (i/(1024^3))).." GB"
			end; return string.format("%.2f", (i/(1024^2))).." MB"
		end;return string.format("%.2f", (i/(1024))).." KB"
	end

	local SafeDivide = function( a, b )
		if ( a == 0 and b ~= 0 ) or ( a == 0 and b == 0 )then return 0; end
		if b == 0 and a ~= 0 then return 1; end
		return a/b
	end

	local iAverageShare = SafeDivide(frmHub:GetCurrentShareAmount(), frmHub:GetUsersCount() )

	if user.iShareSize > 0 then
		local m = "\r\n-=¦- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
		m = m.."\r\n-=¦=- \t"..frmHub:GetUsersCount().." Users in the hub are currently sharing "..frmHub:GetCurrentShareAmount().." giving an average of "..ProperUnits(iAverageShare).." each."
		if user.iShare >= iAverageShare then
			m = m.."\r\n-=¦=-\tYou are "..(ProperUnits( user.iShareSize - iAverageShare )).." above the Average per user share... you're immense!!!"
			local iShare = SafeDivide(user.iShare, 1024^3)
			if iShare >= 50 and iShare < 100 then m = m.."\r\n-=¦=-\tYou have boosted the average up,you're amazing!!!"
			elseif iShare >= 100 and iShare < 250 then m = m.."\r\n-=¦=-\tYou have boosted the average up,There are people that will pay for your share!!!"
			elseif iShare >=250 and iShare < 500 then m = m.."\r\n-=¦=-\tYou have boosted the average up,There are people that will kill for your share!!!"
			elseif iShare >= 500 then m = m.."\r\n-=¦=-\tThere are people that will die for your share, or even a slot!!!"
			end
			m = m.."\r\n-=¦=-\t ... and yes we need you here!  ;)"
		elseif user.iShareSize < iAverageShare then
			m = m.."\r\n-=¦=-\tYou are "..(ProperUnits( iAverageShare - user.iShareSize) ).." below the Average share... try to get more stuff in ur share & be above average!"
			local iShare = SafeDivide(user.iShare, 1024^3)
			if iShare >= 10 and iShare < 25 then m = m.."\r\n-=¦=-\tYou are VERY small !!!"
			elseif iShare >= 25 and iShare < 50 then m = m.."\r\n-=¦=-\tYou are small!!!"
			elseif iShare >= 50 and iShare < 100 then m = m.."\r\n-=¦=-\tI bet you can try harder to raise your sharesize!!!"
			elseif iShare >= 100 then m = m.."\r\n-=¦=-\tIt's not that your share ain't big, it's that there are bigger!!!"
			end
			m = m.."\r\n-=¦=-\t ... still,... your most welcome!  ;)"
		end
		user:SendData( "ShareBot", m.."\r\n-=¦- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " )
	end
end

OpConnected = NewUserConnected

TiMeTrAVelleR

14:23] Syntax ...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:35: attempt to compare number with nil
stack traceback:
   ...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:35: in function <...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:12>
[14:24] Syntax ...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:35: attempt to compare number with nil
stack traceback:
   ...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:35: in function <...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:12>

Herodes

Quote from: T?M??r?V?ll?R on 22 September, 2006, 14:26:34
14:23] Syntax ...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:35: attempt to compare number with nil
stack traceback:
   ...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:35: in function <...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:12>
[14:24] Syntax ...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:35: attempt to compare number with nil
stack traceback:
   ...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:35: in function <...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:12>

thx and please grab again,....
This sculpture is done using the dripping water method,...
I don't have the time to lift the hammer ;)

V1per

thnx for ur help on this guys,i really appreciate it & nice to see u again herodes :)

TiMeTrAVelleR

[14:57] Syntax ...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:36: attempt to compare number with nil
stack traceback:
   ...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:36: in function <...tHub Leviathan Lua 5.11\scripts\AverageShare Bot.lua:12>

drip again ;)

Herodes

#12
Ok now it should be cool,... I tested it ,... so I think that the party is up,...
runs on 56kb of mem through ptokax,...

-- AverageShare Bot
-- request: ¤ Viper ¤
-- script Herodes // 4:15 pm 31-5-2004
-- a little fix :P stupid mistake ...
-- fixed the display of mb, gb, tb
-- added categorized messages for Below(10 gb, 25 gb, 50 gb, 100 gb)
-- 			and Above( 50 gb, 100gb, 250gb, 500gb)
--- touched by Herodes again on 22-09-2006
-- made for Lua 5.x ... upon Viper's request ;)
-- Thx to Psycho_Chihuahua and TïMê†råVêlléR for testing this out and giving feedback...

function NewUserConnected(user, data)
	if (frmHub:GetUsersCount() > 2) and (frmHub:GetCurrentShareAmount() > 0) and (user.iShareSize > 0) then
		local ProperUnits = function( i )
			local i = tonumber(i)
			if i == 0 then return "0.00 KB"; end
			if i >= (1024^2) then
				if i >= (1024^3) then
					if i >= (1024^4) then return string.format("%.2f", (i/(1024^4))).." TB"; end
					return string.format("%.2f", (i/(1024^3))).." GB"
				end; return string.format("%.2f", (i/(1024^2))).." MB"
			end;return string.format("%.2f", (i/(1024))).." KB"
		end
		local SafeDivide = function( a, b )
			if ( a == 0 and b ~= 0 ) or ( a == 0 and b == 0 )then return 0; end
			if b == 0 and a ~= 0 then return 1; end
			return a/b
		end
		local iAverageShare = SafeDivide( frmHub:GetCurrentShareAmount(), frmHub:GetUsersCount() )
		local m = "\r\n-=¦- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
		m = m.."\r\n-=¦=- \t"..frmHub:GetUsersCount().." Users in the hub are currently sharing "..ProperUnits(frmHub:GetCurrentShareAmount()).." giving an average of "..ProperUnits(iAverageShare).." each."
		if user.iShareSize >= iAverageShare then
			m = m.."\r\n-=¦=-\tYou are "..(ProperUnits( user.iShareSize - iAverageShare )).." above the Average per user share... you're immense!!!"
			local iShare = SafeDivide(user.iShareSize, 1024^3)
			if iShare >= 50 and iShare < 100 then m = m.."\r\n-=¦=-\tYou have boosted the average up,you're amazing!!!"
			elseif iShare >= 100 and iShare < 250 then m = m.."\r\n-=¦=-\tYou have boosted the average up,There are people that will pay for your share!!!"
			elseif iShare >=250 and iShare < 500 then m = m.."\r\n-=¦=-\tYou have boosted the average up,There are people that will kill for your share!!!"
			elseif iShare >= 500 then m = m.."\r\n-=¦=-\tThere are people that will die for your share, or even a slot!!!"
			end
			m = m.."\r\n-=¦=-\t ... and yes we need you here!  ;)"
		elseif user.iShareSize < iAverageShare then
			m = m.."\r\n-=¦=-\tYou are "..(ProperUnits( iAverageShare - user.iShareSize) ).." below the Average share... try to get more stuff in ur share & be above average!"
			local iShare = SafeDivide(user.iShareSize, 1024^3)
			if iShare >= 10 and iShare < 25 then m = m.."\r\n-=¦=-\tYou are VERY small !!!"
			elseif iShare >= 25 and iShare < 50 then m = m.."\r\n-=¦=-\tYou are small!!!"
			elseif iShare >= 50 and iShare < 100 then m = m.."\r\n-=¦=-\tI bet you can try harder to raise your sharesize!!!"
			elseif iShare >= 100 then m = m.."\r\n-=¦=-\tIt's not that your share ain't big, it's that there are bigger!!!"
			end
			m = m.."\r\n-=¦=-\t ... still,... your most welcome!  ;)"
		end
		user:SendData( "ShareBot", m.."\r\n-=¦- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " )
	end
end

OpConnected = NewUserConnected


Also fixed the following abnormality...
Quote from: ShareBot-=¦- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-=¦=-    1 Users in the hub are currently sharing 20.05 GB giving an average of 20.05 GB each.
-=¦=-   You are 0.00 KB above the Average per user share... you're immense!!!
-=¦=-    ... and yes we need you here!  ;)
-=¦- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Now it needs at least 2 users, the total hub share to be more than 0, and the entering user's share to be more than 0 too...

Psycho_Chihuahua

darn Herodes beat me to it

but anyway i'm still posting the one i got running ;)

this is my fix - running on 46kb of mem lol

-- AverageShare Bot
-- request: ? Viper ?
-- script Herodes // 4:15 pm 31-5-2004
-- a little fix :P stupid mistake ...
-- fixed the display of mb, gb, tb
-- added categorized messages for Below(10 gb, 25 gb, 50 gb, 100 gb)
-- 			and Above( 50 gb, 100gb, 250gb, 500gb)
--- touched by Herodes again on 22-09-2006
-- made for Lua 5.x ... upon Viper's request ;)
-- Thx to Psycho_Chihuahua for testing this out and giving feedback...
-- Found and fixed last Bug - Psycho_Chihuahua

function NewUserConnected(user, data)

	local ProperUnits = function( i )
		local i = tonumber(i)
		if i == 0 then return "0.00 KB"; end
		if i >= (1024^2) then
			if i >= (1024^3) then
				if i >= (1024^4) then return string.format("%.2f", (i/(1024^4))).." TB"; end
				return string.format("%.2f", (i/(1024^3))).." GB"
			end; return string.format("%.2f", (i/(1024^2))).." MB"
		end;return string.format("%.2f", (i/(1024))).." KB"
	end

	local SafeDivide = function( a, b )
		if ( a == 0 and b ~= 0 ) or ( a == 0 and b == 0 )then return 0; end
		if b == 0 and a ~= 0 then return 1; end
		return a/b
	end

	local iAverageShare = SafeDivide(frmHub:GetCurrentShareAmount(), frmHub:GetUsersCount() )

	if user.iShareSize > 0 then
		local m = "\r\n-=?- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
		m = m.."\r\n-=?=- \t"..frmHub:GetUsersCount().." Users in the hub are currently sharing "..frmHub:GetCurrentShareAmount().." giving an average of "..ProperUnits(iAverageShare).." each."
		if user.iShareSize >= iAverageShare then
			m = m.."\r\n-=?=-\tYou are "..(ProperUnits( user.iShareSize - iAverageShare )).." above the Average per user share... you're immense!!!"
			local iShare = SafeDivide(user.iShareSize, 1024^3)
			if iShare >= 50 and iShare < 100 then m = m.."\r\n-=?=-\tYou have boosted the average up,you're amazing!!!"
			elseif iShare >= 100 and iShare < 250 then m = m.."\r\n-=?=-\tYou have boosted the average up,There are people that will pay for your share!!!"
			elseif iShare >=250 and iShare < 500 then m = m.."\r\n-=?=-\tYou have boosted the average up,There are people that will kill for your share!!!"
			elseif iShare >= 500 then m = m.."\r\n-=?=-\tThere are people that will die for your share, or even a slot!!!"
			end
			m = m.."\r\n-=?=-\t ... and yes we need you here!  ;)"
		elseif user.iShareSize < iAverageShare then
			m = m.."\r\n-=?=-\tYou are "..(ProperUnits( iAverageShare - user.iShareSize) ).." below the Average share... try to get more stuff in ur share & be above average!"
			local iShare = SafeDivide(user.iShare, 1024^3)
			if iShare >= 10 and iShare < 25 then m = m.."\r\n-=?=-\tYou are VERY small !!!"
			elseif iShare >= 25 and iShare < 50 then m = m.."\r\n-=?=-\tYou are small!!!"
			elseif iShare >= 50 and iShare < 100 then m = m.."\r\n-=?=-\tI bet you can try harder to raise your sharesize!!!"
			elseif iShare >= 100 then m = m.."\r\n-=?=-\tIt's not that your share ain't big, it's that there are bigger!!!"
			end
			m = m.."\r\n-=?=-\t ... still,... your most welcome!  ;)"
		end
		user:SendData( "ShareBot", m.."\r\n-=?- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " )
	end
end

OpConnected = NewUserConnected
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Herodes

heheh nice going psycho
Quote from: Psycho_Chihuahua on 22 September, 2006, 15:15:49
this is my fix - running on 46kb of mem lol
uhm,.. you go up to 58kb after the first login ;) I climb at 56kb, hihiiihi

Psycho_Chihuahua

yeah well all you had wrong was a mixup of user.iShareSize and iShare ;)
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

TiMeTrAVelleR


TiMeTrAVelleR

15:45:54] <ShareBot>

   41 Users in the hub are currently sharing 1.01 TB giving an average of 25.17 GB each.
   You are 2.67 GB above the Average per user share... you're immense!!!
    ... and yes we need you here! 

[15:46:13] 1137876763447
[15:46:13] 42
[15:46:13] <iAverageShare> 27092303891.595
[15:46:13] 1495022356
[15:46:13] 1073741824

somthing more to drip

nEgativE

Nice script.. i got this syntax:

[14:57] Syntax ...p\hub\PX.0351.L503.PT\scripts\09.px.averageshare.lua:29: attempt to perform arithmetic on local `a' (a nil value)
stack traceback:
   ...p\hub\PX.0351.L503.PT\scripts\09.px.averageshare.lua:29: in function `SafeDivide'
   ...p\hub\PX.0351.L503.PT\scripts\09.px.averageshare.lua:48: in function `OpConnected'

Herodes

#19
Quote from: TïMê†råVêlléR on 22 September, 2006, 15:47:57
15:45:54] <ShareBot>

   41 Users in the hub are currently sharing 1.01 TB giving an average of 25.17 GB each.
   You are 2.67 GB above the Average per user share... you're immense!!!
    ... and yes we need you here! 

[15:46:13] 1137876763447
[15:46:13] 42
[15:46:13] <iAverageShare> 27092303891.595
[15:46:13] 1495022356
[15:46:13] 1073741824

somthing more to drip
lol my debug ! :) Sorry about this...

Grab again pls
[PT]nEgativE: try grabbing the script again pls ;)

TiMeTrAVelleR


V1per

hi & thnx for working on it,i'm a bit unsure as to which script your using here,the only one i can get to work is #13 & i get this on entry -
Quote
-=?=-    1 Users in the hub are currently sharing 92366793785 giving an average of 86.02 GB each.
-=?=-   You are 2.34 TB above the Average per user share... you're immense!!!
-=?=-   There are people that will die for your share, or even a slot!!!
-=?=-    ... and yes we need you here!  ;)

all the others here i get nothing at all on connection & if u could fix frmHub:GetCurrentShareAmount then i'm sure it will be fine :)

Herodes

V1per: I posted in the Finished Scripts section, grab it from there

V1per

oki,just wanted to thank herodes & all others involved again,found the bug that was stopping it from working,the minimum users for it to work was set at 4 & i was only using 3 to test it, works great now.
maybe it would be a good idea to incorporate this with jitens record bot,would make a real nice all in one share script i think  ;)

jiten

Quote from: V1per on 24 September, 2006, 14:37:30
maybe it would be a good idea to incorporate this with jitens record bot,would make a real nice all in one share script i think  ;)

It will be added as soon as I get some time :P

SMF spam blocked by CleanTalk