script that shows 0 share of users until they are regged
 

script that shows 0 share of users until they are regged

Started by wacked, 03 January, 2005, 02:46:34

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wacked

are there any scripts that will show users as 0 share until and op registers them.  so this will give time for an op to do a whois on an ip before allowing them to be registered

thank

bastya_elvtars

QuoteOriginally posted by wacked
are there any scripts that will show users as 0 share until and op registers them.  so this will give time for an op to do a whois on an ip before allowing them to be registered

thank

1) that will not prevent them to be searched and uploaded from.

2) the hub will use exactly 2x as much bandwidth as it would.

But it's possible, altho 100%-blocker by chila would be better - see http://www.plop.nl/ptokaxbots/Chilla.php

lol my 750th post
Everything could have been anything else and it would have just as much meaning.

blackwings

#2
but how about a script that shows that Ops has 0 share? that takes some bandwidth too, but not as much as if it was done to REG and VIP too. I have 5 Ops, so the info of 0 share sends to Not Regged user(I have about 50 of them) on connect and ones every 60 seconds (if timer is needed)

(I'm already has a script that blocks dl,ul & search for Not regged users )


blackwings

I have rewritten a script (hawks description tag script), to make it show that Ops has zero share size. Right now it show zero share size to everyone, not only to non-regged/normal users.

Anyway, bastya_elvtars has tried to help me to fix it, but no succes, so he suggested we should have a public discussion about how to solve it.
--## Zero Share - Made by blackwings (a rewrite of Hawks - Description Tag)
--## - Shows Not Regged users that Ops has zero share
--
--User Settings-------------------------------------------------------------------------------------
--
OpsShareSize=22 -- in bytes

--End User Settings----------------------------------------------------------------------------------
OurOps = {}

function Main() 
	SetTimer(5000) 
	StartTimer()
end 

function OpConnected(user, data)
	if (OurOps[user.sName] == nil) then
		OurOps[user.sName] = 1
	end
end

function OpDisconnected(user, data)
	if (OurOps[user.sName] ~= nil) then
		OurOps[user.sName] = nil
	end
end

function OnTimer()
	SetOpsShareSize("OurOps")
end

function SetOpsShareSize(User)
	local aux,usr
	for usr, aux in OurOps do
		if (GetItemByName(usr) ~= nil) then
		local userToShow = GetItemByName(usr)
		local WhoToSendTo = GetUsersByProfile(User.iProfile == nil)
			if (userToShow.sMyInfoString ~= nil) then
				local s,e,name,desc,speed,email,share = strfind(userToShow.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
				-- SendToAll( "$MyINFO $ALL "..name.." "..desc.."$ $"..speed.."$"..email.."$"..OpsShareSize.."$")
				SendToNick(WhoToSendTo,"$MyINFO $ALL "..name.." "..desc.."$ $"..speed.."$"..email.."$"..OpsShareSize.."$") 
			end
		end
	end
end


bastya_elvtars

function DataArrival(user,data)
	if strsub(data, 1, 7) == "$MyINFO" and user.bOperator then --if starts with
		if user.sMyInfoString and strlen (user.sMyInfoString) > (strlen(user.sName)+13) -- if it really exists and not idiot myinfo (seee dc++ wiki on this)
			-- detect the share here
			-- send the new myinfo with 0 share
		end
	end
end
Everything could have been anything else and it would have just as much meaning.

blackwings

I think that you meant this, but it won't work, I get this error messege =
Syntax error: bad argument #1 to `strsub' (string expected, got nil)
stack traceback:
   1:  function `strsub' [C]
   2:  function `DataArrival' at line 27 [file `C:\ptokax\scripts\zeroShare.lua']
   3:  function `OnTimer' at line 23 [file `C:\ptokax\scripts\zeroShare.lua']
I have still allot of things to learn :P


--## Zero Share - Made by blackwings (a rewrite of Hawks - Description Tag)
--## - Shows Not Regged users that Ops has zero share
--## TESTING
--User Settings-------------------------------------------------------------------------------------
--
OpsShareSize=22 -- in bytes

--End User Settings----------------------------------------------------------------------------------
OurOps = {}

function Main() 
	SetTimer(5000) 
	StartTimer()
end 

function OpDisconnected(user, data)
	if (OurOps[user.sName] ~= nil) then
		OurOps[user.sName] = nil
	end
end

function OnTimer()
	DataArrival("OurOps")
end

function DataArrival(user,data)
	if strsub(data, 1, 7) == "$MyINFO" and user.bOperator then
		if user.sMyInfoString and strlen (user.sMyInfoString) > (strlen(user.sName)+13) then
			if (OurOps[user.sName] == nil) then
				OurOps[user.sName] = 1
				local aux,usr
				for usr, aux in OurOps do
					if (GetItemByName(usr) ~= nil) then
					local userToShow = GetItemByName(usr)
						if (userToShow.sMyInfoString ~= nil) then
							local s,e,name,desc,speed,email,share = strfind(userToShow.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
							SendToAll( "$MyINFO $ALL "..name.." "..desc.."$ $"..speed.."$"..email.."$"..OpsShareSize.."$")
						end
					end
				end
			end
		end
	end
end


bastya_elvtars

no need to overcomplicate.

strsub(data,1,strlen(user.sName+15)="$myinfo $all username "

the rest has to be transformed to 0 share, then merge the strings, and send to all.

got it?  :]
Everything could have been anything else and it would have just as much meaning.

blackwings

#7
QuoteOriginally posted by bastya_elvtars
no need to overcomplicate.

strsub(data,1,strlen(user.sName+15)="$myinfo $all username "

the rest has to be transformed to 0 share, then merge the strings, and send to all.

got it?  :]
Replace line 27 and 28 with that  ?(


bastya_elvtars

Man, i am trying to make some suggestions. If you cannot make that piece of code feel free to ask for it :)

I tend to help as you could notice (well, hopefully, i am not GargoyleMT to be pleased of my own lines :P) - i did not forget this. :)
Everything could have been anything else and it would have just as much meaning.

blackwings

QuoteOriginally posted by bastya_elvtars
Man, i am trying to make some suggestions. If you cannot make that piece of code feel free to ask for it :)

