Minimum Client Version Script (LUA 5)
 

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

Minimum Client Version Script (LUA 5)

Started by blackwings, 03 March, 2005, 21:26:27

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

blackwings

After getting help from Herodes and made the script work, I decided the post this in the finshed script section.
My solution of blocking bad clients is maybe not the best, but anyone is free to improve it :) And why I didn't
use the same method to block bad clients as detecting min version, well because client like DCDM doesn't
has it's "identification" in the usual tag, but instead in the description. Anyway, here is the code =
-- Simply script to disallow old DC++ clients without TTH support by PPK
-- Changed into a minversion script by blackwings
-- Made It Into Tables by Herodes ( not tested @all but hopefully it works )
-- FIXED:version numbers with more than one numbers work - by Herodes & blackwings
-- ADDED: Bad clients to be blocked

tCl = {
	["DC++"] = {"0.301","Please upgrade your client, min version for  in this hub is <0.401>"},
	["oDC"] = {"5.0","Please upgrade your client, min version for  in this hub is <5.0>"},
	["DCGUI"] = {"0.2.20","Please upgrade your client, min version for  in this hub is <0.2.20>"},
	["NMDC2"] = {"2.02","Please upgrade your client, min version for  in this hub is <2.02>"},
	["iDC"] = {"1.03", "Please upgrade your client, min version for  in this hub is <1.03>"},
}

tClBad = {
{"<%.%P>","Phantom DC++","cccc"},
{""},
}

function NewUserConnected(curUser)
	if not curUser.bOperator then
		if curUser.bHasTag and tCl[curUser.sClient] then
			if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) then
				curUser:SendData(tCl[curUser.sClient][2])
				curUser:Disconnect()
				return 1
			end 
		end 
	end
end


function MyINFOArrival(User , data)
	if not User.bOperator then
		for i=1,table.getn(tClBad) do
			tClBad[i][1] = string.gsub(tClBad[i][1], "<" , "")
			if string.find(data,tClBad[i][1]) and not string.find(data,tClBad[i][3]) then
				local Client=tClBad[i][2]
				User:SendData("------------------------------------------------------------------------------")
				User:SendData("*** The Client <"..Client.."> isn't allowed in this hub.")
				User:SendData("*** Use Original DC++, NMDC, oDC or DCGUI")
				User:SendData("------------------------------------------------------------------------------")
				User:Disconnect()
			end
		end
	end
end


bastya_elvtars

This is a very nice detector, blackwings. Can i send you some more? ;)

dcpp={
		[""]={".PhantomDC++","V:(0.%d+)"},
		["
Everything could have been anything else and it would have just as much meaning.

blackwings

#2
QuoteOriginally posted by bastya_elvtars
This is a very nice detector, blackwings. Can i send you some more? ;)
hmm, you want that table converted and added to my bad client block ?(


blackwings

Added a option to block DC versions 0.403-0.665(not tested, but it should work) =
-- Simply script to disallow old DC++ clients without TTH support by PPK
-- Changed into a minversion script by blackwings
-- Made It Into Tables by Herodes ( not tested @all but hopefully it works )
-- FIXED:version numbers with more than one numbers work - by Herodes & blackwings
-- ADDED: Bad clients to be blocked
-- ADDED: Option to block Dc++ versions 0.403-0.665

-- if version 0.403-0.665 of DC++ should be blocked
badVer = 1

tCl = {
	["DC++"] = {"0.301","Please upgrade your client, min version for  in this hub is <0.401>"},
	["oDC"] = {"5.0","Please upgrade your client, min version for  in this hub is <5.0>"},
	["DCGUI"] = {"0.2.20","Please upgrade your client, min version for  in this hub is <0.2.20>"},
	["NMDC2"] = {"2.02","Please upgrade your client, min version for  in this hub is <2.02>"},
	["iDC"] = {"1.03", "Please upgrade your client, min version for  in this hub is <1.03>"},
}

tClBad = {
{"<%.%P>","Phantom DC++","cccc"},
{""},
}

function NewUserConnected(curUser)
	if not curUser.bOperator then
		if curUser.bHasTag and tCl[curUser.sClient] then
			if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) then
				if badVer == 1
					if((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
					curUser:SendData(tCl[curUser.sClient][2])
					curUser:Disconnect()
					end
				end
				curUser:SendData(tCl[curUser.sClient][2])
				curUser:Disconnect()
				return 1
			end 
		end 
	end
end


function MyINFOArrival(User , data)
	if not User.bOperator then
		for i=1,table.getn(tClBad) do
			tClBad[i][1] = string.gsub(tClBad[i][1], "<" , "")
			if string.find(data,tClBad[i][1]) and not string.find(data,tClBad[i][3]) then
				local Client=tClBad[i][2]
				User:SendData("------------------------------------------------------------------------------")
				User:SendData("*** The Client <"..Client.."> isn't allowed in this hub.")
				User:SendData("*** Use Original DC++, NMDC, oDC or DCGUI")
				User:SendData("------------------------------------------------------------------------------")
				User:Disconnect()
			end
		end
	end
end


Madman

#4
Really nice script =)

However, when i was testing it, i got an error (see changelog) beacuse i use StrongDC++
Since i had nothing better to do i fixed it...
also noticed that CDM was detcted as Phantom, manage to fix that as well =)

Hope u dont mind =)

