hi,i'm wondering if there's a script that can tell a user when they connect the average share in the hub & how much over/under they are & to categorise them e.g. if they were 100 gb under the average to tell them their share size sux! & if 100gb over that their share was incredible! i want to do this to try & encourage underaverage users to get their shares up a bit.
i have worked a bit on this,but i'm no scripter,just copy & paste! so far i have managed to tell the user the average share but it is not accurate,it takes 5 or 6 reconnects before its right,its not recognising the connecting users share & adding it to the average,here's what i have so far..
sBotName = "BotName"
kb = 1024
mb = kb*kb
gb = kb*kb*kb
function NewUserConnected(curUser)
a = frmHub:GetCurrentShareAmount()
b = frmHub:GetUsersCount()
c = (a / b)
temp = c
d = format( "%0.2f",tonumber(temp)/gb)
curUser:SendData(sBotName, b.." Users in the hub are currently sharing an average of "..d.." GB each.")
end
function Main()
frmHub:RegBot(sBotName)
end
i have not seen any script yet that does anything like this & wondering if its because of the inconsistency it has,thanx in advance :))
There u go ...
-- AverageShare Bot
-- request: ? Viper ?
-- script Herodes // 12:26 am 30-5-2004
function NewUserConnected(user, data)
AverageShare(user)
end
function AverageShare(user)
local s,e,share = strfind(user.sMyInfoString, "$(%d+)%$")
share = format("%0.2f",(share/(1024^3)))
local hubshare = format("%0.2f", (frmHub:GetCurrentShareAmount()/(1024^3)))
userCount = frmHub:GetUsersCount()
fShare = tonumber(share)+tonumber(hubshare)
allShare = format("%0.2f",((fShare/userCount)/(1024^3)))
Msg = "\r\n-=?- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
Msg = Msg.."\r\n-=?=- \t"..userCount.." Users in the hub are currently sharing an average of "..fShare.." GB each."
if tonumber(share) >= tonumber(fShare) then
Msg = Msg.."\r\n-=?=-\tYou are above the Average per user share... thnx ;)"
end
if tonumber(share) < tonumber(fShare) then
Msg = Msg.."\r\n-=?=-\tYou are below the Average per user share... try to get more stuff in ur share, thnx ;)"
end
Msg = Msg.."\r\n-=?- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
user:SendData("ShareBot", Msg)
end
[*edit*] the tonumber(share) <= tonumber(fShare) was changed to ...re) < ton...
was faulty when entering a hub with no users ...
Thanks Herodes,but found a little bug in it,it doesn't actually show the average share,but the total share in hub,i tried a few things,but no success
yep it was so very true now it shouldn't have any errors ...
-- AverageShare Bot
-- request: ? Viper ?
-- script Herodes // 12:26 am 30-5-2004
-- a little fix :P stupid mistake ...
function NewUserConnected(user, data)
AverageShare(user)
end
function AverageShare(user)
local s,e,share = strfind(user.sMyInfoString, "$(%d+)%$")
share = format("%0.2f",(share/(1024^3)))
local hubshare = format("%0.2f", (frmHub:GetCurrentShareAmount()/(1024^3)))
userCount = frmHub:GetUsersCount()
fShare = tonumber(share)+tonumber(hubshare)
allShare = format("%0.2f", (tonumber(fShare/userCount)))
Msg = "\r\n-=?- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
Msg = Msg.."\r\n-=?=- \t"..userCount.." Users in the hub are currently sharing an average of "..allShare.." GB each."
if tonumber(share) >= tonumber(allShare) then
Msg = Msg.."\r\n-=?=-\tYou are above the Average per user share... thnx ;)"
end
if tonumber(share) < tonumber(allShare) then
Msg = Msg.."\r\n-=?=-\tYou are below the Average per user share... try to get more stuff in ur share, thnx ;)"
end
Msg = Msg.."\r\n-=?- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
user:SendData("ShareBot", Msg)
end
Perfect! Thanks again Herodes,it was driving me nuts! you're a star :D
"star" lol! thx for the compliment Vipy ,,, :D
pls pm me with ur hub address, I'd love to see it running ..
I am using this script too. Nice idea and thanx for sharing another new good script.
houseofdance.no-ip.com
-- 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 are in the Fifties!!!"
elseif tonumber(share/gb) >= 100 and tonumber(share/gb) < 250 then -- for the users between 100gb and 250gb
Msg = Msg.."\r\n-=?=-\tThere 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-=?=-\tThere 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
This is it .. :) all features requested are there .. pls let me know if you find any more bugs ...
Let's code... :)_ _ _ @
[*edit*] had something pointed out by Vipy .. I think it is sorted now ...
Hey nice to see another update and hope there will be many more. I am really curious how far and good the acheivement s are with this script..
I am using this latest script now ... ;) keep up the good work and thanx..
Thanks Herodes,found a bug! the share below for the differnt classes works perfect,but,the above average just gives the same message (for the users above average) no matter how much more they have,but still,nice work :D
Did some editting to the post now it should work bugfree ... :D
works perfect now Herodes! :D
i'd like to make 1 final req if possible,its that the ops cant actually see it,so can u make a command like !av to show them the average in the hub at the time,plz & thnx again
QuoteOriginally posted by ? Viper ?
works perfect now Herodes! :D
i'd like to make 1 final req if possible,its that the ops cant actually see it,so can u make a command like !av to show them the average in the hub at the time,plz & thnx again
Right now I'm trying to get My Graph bot (http://board.univ-angers.fr/action.php?action=getlastmain&boardid=6) to work ...
When that is over I 'll get this one in there also .. then I'll be able to handle ur request ... :)
( I got another request for an on/off switch for the Average Share )
sorry but I need to do this one step at a time ...
I am learning day by day ...
understood Herodes,what u have done so far is beyond my expectations & the ops & myself (and some users above average!) love it,keep up the good work & thanks! ;)
Here is another script u may like:
-----------------------------------------------------------------------------------------------------------------------------
---// Loggin by TiMeTrAVelleR Fixed By Optimus //---------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
BotName = "BOT NAME HERE" --// Set here your bot name
kb = 1024
mb = kb*kb
gb = kb*kb*kb
function NewUserConnected(user)
Message(user)
end
function OpConnected(user)
Message(user)
end
--// Profile Counter
function ProfileCounter(profile)
local table, count = GetUsersByProfile(profile), 0
for i, User in table do
if GetItemByName(User) then
count = count + 1
end
end
return count
end
function Message(user)
if user.sMyInfoString then
local disp = ""
doGetProfile = GetProfileName(user.iProfile) or "Not registerd"
hubshare = format("%0.2f", frmHub:GetCurrentShareAmount()/(1024)/(1024)/(1024))
local _,_,share = strfind(user.sMyInfoString, "^%$MyINFO %$ALL [^ ]+ [^$]*%$ $[^$]+[^$]%$[^$]*%$%s*(%d+)%$" )
if share then
minshare = format("%0.2f", tonumber(share)/gb).." GB"
else
minshare = "Corrupt"
end
border1 = " ?:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::?"
border2 = " ?:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::?"
disp = "\r\n\r\n"..border1.."\r\n"
disp = disp.." ?Welcome: "..user.sName.."\r\n"
disp = disp.." ?To this fine place Called: "..frmHub:GetHubName().."\r\n"
disp = disp.." ?Your IP: "..user.sIP.."\r\n"
disp = disp.." ?Your Share: "..minshare.."\r\n"
disp = disp.." ?Your Status in this Hub: "..doGetProfile.."\r\n"
disp = disp.." ?Actual Share in the Hub: "..hubshare.." GB\r\n"
disp = disp.." ?There are: "..ProfileCounter("Master").." [Masters] - "..ProfileCounter("Operator").." [Operators] - "..ProfileCounter("Vip").." [Vips] online\r\n"
disp = disp.." ?There are now: "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n"
disp = disp.." ?Hub description is: "..frmHub:GetHubDescr().."\r\n"
disp = disp.." ?Hub minshare is: 30 GB\r\n"
disp = disp.." ?Redirect address is: "..frmHub:GetRedirectAddress().."\r\n"
disp = disp.." ?Hub Powerd By: Glory Securitaz 1.9\r\n"..border2.."\r\n"
user:SendData(BotName, disp)
end
end
Change the hub powerd to to your main script. and put in the bot name and there u go. :D
Sudds