I tend to help as you could notice (well, hopefully, i am not GargoyleMT to be pleased of my own lines :P) - i did not forget this. :)
This is my latest try :S Doesn't go so well :P I guess I can't make this script by myself >_< So could you please do it bastya ^^

--## Zero Share - Made by blackwings (a rewrite of Hawks - Description Tag and Optimus - PmToUnregged users)
--## - Shows Not Regged users that Ops has zero share
--## TESTING
--User Settings-------------------------------------------------------------------------------------
--
OpsShareSize=22 -- in bytes

--End User Settings----------------------------------------------------------------------------------

OurOps = {}

function Main() 
	SetTimer(5000) 
	StartTimer()
end 


function OpConnected(user)
	if OurOps[user.sName] == nil then
		OurOps[user.sName] = 1
	end
end

function OpDisconnected(user)
	if OurOps[user.sName] then
		OurOps[user.sName] = nil
	end
end

function OnTimer()
	DataArrival("OurOps")
end

function DataArrival(User,data)
	if User.bOperator then
		if (GetItemByName(usr) ~= nil) then
			local userToShow = GetItemByName(usr)
			local s,e,name,desc,speed,email,share = strfind(userToShow.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
			tosend = ""
			tosend = "$MyINFO $ALL "..name.." "..desc.."$ $"..speed.."$"..email.."$"..OpsShareSize.."$"
			if OurOps then
				for name,_ in OurOps do
					SendPmToNick(name, tosend)
				end
			end
		end
	end
end


NightLitch

You need a little help blackwings :D

I see to many errors and not correct code.

Maybe later on post my version of it, going to create it first.

*Doing it because have probobly nothing to do later*

Cheers..
//NL

blackwings

QuoteOriginally posted by NightLitch
You need a little help blackwings :D

I see to many errors and not correct code.

Maybe later on post my version of it, going to create it first.

*Doing it because have probobly nothing to do later*

Cheers..
Nice ^^


NightLitch

Here you blckwings, here is my version, I have tested almost everything exept the to try to get userlist.

---------------------------------------------------------------------
-- Op-Zero-Share by NightLitch - 2005-01-11
---------------------------------------------------------------------
--// Message sent to users when trying to get Operators List
cMessage = "*** You must be registered to download from operators ***"
--// Table with all registered Profiles in ProfileList, Add your Operator Profiles
tProfiles = {
["Operator"] = 1,
["Master"] = 1,
}

tUsers = {}

function Main()
	SetTimer(5000) -- 5 Sec
	StartTimer()
end

function OnTimer()
	tData.GetOps()
end

function NewUserConnected(sUser)
	if sUser.iProfile == -1 then
		tUsers[sUser.sName] = 	tUsers[sUser.sName] or 1
	end
end

function DataArrival(sUser,sData)
	if strsub(sData,1,1) == "$" then
		local Str = strsub(sData,1,4)
		if tData[Str] then
			return tData[Str](sUser,sData)
		end
	end
end

function ConnectToMeArrival(sUser,sData)
	local _,_,ConMe = string.find(sData, "$ConnectToMe%s+(%S+)%s+")
	if GetItemByName(ConMe) and GetItemByName(ConMe).bOperator and sUser.iProfile == -1 then
		SendPmToNick("Denied",sUser.sName, cMessage)
		return 1
	end
end

function RevConnectToMeArrival(sUser,sData)
	local _,_,RevConMe = string.find(sData, "$RevConnectToMe%s+%S+%s+(%S+)%|")
	if GetItemByName(RevConMe) and GetItemByName(RevConMe).bOperator and sUser.iProfile == -1 then
		SendPmToNick("Denied",sUser.sName, cMessage)
		return 1
	end
end

tData = {}
tData.GetOps = function()
	for _,Profile in GetProfiles() do
		if tProfiles[Profile] then
			for _,Op in GetUsersByProfile(Profile) do
				if GetItemByName(Op) then
					local _,_,String,Share = strfind(GetItemByName(Op).sMyInfoString, "$MyINFO $ALL (%S+%s+[^$]*$ $[^$]*$[^$]*)$([^$]+)")
					for User,_ in tUsers do
						if GetItemByName(User) then
							SendToNick(GetItemByName(User).sName,"$MyINFO $ALL "..String.."$0$")
						else
							tUsers[User] = nil
						end
					end
				end
			end
		end
	end
	collectgarbage()
end
tData["$Con"] = function(sUser,sData) return ConnectToMeArrival(sUser,sData) end
tData["$Rev"] = function(sUser,sData) return RevConnectToMeArrival(sUser,sData) end

Cheers . . .
//NL

blackwings

#13
hmm, is this a blocking script?? I just wanted a script that showed to only Not Regged/Normal users that Ops has zero in share.

I have an extra idea for that =

1) Instead of zero share to all Ops, this table would be nice =
OurOps = {
["NightLitch"] = 134, -- Share in GB
["blackwings"] = 37, -- Share in GB
["bastya_elvtars"] = 66, -- Share in GB
}