-- Simply script to disallow old DC++ clients without TTH support by PPK
-- Changed into a minversion script by blackwings
-- Made It Into Tables by Herodes ( not tested @all but hopefully it works )
-- FIXED: version numbers with more than one numbers work - by Herodes & blackwings
-- ADDED: Bad clients to be blocked
-- ADDED: Option to block Dc++ versions 0.403-0.665

-- Stuff by Madman
-- FIXED: Bad client block error, missing then
-- ADDED: tCl2 beacuse of syntax error: attempt to compare nil with number
-- CHANGED: MyInfoArrival, from (User, data) to (curUser, data)
-- REMOVED: No need to check bOperator in NewUserConnected
-- FIXED: Detected CDM as Phantom
-- FIXED: badVer, it only checked if client version was below 401

-- if version 0.403-0.665 of DC++ should be blocked
badVer = 1

tCl = {
	["DC++"] = {"0.401","Please upgrade your client, min version for  in this hub is <0.401>"},
	["oDC"] = {"5.0","Please upgrade your client, min version for  in this hub is <5.0>"},
	["DCGUI"] = {"0.2.20","Please upgrade your client, min version for  in this hub is <0.2.20>"},
	["NMDC2"] = {"2.02","Please upgrade your client, min version for  in this hub is <2.02>"},
	["iDC"] = {"1.03", "Please upgrade your client, min version for  in this hub is <1.03>"},
}

tCl2 = {
	["StrongDC++"] = {"1.00", "Please upgrade your client, min version for  in this hub is <1.00>"}
}

tClBad = {
	{"<.P>", "PhantomDC++","cccc"},
	{""},
}

function NewUserConnected(curUser)
	if curUser.bHasTag then
		if badVer == 1 then
			if ((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
			curUser:SendData("------------------------------------------------------------------------------")
			curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
			curUser:SendData("------------------------------------------------------------------------------")
			curUser:Disconnect()
			end
		end
		if tCl2[curUser.sClient] then
			if (curUser.sClientVersion) < (tCl2[curUser.sClient][1]) then
				curUser:SendData(tCl2[curUser.sClient][2])
				curUser:Disconnect()
				return 1
			end
		elseif tCl[curUser.sClient] then
			if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) then
				curUser:SendData(tCl[curUser.sClient][2])
				curUser:Disconnect()
				return 1
			end
		end
	end
end

--OpConnected = NewUserConnected --Uncomment to check op as well

function MyINFOArrival(curUser , data)
	if not curUser.bOperator then
		for i=1,table.getn(tClBad) do
			tClBad[i][1] = string.gsub(tClBad[i][1], "<" , "")
			if string.find(data,tClBad[i][1]) and not string.find(data,tClBad[i][3]) then
				local Client=tClBad[i][2]
				curUser:SendData("------------------------------------------------------------------------------")
				curUser:SendData("*** The Client <"..Client.."> isn't allowed in this hub.")
				curUser:SendData("*** Use Original DC++, NMDC, oDC or DCGUI")
				curUser:SendData("------------------------------------------------------------------------------")
				curUser:Disconnect()
			end
		end
	end
end

*edit*

And a suggestion...
DCPlusPlus = "0.401"

tCl = {
	["DC++"] = {DCPlusPlus,"Please upgrade your client, min version for  in this hub is " ..DCPlusPlus},
}

that way we dont need to type the version numbcer twice....
yup, i'm lazy.... ;p

*edit2*
-- FIXED: badVer, it only checked if client version was below 401
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

blackwings

#5
QuoteOriginally posted by madman
Really nice script =)

