PtokaX forum

Archive => Archived 5.0 boards => Help with scripts => Topic started by: blackwings on 27 February, 2005, 22:32:33

Title: Deny Clients Checker 4.3 LUA 5
Post by: blackwings on 27 February, 2005, 22:32:33
I have converted some terms from LUA 4 to LUA 5. Now I just wonder if there is more that is needed to be changed for it to work?-- ??????????????????????????????????????????????????????????????????
-- ? Deny Client's Checker 4.3                                      ?
-- ? Made by: blackwings                                            ?
-- ?----------------------------------------------------------------?
-- ? This Script blocks: DCGUI,zDC++,StrongDC++,Phantom DC++,iDC++, ?
-- ? MS++V,DC++K CDM,rmDC++,DC@fe++,DC++ DCDM,BCDC++,nDC++,CZDC++,  ?
-- ? ReverseConnect,oDC,NMDC,DC:PRO,RDC++,[X]DC,YETI++,DHDc++,      ?
-- ? MORIA++,LDC++,TiDc++,R2++,Chp++,SdDC++,FInDC                   ?
-- ?            --------------------------------------              ?
-- ? The Script doesn't check Ops and VIP's                         ?
-- ?            --------------------------------------              ?
-- ? I made this script to use it with RoboCop 9.0b                 ?
-- ? (remeber to name the script so it comes after RC when ptokax   ?
-- ? loads it)                                                      ?
-- ?            --------------------------------------              ?
-- ? Changed: Converted the script into LUA 5                    ?
-- ??????????????????????????????????????????????????????????????????

Bot="Client-Checker"

-- if you don't want to block mldc/edonkey, then change the number 1 to 0
mldcCheck=1

-- To make the bot not block a certain client, you should
-- then change the number at the end from 1 to 0
C = {
{"{"{"{"{"<%.%P>","V:(0.%d+)","Phantom DC++","cccc", 1},
{"[BL]:","V:(0.%d+)","BCDC++","<%.%P>", 1},
{"zDC%+%+","V:(0.%d+)","zDC++","cccc", 1},
{"{"V:0.%d+%a","V:(0.%d+)","CZDC++","cccc", 1},
{"{"{"{"{"{"DC@fe%+%+","V:(0.%d+)","DC@fe++","cccc", 1},
{"v%[","V:(0.%d+)","nDC++","cccc", 1},
{"reverseconnect.sf.net","V:(0.%d+)","ReverseConnect","cccc", 1},
{"www.RevConnect.com","V:(0.%d+)","ReverseConnect","cccc", 1},
{"{"{"<[X]DC","V:(0.%d+)","[X]DC","cccc", 1},
{"{"{"{"{"{"{"{"{"{"}

function Main()
-- Remove "frmHub:RegBot(Bot)" if you don't want this bot to appear in the userlist
frmHub:RegBot(Bot)
end

function BlockedUser(User,Client)
User:SendData(Bot,"The Client <"..Client.."> isn't allowed in this hub.")
User:SendData(Bot,"Use Original DC++, NMDC, oDC or DCGUI")
User:Disconnect()
end

function MyINFOArrival(User,data)
if string.sub(data, 1, 7) == "$MyINFO"  and not User.bOperator  and User.iProfile ~= 2 then
for i=1,table.getn(C) do
C[i][1] = string.gsub(C[i][1], "<" , "")
if string.find(data, C[i][1]) and string.find(data, C[i][2]) and not string.find(data, C[i][4]) then
if C[i][5] == 1 then
local Client=C[i][3]
return BlockedUser(User,Client)
end
elseif mldcCheck==1 and User.iProfile == -1 then
if string.find(data,"mld(%S+)") or string.find(data,"edonk(%S+)") then
User:Disconnect()
end
end
end
end
end
Title:
Post by: Pothead on 28 February, 2005, 03:05:45
What might help is the minv.lua script.  This calls curUser.sClient == "DC++"
I think this sClient implys that PtokaX can detect quite a few clients as is.  Would be nice to know which ones it can detect, and how to reference them ("DC++" for DCplusplus). :)
Title:
Post by: nErBoS on 28 February, 2005, 03:14:00
Hi,

You can chage this...

if string.sub(data, 1, 7) == "$MyINFO"  and not User.bOperator  and User.iProfile ~= 2 then
...to this...

if not User.bOperator  and User.iProfile ~= 2 then
You don't need to check if is a $MyINFO, because the function only recieves the $MyINFO string. About the rest of the script it seems fine.

Best regards, nErBoS
Title:
Post by: PPK on 28 February, 2005, 04:33:15
QuoteOriginally posted by Pothead
I think this sClient implys that PtokaX can detect quite a few clients as is.  Would be nice to know which ones it can detect, and how to reference them ("DC++" for DCplusplus). :)
PtokaX 0.3.3.0 build 16.04 know as default this tags (Tag start|Client name|)
Quote++|DC++|
DCGUI|DCGUI|
DC|NMDC2|
oDC|oDC|
DC:PRO|DC:PRO|
QuickDC|QuickDC|
StrgDC++|StrongDC++|
LDC++|LDC++|
R2++|R2++|
Z++|Zion++|
This is saved in file ClientTags.dat and is easy to change ... remove not wanted client, add not included etc.  :]
Title:
Post by: blackwings on 28 February, 2005, 04:37:04
QuoteOriginally posted by PPK
PtokaX 0.3.3.0 build 16.04 know as default this tags (Tag start|Client name|)
Quote++|DC++|
DCGUI|DCGUI|
DC|NMDC2|
oDC|oDC|
DC:PRO|DC:PRO|
QuickDC|QuickDC|
StrgDC++|StrongDC++|
LDC++|LDC++|
R2++|R2++|
Z++|Zion++|
This is saved in file ClientTags.dat and is easy to change ... remove not wanted client, add not included etc.  :]
You mean that only the one in there is the one that is allowed to enter?
Title:
Post by: bastya_elvtars on 28 February, 2005, 04:41:23
Only if tagcheck is enabled i guess.
Title:
Post by: blackwings on 28 February, 2005, 04:45:20
QuoteOriginally posted by bastya_elvtars
Only if tagcheck is enabled i guess.
and where is that option?
Title:
Post by: PPK on 28 February, 2005, 04:47:08
QuoteOriginally posted by blackwings
You mean that only the one in there is the one that is allowed to enter?
If you set in Rules option for Users without DC tag to reject or redirect then only users with tag from ClientTags.dat are allowed to enter :)
Title:
Post by: blackwings on 28 February, 2005, 04:49:07
QuoteOriginally posted by PPK
QuoteOriginally posted by blackwings
You mean that only the one in there is the one that is allowed to enter?
If you set in Rules option for Users without DC tag to reject or redirect then only users with tag from ClientTags.dat are allowed to enter :)
ok, thanx PPK :)

is this ok PPK? = ++|DC++|
DCGUI|Valknut|
DC|NMDC2|
oDC|oDC|
DC:PRO|DC:PRO|
zDC++|zDC++|
iDC|iDC++|
DCTC|DCTC|