2) Two timers, The first one send the Ops different share size almost immediately, the second one send this every 60 seconds.


NightLitch

Check this on out then:

---------------------------------------------------------------------
-- Op-Zero-Share by NightLitch - 2005-01-11
---------------------------------------------------------------------
--// Table with all registered Profiles in ProfileList, Add your Operator Profiles
tProfiles = {
["Operator"] = 1,
["Master"] = 1,
}

--// Custom Shares for diff Operators
tCustomShare = {
["blackwings"] = {20,"GB"},
["NightLitch"] = {10, "MB"},
}

tUsers = {}
tUnit = {["KB"]= 1024,["MB"]= 1048576,["GB"]= 1073741824,["TB"]= 1099511627776}
tData = {}
tData.Time = 0
function Main()
	SetTimer(5000) -- 5 Sec
	StartTimer()
end

function OnTimer()
	tData.GetOps()
	tData.Time = tData.Time + 1
	if tData.Time == 12 then
		tData.Time = 0
		tData.GetOps(1)
	end
end

function NewUserConnected(sUser)
	if sUser.iProfile == -1 then
		tUsers[sUser.sName] = 	tUsers[sUser.sName] or 1
	end
end

tData.GetOps = function(tMode)
	for _,Profile in GetProfiles() do
		if tProfiles[Profile] then
			for _,Op in GetUsersByProfile(Profile) do
				if GetItemByName(Op) then
					local _,_,String,Share = strfind(GetItemByName(Op).sMyInfoString, "$MyINFO $ALL (%S+%s+[^$]*$ $[^$]*$[^$]*)$([^$]+)")
					for User,_ in tUsers do
						if GetItemByName(User) then
							if tMode and tCustomShare[Op] then
								SendToNick(GetItemByName(User).sName,"$MyINFO $ALL "..String.."$"..tCustomShare[Op][1] *  tUnit[tCustomShare[Op][2]].."$")
							else
								SendToNick(GetItemByName(User).sName,"$MyINFO $ALL "..String.."$0$")
							end
						else
							tUsers[User] = nil
						end
					end
				end
			end
		end
	end
	collectgarbage()