However, when i was testing it, i got an error (see changelog) beacuse i use StrongDC++
Since i had nothing better to do i fixed it...
also noticed that CDM was detcted as Phantom, manage to fix that as well =)

Hope u dont mind =)

-- Stuff by Madman
-- FIXED: Bad client block error, missing then
-- ADDED: tCl2 beacuse of syntax error: attempt to compare nil with number
-- CHANGED: MyInfoArrival, from (User, data) to (curUser, data)
-- REMOVED: No need to check bOperator in NewUserConnected
-- FIXED: Detected CDM as Phantom
I don't mind you making changes :D

It's nice when people help you improve the scripts :D

About the first thing you change, I didn't see that miss :P
2nd change= doesn't it work to just type "1.0"? Or doesn't that work or is it because its user friendly?
3rd change= Why is that needed?
4th change= Heh, your right, made a little mistake in copy (I had that code in MyInfoArrival first) :)
5th change= hmm, I didn't experience that when I tested it. And shouldn't you also change this line ;) = {"[BL]:","BCDC++","<%.%P>"},
QuoteOriginally posted by madman
And a suggestion...
DCPlusPlus = "0.401"

tCl = {
	["DC++"] = {DCPlusPlus,"Please upgrade your client, min version for  in this hub is " ..DCPlusPlus},
}

that way we dont need to type the version numbcer twice....
yup, i'm lazy.... ;p
well, thats extra code :P, but you can make the change if you want to :)


Madman

QuoteOriginally posted by blackwings
QuoteOriginally posted by madman
-- Stuff by Madman
-- FIXED: Bad client block error, missing then
-- ADDED: tCl2 beacuse of syntax error: attempt to compare nil with number
-- CHANGED: MyInfoArrival, from (User, data) to (curUser, data)
-- REMOVED: No need to check bOperator in NewUserConnected
-- FIXED: Detected CDM as Phantom
I don't mind you making changes :D

It's nice when people help you improve the scripts :D

About the first thing you change, there is no "then" missing, I checked.
2nd change= doesn't it work to just type "1.0"? Or doesn't that work or is it because its user friendly?
3rd change= Why is that needed?
4th change= Heh, your right, made a little mistake in copy (I had that code in MyInfoArrival first)
5th change= hmm, I didn't experience that when I tested it. And shouldn't you also change this line = {"[BL]:","BCDC++","<%.%P>"},

