Author Topic: Minimum Client Version Script (LUA 5)  (Read 6838 times)

0 Members and 1 Guest are viewing this topic.

Offline blackwings

  • Scripter
  • King
  • ******
  • Posts: 986
  • Karma: +12/-8
Minimum Client Version Script (LUA 5)
« on: 03 March, 2005, 21:26:27 »
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 =
Code: [Select]
-- 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"},
{"{"{"reverseconnect.sf.net","ReverseConnect","cccc"},
{"www.RevConnect.com","ReverseConnect","cccc"},
{"[BL]:","BCDC++","<%.%P>"},
}

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

« Last Edit: 03 March, 2005, 21:28:09 by blackwings »


PtokaX forum

Minimum Client Version Script (LUA 5)
« on: 03 March, 2005, 21:26:27 »

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 730
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
(No subject)
« Reply #1 on: 03 March, 2005, 21:33:46 »
This is a very nice detector, blackwings. Can i send you some more? ;)

Code: [Select]
dcpp={
[" [" ["reverseconnect.sf.net"]={"ReverseConnect","V:(0.%d+)"},
["www.RevConnect.com"]={"ReverseConnect","V:(0.%d+)"},
[" [" [" ["MS++V"]={"MS++V","V:(0.%d+)"},
[" ["zDC++"]={"zDC++","V:(0.%d+)"},
[" ["<.P>"]={".PhantomDC++","V:(0.%d+)"},
[" [" ["v%["]={"neXtDC++","V:(0.%d+)"},
["[BL]:"]={"BCDC++","V:(0.%d+)"},
["%[%d+%s*sl%]"]={"BCDC++","V:(0.%d+)"},
["%[%d+[kM]%]"]={"BCDC++","V:(0.%d+)"},
["V:%[Sasser.+"]={"Sasser","Sasser%s+(0.%d+)" }
}
Everything could have been anything else and it would have just as much meaning.

Offline blackwings

  • Scripter
  • King
  • ******
  • Posts: 986
  • Karma: +12/-8
(No subject)
« Reply #2 on: 03 March, 2005, 21:42:02 »
Quote
Originally 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 ?(
« Last Edit: 03 March, 2005, 21:42:21 by blackwings »


Offline blackwings

  • Scripter
  • King
  • ******
  • Posts: 986
  • Karma: +12/-8
(No subject)
« Reply #3 on: 03 March, 2005, 23:14:12 »
Added a option to block DC versions 0.403-0.665(not tested, but it should work) =
Code: [Select]
-- 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"},
{"{"{"reverseconnect.sf.net","ReverseConnect","cccc"},
{"www.RevConnect.com","ReverseConnect","cccc"},
{"[BL]:","BCDC++","<%.%P>"},
}

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


Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
(No subject)
« Reply #4 on: 04 March, 2005, 03:21:47 »
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 =)

Code: [Select]
-- 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"},
{" {" {"reverseconnect.sf.net","ReverseConnect","cccc"},
{"www.RevConnect.com","ReverseConnect","cccc"},
{"[BL]:","BCDC++","<%.%P>"},
}

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...
Code: [Select]
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
« Last Edit: 04 March, 2005, 04:05:55 by 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

Offline blackwings

  • Scripter
  • King
  • ******
  • Posts: 986
  • Karma: +12/-8
(No subject)
« Reply #5 on: 04 March, 2005, 04:18:41 »
Quote
Originally 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 =)

Code: [Select]
-- 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>"},
Quote
Originally posted by madman
And a suggestion...
Code: [Select]
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 :)
« Last Edit: 04 March, 2005, 04:33:46 by blackwings »


Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
(No subject)
« Reply #6 on: 04 March, 2005, 04:49:23 »
Quote
Originally posted by blackwings
Quote
Originally posted by madman
Code: [Select]
-- 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...
Code: [Select]
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...
Code: [Select]
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

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
(No subject)
« Reply #7 on: 04 March, 2005, 16:42:47 »
i relly need something else to do in my spare time... ;p

Code: [Select]
-- 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"},
{" {" {"reverseconnect.sf.net","ReverseConnect","cccc"},
{"www.RevConnect.com","ReverseConnect","cccc"},
{"[BL]:","BCDC++","<.P>"},
}

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

  • Guest
(No subject)
« Reply #8 on: 04 March, 2005, 17:14:26 »
You ppl have been scripting this baby nicely keep it up...

Good to watch it grow pps ;)

Offline Honey

  • Junior Member
  • **
  • Posts: 16
  • Karma: +0/-0
(No subject)
« Reply #9 on: 20 July, 2005, 11:07:19 »
Hi guys,


Can anybode help me with this, please?

How can I edit this script, more accurately this line:
Code: [Select]
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!

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
(No subject)
« Reply #10 on: 20 July, 2005, 16:34:07 »
Quote
Originally posted by Honey
Hi guys,


Can anybode help me with this, please?

How can I edit this script, more accurately this line:
Code: [Select]
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

Code: [Select]
["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

Offline Honey

  • Junior Member
  • **
  • Posts: 16
  • Karma: +0/-0
(No subject)
« Reply #11 on: 21 July, 2005, 10:46:23 »
Quote
Originally 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!

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
(No subject)
« Reply #12 on: 21 July, 2005, 18:48:51 »
Code: [Select]
-- 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"},
{" {" {"reverseconnect.sf.net","ReverseConnect","cccc"},
{"www.RevConnect.com","ReverseConnect","cccc"},
{"[B]:","BCDC++","<.P>"},
}

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

Offline Honey

  • Junior Member
  • **
  • Posts: 16
  • Karma: +0/-0
(No subject)
« Reply #13 on: 22 July, 2005, 10:57:13 »
Quote
Originally posted by madman
This should work... =)

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

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
(No subject)
« Reply #14 on: 22 July, 2005, 13:39:06 »
np... =)
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

  • Guest
(No subject)
« Reply #15 on: 22 July, 2005, 18:06:56 »
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

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
(No subject)
« Reply #16 on: 22 July, 2005, 22:20:18 »
Code: [Select]
-- 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"},
{" {" {"reverseconnect.sf.net","ReverseConnect","cccc"},
{"www.RevConnect.com","ReverseConnect","cccc"},
{"[B]:","BCDC++","<.P>"},
}

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
Code: [Select]
SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
to this
Code: [Select]
--SendPmToNick(HubOwner, frmHub:GetHubBotName(), curUser.sName.. " with ip " ..curUser.sIP.. " was kicked for using client " ..curUser.sClient.. " with version number " ..curUser.sClientVersion)
« Last Edit: 23 July, 2005, 02:21:03 by 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

  • Guest
(No subject)
« Reply #17 on: 23 July, 2005, 01:43:21 »
Thank you

chettedeboeuf

  • Guest
(No subject)
« Reply #18 on: 23 July, 2005, 02:01:32 »
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)

??

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
(No subject)
« Reply #19 on: 23 July, 2005, 02:23:32 »
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

  • Guest
(No subject)
« Reply #20 on: 23 July, 2005, 02:29:27 »
Thank you Madman

Offline lyte

  • Junior Member
  • **
  • Posts: 11
  • Karma: +0/-0
Yo
« Reply #21 on: 02 August, 2005, 12:38:00 »
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!

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
(No subject)
« Reply #22 on: 02 August, 2005, 17:47:37 »
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

Offline lyte

  • Junior Member
  • **
  • Posts: 11
  • Karma: +0/-0
woha
« Reply #23 on: 02 August, 2005, 18:33:53 »
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 :))

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
(No subject)
« Reply #24 on: 02 August, 2005, 18:49:16 »
BCDC++ Only

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

PtokaX forum

(No subject)
« Reply #24 on: 02 August, 2005, 18:49:16 »