end

Send Custom Share every 60 Sec and 0 Share every 5 sec.
//NL

blackwings

#15
Nice.

The zero share size thinge works, but the custom share size doesn't. I don't get any error messages. But either the share size stay the
same, even after 60 seconds or the 0 share size is added instead, even if the Ops name is in the table.

With more thoughts and chat with my other Ops, I think this would be the best =

1) Change so it's only custom share function(skip the function with zero share to those Ops that isn't in the table.)

2) Even if it's just only the Custom share function, I want it to have two timers. One that says how long time after a user connect until
it show the Custom Share Size and The second one that send the Custom share size with a longer time in between, for example =

1st timer when Not Regged/Normal user connect = 2 sec (plus it will only send once.)
2nd timer that sends after e longer period = 90 sec

Or maybe it's only 1 timer, like the Custom Share is Sent immediatly when the Not Regged/Normal user connect (with out a timer) and
the timmer is to send the Custom share every 90 seconds, for example (it's just an example, not a correct code) =
-- all the global varibles

function Main()
	SetTimer(90000) -- 90 Sec
	StartTimer()
end

function NewUserConnected(sUser)
	if sUser.iProfile == -1 then
		tUsers[sUser.sName] = 	tUsers[sUser.sName] or 1
		function(tMode) -- so that the Custom share is sent when a Normal user is connected.
	end
end

tData.GetOps = function(tMode)
-- The code that do the custom share
end


NightLitch

check it later then... I think I understand you... Just so damn tired right now..... *GAAAAAAASSSSSSSSSPPPPPPPPPPPPP* :O
//NL

bastya_elvtars

Isn't it enough 2 send the 0 (or any) share when a myinfo arrives?
Everything could have been anything else and it would have just as much meaning.

blackwings

QuoteOriginally posted by NightLitch
check it later then... I think I understand you... Just so damn tired right now..... *GAAAAAAASSSSSSSSSPPPPPPPPPPPPP* :O
How does it go, any progress  :)


NightLitch

QuoteOriginally posted by blackwings
QuoteOriginally posted by NightLitch
check it later then... I think I understand you... Just so damn tired right now..... *GAAAAAAASSSSSSSSSPPPPPPPPPPPPP* :O
How does it go, any progress  :)

haven't had the time sorry...

going to check it later tonight....
//NL

blackwings