1st change: look again ;)
Yours...
if badVer == 1
					if((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
					curUser:SendData(tCl[curUser.sClient][2])
					curUser:Disconnect()
					end
				end
Mine...
if badVer == 1 then
			if ((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
				curUser:SendData("------------------------------------------------------------------------------")
				curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
				curUser:SendData("------------------------------------------------------------------------------")
				curUser:Disconnect()
			end
		end
see the badVer line? =)
2nd change: if i write 1.00 in your table i get
attempt to compare number with nil
thats beacuse the entire version is 1.00 RC9
so, beacuse of the RC we cant have tonumber, ther for i added tCl2
3rd change: maybe it wasent.. but i thougt it was better to have same "user" in the whole script =)
5th change: weird... well atlest it works...
as for the bcdc part... it seems to work as it is....

as for my sugestion... maybe... if i'm not to lazy ;)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Madman

i relly need something else to do in my spare time... ;p

-- Simply script to disallow old DC++ clients without TTH support by PPK
-- Changed into a minversion script by blackwings
-- Made It Into Tables by Herodes ( not tested @all but hopefully it works )
-- FIXED: version numbers with more than one numbers work - by Herodes & blackwings
-- ADDED: Bad clients to be blocked
-- ADDED: Option to block Dc++ versions 0.403-0.665

-- Stuff by Madman
-- FIXED: Bad client block error, missing then
-- ADDED: tCl2 beacuse of syntax error: attempt to compare nil with number
-- CHANGED: MyInfoArrival, from (User, data) to (curUser, data)
-- REMOVED: No need to check bOperator in NewUserConnected
-- FIXED: Detected CDM as Phantom
-- FIXED: badVer, it only checked if client version was below 401

-- FIXED: StrongDC++ giving error on badVer check
-- CHANGED: BCDC stuff =)
-- ADDED: Table to block unwanted clients
-- UPDATED: Minver for strongdc is now 1.00 RC5, 1.00 RC5 = 0.401

-- if version 0.403-0.665 of DC++ should be blocked
badVer = 1

tCl = {
	["DC++"] = { "0.401" , "Please upgrade your client, min version for  in this hub is <0.401>" },
	["oDC"] = { "5.0" , "Please upgrade your client, min version for  in this hub is <5.0>" },
	["DCGUI"] = { "0.2.20" , "Please upgrade your client, min version for  in this hub is <0.2.20>" },
	["NMDC2"] = { "2.02" , "Please upgrade your client, min version for  in this hub is <2.02>" },
	["iDC"] = { "1.03" , "Please upgrade your client, min version for  in this hub is <1.03>" },
}

tCl2 = {
	["StrongDC++"] = { "1.00 RC5" , "Please upgrade your client, min version for  in this hub is <1.00 RC5>" }
}

tClBad = {
	{"<.P>", "PhantomDC++","cccc"},
	{""},
}

tClBad2 = {
	["Client"] = { "Your client  isn't allowed in this hub" },
}

function NewUserConnected(curUser)
	if curUser.bHasTag then
		if badVer == 1 then
			if curUser.sClient == "StrongDC++" then
				if (curUser.sClientVersion >= "1.00 RC7") and (curUser.sClientVersion <= "1.00 RC8") then
					curUser:SendData("------------------------------------------------------------------------------")
					curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
					curUser:SendData("------------------------------------------------------------------------------")
					curUser:Disconnect()
				end
			else
				if ((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
					curUser:SendData("------------------------------------------------------------------------------")
					curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
					curUser:SendData("------------------------------------------------------------------------------")
					curUser:Disconnect()
				end
			end
		end
		if tCl2[curUser.sClient] then
			if (curUser.sClientVersion) < (tCl2[curUser.sClient][1]) then
				curUser:SendData(tCl2[curUser.sClient][2])
				curUser:Disconnect()
				return 1
			end
		elseif tCl[curUser.sClient] then
			if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) then
				curUser:SendData(tCl[curUser.sClient][2])
				curUser:Disconnect()
				return 1
			end
		elseif tClBad2[curUser.sClient] then
			curUser:SendData(tClBad2[curUser.sClient][1])
			curUser:Disconnect()
			return 1
		end
	end
end

--OpConnected = NewUserConnected --Uncomment to check op as well

function MyINFOArrival(curUser , data)
	if not curUser.bOperator then
		for i=1,table.getn(tClBad) do
			tClBad[i][1] = string.gsub(tClBad[i][1], "<" , "")
			if string.find(data,tClBad[i][1]) and not string.find(data,tClBad[i][3]) then
				local Client=tClBad[i][2]
				curUser:SendData("------------------------------------------------------------------------------")
				curUser:SendData("*** The Client <"..Client.."> isn't allowed in this hub.")
				curUser:SendData("*** Use Original DC++, NMDC, oDC or DCGUI")
				curUser:SendData("------------------------------------------------------------------------------")
				curUser:Disconnect()
			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

Herodes

You ppl have been scripting this baby nicely keep it up...

Good to watch it grow pps ;)

Honey

Hi guys,


Can anybode help me with this, please?

How can I edit this script, more accurately this line:
if (curUser.sClientVersion >= "1.00 RC7") and (curUser.sClientVersion <= "1.00 RC8") then

So if I want connect into my hub with StrongDC++ 1.00 RC10 cvs120 (Tag:

Thank you in advance for help!

Madman

QuoteOriginally posted by Honey
Hi guys,


Can anybode help me with this, please?

How can I edit this script, more accurately this line:
if (curUser.sClientVersion >= "1.00 RC7") and (curUser.sClientVersion <= "1.00 RC8") then

So if I want connect into my hub with StrongDC++ 1.00 RC10 cvs120 (Tag:

Thank you in advance for help!

You dont need to change any line to allow RC10 to enter...

If you want to have RC 10 as min version change RC5 to RC10 in this line

["StrongDC++"] = { "1.00 RC5" , "Please upgrade your client, min version for  in this hub is <1.00 RC5>" }
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Honey

QuoteOriginally posted by madman
You dont need to change any line to allow RC10 to enter...

Hi,

Hmm I think that you are wrong, because if I set as min. version StrongDC: RC7 then users with StrongDC++ RC10 cvs xxx didn't connected in this hub.

But if I set as min. version StrongDC: RC10 then users with StrongDC++ RC10 cvs xxx connect in this hub.

So I want set as min. version: StrongDC++ RC7 and I want that users with StrongDC++ RC10 cvs xxx connect in this hub too.

It is possible to edit this script?

THX in advance!

Madman

-- Simply script to disallow old DC++ clients without TTH support by PPK
-- Changed into a minversion script by blackwings
-- Made It Into Tables by Herodes ( not tested @all but hopefully it works )
-- FIXED: version numbers with more than one numbers work - by Herodes & blackwings
-- ADDED: Bad clients to be blocked
-- ADDED: Option to block Dc++ versions 0.403-0.665

-- Stuff by Madman
-- FIXED: Bad client block error, missing then
-- ADDED: tCl2 beacuse of syntax error: attempt to compare nil with number
-- CHANGED: MyInfoArrival, from (User, data) to (curUser, data)
-- REMOVED: No need to check bOperator in NewUserConnected
-- FIXED: Detected CDM as Phantom
-- FIXED: badVer, it only checked if client version was below 401

-- FIXED: StrongDC++ giving error on badVer check
-- CHANGED: BCDC stuff =)
-- ADDED: Table to block unwanted clients
-- UPDATED: Minver for strongdc is now 1.00 RC5, 1.00 RC5 = 0.401

-- ADDED: Kill/Allow StrongDC++ 1.00 RC10 (Request by Honey)

-- if version 0.403-0.665 of DC++ should be blocked
badVer = 1
KillStrong10 = nil -- 1 for disconnect, nil for allow

tCl = {
	["DC++"] = { "0.401" , "Please upgrade your client, min version for  in this hub is <0.401>" },
	["oDC"] = { "5.0" , "Please upgrade your client, min version for  in this hub is <5.0>" },
	["DCGUI"] = { "0.2.20" , "Please upgrade your client, min version for  in this hub is <0.2.20>" },
	["iDC"] = { "1.03" , "Please upgrade your client, min version for  in this hub is <1.03>" },
}

tCl2 = {
	["StrongDC++"] = { "1.00 RC5" , "Please upgrade your client, min version for  in this hub is <1.00 RC5>" }
}

tClBad = {
	{"<.P>", "PhantomDC++","cccc"},
	{""},
}

tClBad2 = {
	["Client"] = { "Your client  isn't allowed in this hub" },
	["NMDC2"] = { "Your client  isn't allowed in this hub" },
}

function NewUserConnected(curUser)
	if curUser.bHasTag then
		if badVer == 1 then
			if curUser.sClient == "StrongDC++" then
				if (curUser.sClientVersion >= "1.00 RC7") and (curUser.sClientVersion <= "1.00 RC8") then
					curUser:SendData("------------------------------------------------------------------------------")
					curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
					curUser:SendData("------------------------------------------------------------------------------")
					curUser:Disconnect()
				end
			else
				if ((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
					curUser:SendData("------------------------------------------------------------------------------")
					curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
					curUser:SendData("------------------------------------------------------------------------------")
					curUser:Disconnect()
				end
			end
		end
		if curUser.sClient == "StrongDC++" then
			if string.find(curUser.sClientVersion, "1.00 RC10") then
				if KillStrong10 then
					curUser:SendData("StrongDC++ 1.00 RC10 is not wanted here")
					curUser:Disconnect()
				else
					return 1
				end
			end
		end
		if tCl2[curUser.sClient] then
			if (curUser.sClientVersion) < (tCl2[curUser.sClient][1]) then
				curUser:SendData(tCl2[curUser.sClient][2])
				curUser:Disconnect()
				return 1
			end
		elseif tCl[curUser.sClient] then
			if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) then
				curUser:SendData(tCl[curUser.sClient][2])
				curUser:Disconnect()
				return 1
			end
		elseif tClBad2[curUser.sClient] then
			curUser:SendData(tClBad2[curUser.sClient][1])
			curUser:Disconnect()
			return 1
		end
	end
end

OpConnected = NewUserConnected --Uncomment to check op as well

function MyINFOArrival(curUser, data)
	if not curUser.bOperator then
		for i=1,table.getn(tClBad) do
			tClBad[i][1] = string.gsub(tClBad[i][1], "<" , "")
			if string.find(data,tClBad[i][1]) and not string.find(data,tClBad[i][3]) then
				local Client=tClBad[i][2]
				curUser:SendData("------------------------------------------------------------------------------")
				curUser:SendData("*** The Client <"..Client.."> isn't allowed in this hub.")
				curUser:SendData("*** Use Original DC++, NMDC, oDC or DCGUI")
				curUser:SendData("------------------------------------------------------------------------------")
				curUser:Disconnect()
			end
		end
	end
end

This should work... =)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Honey

QuoteOriginally posted by madman
This should work... =)

Yes, It's OK at now! :D
Thank you very much Madman!  :)