Is the script that hard to make :(


bastya_elvtars

#21
isnt it enough to send a modded myinfo everytime a real myinfo occurs?
Everything could have been anything else and it would have just as much meaning.

blackwings

#22
QuoteOriginally posted by bastya_elvtars
isnt it enough to send a modded myinfo everytime a real myinfo occurs?
If I understand correctly what you mean, then I think that idea would take allot of bandwidth, much more than a script with timer.


Anyway, in the wait of NL, I made my on try on fixing the script in the way I wanted, but it doesn't work :(  =
---------------------------------------------------------------------
-- Op-Zero-Share by NightLitch - 2005-01-11
---------------------------------------------------------------------
--// Table with all registered Profiles in ProfileList, Add your Operator Profiles
tProfiles = {
["Operator"] = 1,
["Master"] = 1,
}

KB = 1024
MB = 1048576
GB = 1073741824
TB = 1099511627776

--// Custom Shares for diff Operators
tCustomShare = {
{"NightLitch",146,GB},
{"blackwings",112,GB},
}

tUsers = {}
tData = {}
tData.Time = 0
function Main()
	SetTimer(5000) -- 5 Sec
	StartTimer()
end

function OnTimer()
	tData.GetOps()
	tData.Time = tData.Time + 1
	if tData.Time == 12 then
		tData.Time = 0
		tData.GetOps(1)
	end
end

function NewUserConnected(sUser)
	if sUser.iProfile == -1 then
		tUsers[sUser.sName] = 	tUsers[sUser.sName] or 1
	end
end

tData.GetOps = function(tMode,sUser)
	for _,Profile in GetProfiles() do
		if tProfiles[Profile] then
			for _,Op in GetUsersByProfile(Profile) do
				if GetItemByName(Op) then
					local _,_,String,Share = strfind(GetItemByName(Op).sMyInfoString, "$MyINFO $ALL (%S+%s+[^$]*$ $[^$]*$[^$]*)$([^$]+)")
					for User,_ in tUsers do
						if GetItemByName(User) then
							for i=1,getn(tCustomShare) do
								tCustomShare[i][1] = gsub(tCustomShare[i][1], "<" , "")
								if ((tCustomShare[i][1]) ==  (sUser.sName)) then
									local shareSize = (tCustomShare[i][2])*(tCustomShare[i][3])
									SendToNick(GetItemByName(User).sName,"$MyINFO $ALL "..String.."$..shareSize..$")
								elseif ((tCustomShare[i][1]) ==  (sUser.sName)) then
									local shareSize = (tCustomShare[i][2])*(tCustomShare[i][3])
									SendToNick(GetItemByName(User).sName,"$MyINFO $ALL "..String.."$..shareSize..$")
								end
							end
						else
							tUsers[User] = nil
						end
					end
				end
			end
		end
	end
	collectgarbage()
end


bastya_elvtars

This is not about anyone's 'point' but the truth. Otherwise share could be seen for X minutes. Moreover, it eats more b//w to send it every 5 second IMHO, so you are totally wrong now. I am against these kinds of mynfo-rewriting scripts, they eat bandwidth using any method - no matter how you implement this function.

Offtopic: what's the point of this script? :)
Everything could have been anything else and it would have just as much meaning.

blackwings

#24
QuoteOriginally posted by bastya_elvtars
This is not about anyone's 'point' but the truth. Otherwise share could be seen for X minutes. Moreover, it eats more b//w to send it every 5 second IMHO, so you are totally wrong now. I am against these kinds of mynfo-rewriting scripts, they eat bandwidth using any method - no matter how you implement this function.

Offtopic: what's the point of this script? :)

if it send myinfo everytime someone connects,refresh Share or refresh nicklist, then it maybe will send several
times per second = takes more bandwidth that 5 seconds timer ;) Anyway, I have 10Mbit ul&dl + only
about 80 users, so a script like this is ok for me ;)

offtopic: My Ops share allot, I mean ALLOT, so to make them less interestting to antip2p companies that search
thought DC hubs, I want to lower everyones share, but to make it more "real", everyone should have there
own Share Size.


SMF spam blocked by CleanTalk