Madman

We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

chettedeboeuf

Thank you Madman

Is it possible to have a report of the kicked client to only one nick (me)

ex : was kicked for using

Thank you

Madman

#16
-- Simply script to disallow old DC++ clients without TTH support by PPK
-- Changed into a minversion script by blackwings
-- Made It Into Tables by Herodes ( not tested @all but hopefully it works )
-- FIXED: version numbers with more than one numbers work - by Herodes & blackwings
-- ADDED: Bad clients to be blocked
-- ADDED: Option to block Dc++ versions 0.403-0.665

-- Stuff by Madman
-- FIXED: Bad client block error, missing then
-- ADDED: tCl2 beacuse of syntax error: attempt to compare nil with number
-- CHANGED: MyInfoArrival, from (User, data) to (curUser, data)
-- REMOVED: No need to check bOperator in NewUserConnected
-- FIXED: Detected CDM as Phantom
-- FIXED: badVer, it only checked if client version was below 401

-- FIXED: StrongDC++ giving error on badVer check
-- CHANGED: BCDC stuff =)
-- ADDED: Table to block unwanted clients
-- UPDATED: Minver for strongdc is now 1.00 RC5, 1.00 RC5 = 0.401

-- ADDED: Kill/Allow StrongDC++ 1.00 RC10 (Request by Honey)
-- ADDED: PM to hubowner (request by chettedeboeuf)

-- if version 0.403-0.665 of DC++ should be blocked
badVer = 1
KillStrong10 = nil -- 1 for disconnect, nil for allow
HubOwner = "chettedeboeuf"

tCl = {
	["DC++"] = { "0.401" , "Please upgrade your client, min version for  in this hub is <0.401>" },
	["oDC"] = { "5.0" , "Please upgrade your client, min version for  in this hub is <5.0>" },
	["DCGUI"] = { "0.2.20" , "Please upgrade your client, min version for  in this hub is <0.2.20>" },
	["iDC"] = { "1.03" , "Please upgrade your client, min version for  in this hub is <1.03>" },
}

tCl2 = {
	["StrongDC++"] = { "1.00 RC5" , "Please upgrade your client, min version for  in this hub is <1.00 RC5>" }
}

tClBad = {
	{"<.P>", "PhantomDC++","cccc"},
	{""},
}

tClBad2 = {
	["Client"] = { "Your client  isn't allowed in this hub" },
	["NMDC2"] = { "Your client  isn't allowed in this hub" },
}

function NewUserConnected(curUser)
	if curUser.bHasTag then
		if badVer == 1 then
			if curUser.sClient == "StrongDC++" then
				if (curUser.sClientVersion >= "1.00 RC7") and (curUser.sClientVersion <= "1.00 RC8") then
					SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
					curUser:SendData("------------------------------------------------------------------------------")
					curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
					curUser:SendData("------------------------------------------------------------------------------")
					curUser:Disconnect()
				end
			else
				if ((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
					SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
					curUser:SendData("------------------------------------------------------------------------------")
					curUser:SendData("Clients with version numbers 403-665 isn't allowed in this hub.")
					curUser:SendData("------------------------------------------------------------------------------")
					curUser:Disconnect()
				end
			end
		end
		if curUser.sClient == "StrongDC++" then
			if string.find(curUser.sClientVersion, "1.00 RC10") then
				if KillStrong10 then
					SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
					curUser:SendData("StrongDC++ 1.00 RC10 is not wanted here")
					curUser:Disconnect()
				else
					return 1
				end
			end
		end
		if tCl2[curUser.sClient] then
			if (curUser.sClientVersion) < (tCl2[curUser.sClient][1]) then
				SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
				curUser:SendData(tCl2[curUser.sClient][2])
				curUser:Disconnect()
				return 1
			end
		elseif tCl[curUser.sClient] then
			if tonumber(curUser.sClientVersion) < tonumber(tCl[curUser.sClient][1]) then
				SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
				curUser:SendData(tCl[curUser.sClient][2])
				curUser:Disconnect()
				return 1
			end
		elseif tClBad2[curUser.sClient] then
			SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
			curUser:SendData(tClBad2[curUser.sClient][1])
			curUser:Disconnect()
			return 1
		end
	end
end

OpConnected = NewUserConnected --Uncomment to check op as well

function MyINFOArrival(curUser, data)
	if not curUser.bOperator then
		for i=1,table.getn(tClBad) do
			tClBad[i][1] = string.gsub(tClBad[i][1], "<" , "")
			if string.find(data,tClBad[i][1]) and not string.find(data,tClBad[i][3]) then
				local Client=tClBad[i][2]
				SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
				curUser:SendData("------------------------------------------------------------------------------")
				curUser:SendData("*** The Client <"..Client.."> isn't allowed in this hub.")
				curUser:SendData("*** Use Original DC++, NMDC, oDC or DCGUI")
				curUser:SendData("------------------------------------------------------------------------------")
				curUser:Disconnect()
			end
		end
	end
end

Done... it now notify one every thing... if you dont want some pm...  
add 2 - to this line SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion..)

This
SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
to this
--SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

chettedeboeuf


chettedeboeuf

SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion.. )

should I replace by

SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)

??

Madman

Heh.. yes... remove the last 2 dots.. Or just Copy the script again..

Made the script to fast.. ;p

And if you dont want pm's add 2 - lines infront of the SendPmToNick lines...
That will make it comment... so it wi'll stop bug you...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

chettedeboeuf

Thank you Madman

lyte

Hello dude,
may u change this script to allow only ppl with BCDC++ 0.674
can join the hub, ppl with other clients cant join :) and checks all without master.
I hope wont be problem for U :)
U da man!

Madman

There's a problem...
Only way to detect bcdc is if the user has the limter on...
so.. if i make the script... it will block all users, untill they turn on there Limter..

Then the script can see bcdc.. so if you still want the script... i'll make an new one and include a check for minimum limting...
But that means.. all your users are going to have limter on there upload...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

lyte

U da man! sure i want it
only bcdc++ users can join and with max upload 50kB thats all checkin without master
"this hub will run in local network thats way only this clinet wif that speed other way speed will kill this network"
I will be so grateful for this script
so make it, u da pwnz0r :))

Madman

We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

SMF spam blocked by CleanTalk