This is the smalles download blocker ;), that prevents
Not Registered Users from downloading.
--Download-Blocker-V.1.1
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(curUser, data)
if (strsub(data, 1, 1) == "$" and curUser.iProfile==-1 and strfind(data, "ConnectToMe")) then
return 1
end
end
only when an active regged client is trying to connect to an Not regged active client then the other client may have a chance of downloading something when a slot is open. But I suppose the other Leechblockers didn't care about that problem either.
very cool can you add the message
"You are not registered in this hub please register and you may download."
thanks RiP
howdy there! could ya make an feature that we can define the nick's that can download?it was a nice one to me because in portugal the ips are variable! :( waiting for a reply! tkhx in advance! xokas over&out
Hi all ,
I like the idea bout the ip range.
A little addon question,
Can the script made so that the Profiles Master, Su and SU+ can block NormalUsers when they try to download from them.
What I trying to say is that when a Normaluser tries to download from a Master, Su or SU+ he gets a messege that he first has to become Registered or VIPed.
But all NormalUser can download from other NormalUser and NormalUsers can download from RegUsers and VIPs.
:rolleyes:
Small and simple... like it...
for you RiPOFF
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(curUser, data)
if (strsub(data, 1, 1) == "$" and curUser.iProfile==-1 and strfind(data, "ConnectToMe")) then
curUser:SendData("*** You are not registered in this hub please register and you may download.")
return 1
end
end
not hard actually is it ;)?
for xokas just add the nicks you want, not to hard either.
aNicks = {
["Nick1"] = 1,
["Nick2"] = 1,
["Nick3"] = 1,
}
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(curUser, data)
if (strsub(data, 1, 1) == "$" and strfind(data, "ConnectToMe") and not aNicks[curUser.sName]) then
return 1
end
end
Gate, I might post it later, if I have time. First I need to check if its possible. But I guess it is.
gate you are my tester it seemd to work but dunno check for yourself.
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(curUser, data)
if (strsub(data, 1, 15) == "$RevConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
if GetItemByName(towho) and GetItemByName(towho).bOperator then
curUser:SendData("*** You must get registered to be able to download from an OP")
return 1
end
elseif (strsub(data, 1, 12) == "$ConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
if GetItemByName(towho) and GetItemByName(towho).bOperator then
curUser:SendData("*** You must get registered to be able to download from an OP")
return 1
end
end
end
hi there!that looks nice chilla but i was thinking on something like this, for example: !forbidden 'nick' , so that i can define it by not opening file.lua and editing it! get my idea?
Is it possible to specify a extension allowed to download? For example I need allow to download the user's filelist.
Not as far as I know...
I just loaded this:
"
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(curUser, data)
if (strsub(data, 1, 1) == "$" and curUser.iProfile==-1 and strfind(data, "ConnectToMe")) then
curUser:SendData("*** You are not registered in this hub please register and you may download.")
return 1
end
end
"
My users are registering to download...but whenever they are registered...they still receive the message :
"
You are not registered in this hub please register and you may download.
"
in the Main chat...
Is it possible to do something for that cause the message is coming very soon on their screen and that's not really cool for them...
Thanx ...
sorry... I have no clue... is it only with newly regged users?.. maby they need to reconnect first...
cause actually curUser.iProfile==-1 is only not regged users.
Ok I will precise to reconnect after registering...and tell you if that was the solution...
Good Job Chilla...
You were right Chilla....one time again....
And now I would need a !call script...Cause I had one but with robocop it doesn't work anymore..and I found this very usefull....
Do you see what I'talking about....
writing !call in the cc , it sends a pm to the to say him he's waited in the cc....
I guess it already exists but I'm french and not understanding a lot in this forum....lol
Thanx and Thanx and thanx...:)
Is it possible to have it where you only have to be registered to download from ops, but not to download from everyone else?
if i got you right then look 8 posts upwards :).
Yep thats it.....it may help if I learn to read things more carefully...lol. Hoping it works, gate never posted back if it ran ok for him, but I will give it a try. Thnx for the help Chilla.
Just tried out the script and got:
Syntax Error: expected;
last token read: `function' at line 3 in file `...
Nevermind...lol.....fixed it
hmmm......strange thing happening.....some of the reg users are saying that when they log in it shows the hub as being empty......why?
might depend on what you have changed in the code.
just post your code and we'll see.
I haven't changed anything to the code.....I put it in as you wrote it above.
code:--------------------------------------------------------------------------------
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(curUser, data)
if (strsub(data, 1, 15) == "$RevConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
if GetItemByName(towho) and GetItemByName(towho).bOperator then
curUser:SendData("*** You must get registered to be able to download from an OP")
return 1
end
elseif (strsub(data, 1, 12) == "$ConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
if GetItemByName(towho) and GetItemByName(towho).bOperator then
curUser:SendData("*** You must get registered to be able to download from an OP")
return 1
end
end
end
--------------------------------------------------------------------------------
QuoteJust tried out the script and got:
Syntax Error: expected;
last token read: `function' at line 3 in file `...
Nevermind...lol.....fixed it
thats why I wondered...
but I guess. then its not the script might be something else...
maybe someone else knows why.
it must have been just a one time thing, cause no one else that has registered has complained or said anything about it......oh well, maybe the user himself messed up...lol. anyways, thanks for the script chilla.
--Download-Blocker-V.1.1-NP
NickPrefix = "[TMX]"
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(curUser, data)
if (strsub(data, 1, 1) == "$" and strsub(curUser.sName,1,strlen(NickPrefix)) ~= NickPrefix and strfind(data, "ConnectToMe")) then
return 1
end
end
thank you very much man, i have search for this script for long time
--Download-Blocker-V.1.1-NP
NickPrefix = "[TMX]"
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(curUser, data)
if (strsub(data, 1, 1) == "$" and strsub(curUser.sName,1,strlen(NickPrefix)) ~= NickPrefix and strfind(data, "ConnectToMe")) then
return 1
end
end
I have problem with this script. It make all the users in the hub receive Connection timeout message although they have the correct prefix. Please help on this plese
This script blocks searches and downloads till the user replies with a certain Key.
Yepp I also wonder whats its good for.
--DowBlo Download / Search Blocker - UNLOCK V.1
--Blocks Download and search until they reply with a certain key.
ToBlock = {}
DBLTrig = {
["$Rev"] = 1,
["$Con"] = 1,
["$Sea"] = 1,
}
function Main()
frmHub:EnableFullData(1)
end
function NewUserConnected(curUser)
if curUser.iProfile == -1 then
ToBlock[curUser.sName] = tostring(random(10000))
end
end
function UserDisconnected(curUser)
ToBlock[curUser.sName] = nil
end
function DataArrival(curUser,data)
if ToBlock[curUser.sName] then
if strsub(data,1,1) == "$" then
if DBLTrig[strsub(data,1,4)] then
curUser:SendData(" *** To UnLock the Download and Search Protection, please reply with : "..ToBlock[curUser.sName])
return 1
end
elseif strsub(data,1,1) == "<" then
if strsub(data,strlen(data)-strlen(ToBlock[curUser.sName]),strlen(data)-1) == ToBlock[curUser.sName] then
curUser:SendData(" *** Download and Search have been UnLocked.")
ToBlock[curUser.sName] = nil
end
end
end
end
The script:
aNicks = {
["Nick1"] = 1,
["Nick2"] = 1,
["Nick3"] = 1,
}
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(curUser, data)
if (strsub(data, 1, 1) == "$" and strfind(data, "ConnectToMe") and not aNicks[curUser.sName]) then
return 1
end
end
Allows only Nicks entered to download, and i noticed one with a prefix. What would really come in handy is a script that WOULD ALLOW ALL to connect and download within the hub. But have a script so as to enter their Nick to not download ,returning a "You are not authorized now to download"
just like the script above but enter Nicks to NOT GIVE permission to download. That way someone using the above script wouldn't have to enter everyone on their hub in the script in order to let them download.
This would be very handy, hub owners could then have the ability to "censor" who CANNOT download by simply entering their Nick in the script.
sure, nice idea... just oone thing, these scripts are not proof, just a exsample.
active client connects to a blocked client, if active client has a slot open the blcoked client will be able to download.
1 leak.
well to make it totally proof one would also need to prevent useres from connectiong to blocked useres, well only need to prevent active users actually, but maybe better to also block the passive ones to active blocked clients, so no extra data is sent, will think of something.
this would be a 100% download upload blocker.
--100% Blocker by chill
cmd1 = "+blocknick"
BlockedNicks = {}
function Main()
frmHub:EnableFullData(1)
end
BlockTriggs = {
["$Rev"] = 1,
["$Con"] = 2,
}
function DataArrival(curUser,data)
if strsub(data,1,1) == "$" then
local str1 = strsub(data,1,4)
if BlockTriggs[str1] then
if BlockedNicks[strlower(curUser.sName)] then
curUser:SendData("*** You are not authorized to download.")
return 1
elseif BlockTriggs[str1] == 1 then
local _,_,conNick = strfind(data,"(%S+)|$")
if BlockedNicks[strlower(conNick)] then
curUser:SendData("*** The user you are trying to download is not authorized to upload.")
return 1
end
elseif BlockTriggs[str1] == 2 then
local _,_,conNick = strfind(strsub(data,14,strlen(data)),"^(%S+)")
if BlockedNicks[strlower(conNick)] then
curUser:SendData("*** The user you are trying to download is not authorized to upload.")
return 1
end
end
end
elseif strsub(data,1,1) == "<" and curUser.bOperator then
local _,_,cmd,nick = strfind(data,"^%b<>%s+(%S+)%s+(%S+)|$")
if cmd and cmd == cmd1 then
if BlockedNicks[strlower(nick)] then
BlockedNicks[strlower(nick)] = nil
curUser:SendData("*** "..nick.." is now unblocked.")
else
BlockedNicks[strlower(nick)] = 1
curUser:SendData("*** "..nick.." is now blocked.")
end
end
end
end
way to go this is a nice idea :)) keep up good work :)
--100% Blocker by chill
cmd1 = "+blocknick"
BlockedNicks = {}
function Main()
frmHub:EnableFullData(1)
end
BlockTriggs = {
["$Rev"] = 1,
["$Con"] = 2,
}
function DataArrival(curUser,data)
if strsub(data,1,1) == "$" then
local str1 = strsub(data,1,4)
if BlockTriggs[str1] then
if BlockedNicks[strlower(curUser.sName)] then
curUser:SendData("*** You are not authorized to download.")
return 1
elseif BlockTriggs[str1] == 1 then
local _,_,conNick = strfind(data,"(%S+)|$")
if BlockedNicks[strlower(conNick)] then
curUser:SendData("*** The user you are trying to download is not authorized to upload.")
return 1
end
elseif BlockTriggs[str1] == 2 then
local _,_,conNick = strfind(strsub(data,14,strlen(data)),"^(%S+)")
if BlockedNicks[strlower(conNick)] then
curUser:SendData("*** The user you are trying to download is not authorized to upload.")
return 1
end
end
end
elseif strsub(data,1,1) == "<" and curUser.bOperator then
local _,_,cmd,nick = strfind(data,"^%b<>%s+(%S+)%s+(%S+)|$")
if cmd and cmd == cmd1 then
if BlockedNicks[strlower(nick)] then
BlockedNicks[strlower(nick)] = nil
curUser:SendData("*** "..nick.." is now unblocked.")
else
BlockedNicks[strlower(nick)] = 1
curUser:SendData("*** "..nick.." is now blocked.")
end
end
end
end
How about add +unblock to remove the block, so for example if the reason they were being blocked is resolved a master or op could +unblock, and have all info stored in a .dat file so even if the hub is reset all people blocked will still be blocked.
thanks phatty...
well XPMAN, its the same command as to block.
if the nick already exsist as blcoked then it is removed try yourself
+blocknick test
and then again.
Chilla, is there a version to block all download/upload (like this new version) but operators can download but not upload to all?
nope not really...
well just have your OP's to have zero slots.
but when a op then connects to a blocked client, and if he is using dc++, then the blocked client will be able to get the OP's filelist.
After a connection has been establishe between 2 clients, the clients don't use the hub anymore to communicate. So then either client can send out a connection request directly to the other client.
Apart from that the script above is easy to pass by, just change nick,
so we could switch over to IP's, no problem,
but then you can change IP's , well thats when you start to insert only allowed nicks ;).
But Its just a playing around.
hummm let me see...
When op connects in a blocked user, the blocked user can download filelist from this dc++ op. But only filelist? Can't download any other file?
The other point, I don't understand, because if I blocked all client except Ops, nobody can estabilish a connection with anybody right?
Let me explain my situation:
I am making a new hub to redirect all users from my main hub that get banned. This new hub exists only for Ops see the users problems and try to help these users. Nobody can download from anybody but Ops can download the filelist to see the bad files.
Can you help me to write a download block for my case?
sure no problem.
it actually already existsts.. you will have to insert the OP's names in it, and when they download a filelist and see the user connecting they just have to close the connection, look here (http://board.univ-angers.fr/thread.php?threadid=249&boardid=12&sid=4addcd02e9e5663afc2f86295155a4ff&page=1#6)
And well depending what setting your ops have the user could download anything. filelist anything, doesn't matter.
I couldn't get it to work. I assume you type the +blocknick in main chat? Tried a couple different ways but still coultn't get it to work. HELP.............
it is
+blocknick
and you must be operator.
hi chilla
very nice script ;)
could you change it ...
if i write +blocknick
in mainchat, that the cmd was not seen in mainchat?
that would be great 4me ...
thx chilla
nothing easier than that ;)
--100% Blocker by chill
cmd1 = "+blocknick"
BlockedNicks = {}
function Main()
frmHub:EnableFullData(1)
end
BlockTriggs = {
["$Rev"] = 1,
["$Con"] = 2,
}
function DataArrival(curUser,data)
if strsub(data,1,1) == "$" then
local str1 = strsub(data,1,4)
if BlockTriggs[str1] then
if BlockedNicks[strlower(curUser.sName)] then
curUser:SendData("*** You are not authorized to download.")
return 1
elseif BlockTriggs[str1] == 1 then
local _,_,conNick = strfind(data,"(%S+)|$")
if BlockedNicks[strlower(conNick)] then
curUser:SendData("*** The user you are trying to download from is not authorized to upload.")
return 1
end
elseif BlockTriggs[str1] == 2 then
local _,_,conNick = strfind(strsub(data,14,strlen(data)),"^(%S+)")
if BlockedNicks[strlower(conNick)] then
curUser:SendData("*** The user you are trying to download from is not authorized to upload.")
return 1
end
end
end
elseif strsub(data,1,1) == "<" and curUser.bOperator then
local _,_,cmd,nick = strfind(data,"^%b<>%s+(%S+)%s+(%S+)|$")
if cmd and cmd == cmd1 then
if BlockedNicks[strlower(nick)] then
BlockedNicks[strlower(nick)] = nil
curUser:SendData("*** "..nick.." is now unblocked.")
else
BlockedNicks[strlower(nick)] = 1
curUser:SendData("*** "..nick.." is now blocked.")
end
return 1 -- TELLS THE HUB TO STOP PROCESSING THE DATA
end
end
end
gr?zi chilla ;)
thx a lot
great work :-)
greetz HaL
Heya Chilla ... thanks for this script. I'm not entirely sure if it can be modified to do what I need though. Here's what I'm looking for:
VIP & OPs:
- Can download anything from anyone
Registered:
- Can only download file lists and mp3's
Unregistered:
- Can only download mp3's with a certain fixed string in the actual file name (and file lists).
If this isn't posible, is there a way to at least block searching based on the same criteria?
nope can't be done, this dowbload blocker is actually only a connection blocker.
I can block connections, but can't check what will be downloaded or how much.
Hi chill,
I'm using this script, but I've noticed some users still can connect and dl (using other clients than dc++), if your method blocks more, maybe you could incorporate it in this script, that would be great. Remember, it is supposed to block only downloads and searches for unregged users, they can still chat and upload.
Here goes:
---------------------
-- LEECHBLOCKER 02 -- for PtokaX TD4
---------------------
-- Created by SAMPLERman - HUB: samplerman.no-ip.info
-- 5/August/2003
-- Based on an idea by OpiumVolage and RabidWombat
-- And thanks AGAIN to RabidWombat for new ideas
-- This LUA script prevents users that are not registered in the hub (=aliens)
-- from connecting to other users (for downloading).
-- New users (=aliens) can chat, upload and be searched. They just can't download.
-- This way your previously private hub can again be public.
-- Optionally, the script also blocks searches (from nonregged users).
-- However, it is recommended that you allow everyone to search your hub, so that
-- new users know what they are missing.
-- NEW in version 02:
-- To allow an alien to download for 1 session, OPs can type this command:
-- !letleech
-- To do for next version:
-- Optionally, aliens can download off of other aliens
-- There are 2 kinds of hubs:
-- 1) Open hubs for sharing anything
-- 2) Small hubs that concentrate on a special interest (e.g. classical sheet music)
-- This script is NOT recommended for hub kind #1, where it is enough to
-- control how many GB users are sharing.
-- Because in hub type #1 there is no point in registering users, this script
-- should be adapted to make shared amount the criteria for letting download.
-- Even better, for hub type #1 users who share little should be allowed to download
-- from other people who share little.
-- Freedom is a strength of the Direct Connect community; please do not cut into
-- people's freedom except when absolutely necessary.
-- This script is only for closed hubs with a very specific subject.
-------------------------------
-- SOURCES OF SCRIPTING INFO --
-------------------------------
-- Scripting.txt (comes with PtokaX)
-- <[URL]http://lua.bcs-solutions.de/[/URL]>
-- LUA reference manual 4.0.pdf
----------------------
-- GLOBAL VARIABLES -- make changes here only
----------------------
smDebugging = "0" -- Default is "0" (silent mode). "1" sends msgs to OPs
smBlockSearches = "1" -- Default is "0" (do not block searches)
smBlockSearchExceptions = { "scores", "sheet music" }
MsgToAliens = "\t\t\t*** warning***\r\n\t"..
"YOU ARE UNABLE TO DOWNLOAD IN THIS HUB\r\n\t"..
"Only registered users can download.\r\n\t"..
"You still can chat and play the games...\r\n\t"..
"...but the hub won't let you search or download until you register.\r\n"..
"\tIn order to become a registered member:\r\n\t"..
"1) Stay in the hub for awhile and be nice to everyone\r\n\t"..
"2) After some time (max a day or two) someone will ask you if you want to register\r\n\t"..
"We hope you will join us."
LetLeechCommand = "!letleech"
----------------------------------
-- Do not change anything below --
----------------------------------
smBot = frmHub:GetHubBotName() -- This line gets bot name from PtokaX hubsoftware;
-- therefore, your Hub Bot should be enabled.
ToBlock = { "^$ConnectToMe%s(%S+)", "^$RevConnectToMe%s(%S+)", "^$Search%s+(%S+)"}
LetLeech = {}
--// This function is called when hub or script starts
function Main()
frmHub:EnableFullData(1)
frmHub:UnregBot(smBot)
frmHub:RegBot(smBot)
--// If thus configured, remove search from blocking table:
if smBlockSearches == "0" then
for i,v in ToBlock do
if v == "^$Search%s+(%S+)" then ToBlock[i] = nil end
end
end
end
--// This function is fired when a new user (non-OP) finishes login
function NewUserConnected(user)
if user.iProfile == -1 then
user:SendPM(smBot,"\r\n"..MsgToAliens)
end
end
--// This function is fired when new data arrives
function DataArrival (user, data)
--// See if data is the !letleech command:
if strsub(data, 1, 1) == "<" then
local line=strsub(data,1,strlen(data)-1) -- remove last char
local s,e,cmd = strfind(line, "%b<>%s+(%S+)")
local s,e,arg = strfind(line, "%b<>%s+%S+%s+(%S+)")
if strlower(cmd)==strlower(LetLeechCommand) then
if user.iProfile ~= 0 and user.iProfile ~= 1 then
SendToAll(smBot, "...but you are not an OP!")
return nil
end
who = GetItemByName(arg)
if not who then
SendToOps(smBot, arg.." is not online.")
return 1
end
if who.iProfile ~= -1 then
SendToOps(smBot, arg.." is registered and does not need a leech license.")
return 1
end
LetLeech[arg] = 1
SendToOps(smBot,arg.." has been granted a special leech license.")
who:SendData(smBot,arg..", you are now authorized to download for this session.")
return 1
end
end
--// See if data should be blocked:
for _,blockstring in ToBlock do
local _, _, who = strfind(data, blockstring)
if who then return smBlock(user,data,who) end
end
end
function smBlock(user,data,who)
local report
local profnam = GetProfileName(user.iProfile)
if profnam then
profnam = strlower(profnam)
else
profnam = "alien"
end
--// Activity by Masters, OPs, VIPs and REGs are just reported to OPs:
--// Also, searches pass if they are in the exception list:
--// Data also passes if user is in LetLeech list:
if (user.iProfile ~= -1) or smMatchException(data)
or IsInLeechList(user) then
report = "\t"..user.sName.." ("..profnam..") sends:\r\n\t"..data
smDebugToOPs(report)
return nil
end
--// Alien (not registered) users get blocked:
local report = "\tBlocked from "..user.sName.." ("..
profnam.."):\r\n\t"..data
smDebugToOPs(report)
return 1
end
function smMatchException(data)
if strfind (data, "^$Search%s+(%S+)") then
for _,exceptword in smBlockSearchExceptions do
if strfind (strlower(data), strlower(exceptword)) then
return 1
end
end
end
return nil
end
function IsInLeechList(user)
for i,v in LetLeech do
if i == user.sName then return 1 end
end
return nil
end
function smDebugToOPs(data)
if smDebugging == "1" then
SendToOps(smBot,data)
end
end
Thanx in advance. Cheers
Hi
How Can i change this bot so only Masters can download??
I am using profiles from Robocop8.0a
Woody
This was Edited for me bu Pus;
Levels for downloads;
function Main()
frmHub:EnableFullData(1)
Levels = {
Master = "1",
Operator = "1",
VIP = "1",
Reg = "0",
Default = "0"
}
end
function DataArrival(curUser, data)
if (strsub(data, 1, 15) == "$RevConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
if isEnabled(GetProfileName(GetItemByName(towho).iProfile))=="1" then
curUser:SendData("*** You must get registered to be able to download from Me so contact a person with [XXX] Tag to get Registered")
end
return 1
elseif (strsub(data, 1, 12) == "$ConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
if isEnabled(GetProfileName(GetItemByName(towho).iProfile))=="1" then
curUser:SendData("*** You must get registered to be able to download from Me so contact a person with [G-T-E] Tag to get Registered")
end
return 1
end
end
function isEnabled(profile)
ret = "0"
if profile then
for i, v in Levels do
if ( i == profile ) then
ret = v
end
end
Messege to user adjust to ur needs:
curUser:SendData("*** Add ur own messege to user here")
end
Goodluck G8
GoOd WoRk chila
LOoOL (uk-kingdom)pH?tt?
C===];;;:::::::>-------
hi, i need a special variation of this blocker-script: regged users should not be able to d/l from OPs and VIPs either ... if it helps vips on my hub have all the same prefix [VIP] .... so what i actually need is a script that blocks regged people to download from specified prefixes... but ONLY download should be blocked not search or upload! can you help me with that? thx
[*EDIT*] Totaly mistaken, sorry long hours [*EDIT*]
bet this could be written better, got a bit rusty, but lua is just great, so I think this one should work.
--100% Blocker by chill
--only allows connection between same Prefixes e.g. [VIP]nobody may only connect to [VIP]nobody2
--if VIP is added UserPrefix list, by typing "adup VIP"
-- cmd's
-- "adup" -- add/dell userprfx
-- "listup" -- list userprfx
function Main()
frmHub:EnableFullData(1)
end
function TrigOnRev(curUser,data)
return CheckForSamePRFX(curUser,data,"PasCon")
end
function TrigOnCon(curUser,data)
return CheckForSamePRFX(curUser,data,"ActCon")
end
function GetUserPRFX(sname)
if strsub(sname,1,1) == "[" then
for i = 2,UserPRFXS.lPRFX do
if strsub(sname,i,i) == "]" then
return strsub(sname,2,(i-1))
end
end
end
end
function CheckForSamePRFX(curUser,data,cmode)
local prfx = GetUserPRFX(curUser.sName)
if prfx and UserPRFXS.t[prfx] then
local conNick = ""
if (cmode == "PasCon") then
_,_,conNick = strfind(data,"(%S+)|$")
elsif (cmode == "ActCon") then
_,_,conNick = strfind(data,"^%$ConnectToMe%s(%S+)")
end
conNick = conNick or ""
local cprfx = GetUserPRFX(conNick)
if not (cprfx and cprfx == prfx) then
return "toblock"
end
else
return "toblock"
end
end
ConnectTriggs = {}
ConnectTriggs["$Rev"] = TrigOnRev
ConnectTriggs["$Con"] = TrigOnCon
function DataArrival(curUser,data)
if strsub(data,1,1) == "$" and (not curUser.bOperator) then
local str1 = strsub(data,1,4)
if ConnectTriggs[str1] then
if ConnectTriggs[str1](curUser,data) then
return 1
end
end
elseif strsub(data,1,1) == "<" and curUser.bOperator then
data = strsub(data,1,strlen(data)-1)
local _,_,cmd = strfind(data,"^%b<>%s+(%S+)")
local _,_,prfx = strfind(data,"^%b<>%s+%S+%s+(%S+)$")
if cmd and UserPRFXS.f[cmd] then
curUser:SendData(UserPRFXS.f[cmd](UserPRFXS,prfx))
return 1
end
end
end
UserPRFXS = {}
UserPRFXS.lPRFX = 0
UserPRFXS.t = {}
UserPRFXS.f = {}
function AddDelUserPRFXS(self,prfx)
prfx = prfx or ""
str = "-- Prefix "..prfx.." was "
if self.t[prfx] then
self.t[prfx] = nil
str.." delted"
elseif prfx and (prfx ~= "") then
self.t[prfx] = 1
str.." added"
end
GetLongestPRFX(self)
end
function GetUserPRFXList(self)
local str = "-- List of Connections --\r\n"
for i,v in self.t do
str = str..i.."\r\n"
end
return str
end
function GetLongestPRFX(self)
self.lPRFX = 0
for i,_ in self.t do
local len = strlen(i) + 2
if (len > self.lPRFX) then
self.lPRFX == len
end
end
end
UserPRFXS.f.adup = AddDelUserPRFXS
UserPRFXS.f.listup = GetUserPRFXList
this one is a bit better I think,
--100% Blocker by chill
--only allows connection between same Prefixes e.g. [VIP]nobody may only connect to [VIP]nobody2
--if VIP is added UserPrefix list, by typing "adup VIP"
-- cmd's
-- "adup" -- add/dell userprfx
-- "listup" -- list userprfx
function Main()
frmHub:EnableFullData(1)
end
function TrigOnRev(curUser,data)
return CheckForSamePRFX(curUser,data,"PasCon")
end
function TrigOnCon(curUser,data)
return CheckForSamePRFX(curUser,data,"ActCon")
end
function GetUserPRFX(sname)
if strsub(sname,1,1) == "[" then
for i = 2,UserPRFXS.lPRFX do
if strsub(sname,i,i) == "]" then
return strsub(sname,2,(i-1))
end
end
end
end
function CheckForSamePRFX(curUser,data,cmode)
local prfx = GetUserPRFX(curUser.sName)
if prfx and UserPRFXS.t[prfx] then
local conNick = ""
if (cmode == "PasCon") then
_,_,conNick = strfind(data,"(%S+)|$")
elsif (cmode == "ActCon") then
_,_,conNick = strfind(data,"^%$ConnectToMe%s(%S+)")
end
conNick = conNick or ""
local cprfx = GetUserPRFX(conNick)
if not (cprfx and cprfx == prfx) then
return "toblock"
end
else
return "toblock"
end
end
ConnectTriggs = {}
ConnectTriggs["$Rev"] = TrigOnRev
ConnectTriggs["$Con"] = TrigOnCon
function DataArrival(curUser,data)
if strsub(data,1,1) == "$" and (not curUser.bOperator) then
local str1 = strsub(data,1,4)
if ConnectTriggs[str1] then
if ConnectTriggs[str1](curUser,data) then
return 1
end
end
elseif strsub(data,1,1) == "<" and curUser.bOperator then
data = strsub(data,1,strlen(data)-1)
local _,_,cmd = strfind(data,"^%b<>%s+(%S+)")
local _,_,prfx = strfind(data,"^%b<>%s+%S+%s+(%S+)$")
if cmd and UserPRFXS.f[cmd] then
curUser:SendData(UserPRFXS.f[cmd](UserPRFXS,prfx))
return 1
end
end
end
UserPRFXS = {}
UserPRFXS.lPRFX = 0
UserPRFXS.t = {}
UserPRFXS.f = {}
function AddDelUserPRFXS(self,prfx)
prfx = prfx or ""
str = "-- Prefix "..prfx.." was "
if self.t[prfx] then
self.t[prfx] = nil
str.." delted"
elseif prfx and (prfx ~= "") then
self.t[prfx] = 1
str.." added"
end
GetLongestPRFX(self)
end
function GetUserPRFXList(self)
local str = "-- List of Connections --\r\n"
for i,_ in self.t do
str = str..i.."\r\n"
end
return str
end
function GetLongestPRFX(self)
self.lPRFX = 0
for i,_ in self.t do
local len = strlen(i) + 2
if (len > self.lPRFX) then
self.lPRFX == len
end
end
end
UserPRFXS.f.adup = AddDelUserPRFXS
UserPRFXS.f.listup = GetUserPRFXList
another version of this script, it only should allow connections to people who have equal or lower share than oneself
*edit* onlz works for active users, need to fix it to properly work for passive connections, laters
--100% Blocker by chill
--only allows connection to users who's share is less or equal to one owns share
function Main()
frmHub:EnableFullData(1)
end
function TrigOnRev(curUser,data)
return CheckForEorLShare(curUser,data,"PAS")
end
function TrigOnCon(curUser,data)
return CheckForEorLShare(curUser,data,"ACT")
end
function CheckForEorLShare(connector,data,mode)
local conNick = ""
if mode == "ACT" then
_,_,conNick = strfind(data,"^%$ConnectToMe%s(%S+)")
elseif mode == "PAS" then
_,_,conNick = strfind(data,"(%S+)|$")
end
if conNick then
local connected = GetItemByName(conNick)
local corShare = GetShare(connector.sMyInfoString)
local cedShare = GetShare(connected.sMyInfoString)
if not (corShare >= cedShare) then
return "toblock"
end
else
return "toblock"
end
end
function GetShare(sMyINFO)
local _,_,share = strfind(sMyINFO,"%$(%d+)%$|+$")
share = share or 0
return share
end
ConnectTriggs = {}
ConnectTriggs["$Rev"] = TrigOnRev
ConnectTriggs["$Con"] = TrigOnCon
function DataArrival(curUser,data)
if strsub(data,1,1) == "$" and (not curUser.bOperator) then
local str1 = strsub(data,1,4)
if ConnectTriggs[str1] then
if ConnectTriggs[str1](curUser,data) then
return 1
end
end
end
end
done.
Blocks Connects if your sharesize is lower than the share of the user you are connecting to.
On Passive Connects it adds a table entry whitch will be lookedup when the Active response come, if it doesn't come the entrie will be deleted after a certain amount of time.
--100% Blocker by chill
--only allows connection to users who's share is less or equal to one owns share
function Main()
frmHub:EnableFullData(1)
SetTimer(1000)
StartTimer()
end
function OnTimer()
for i,v in AConnects.t do
v = v - 1
if v <= 0 then
AConnects.t[i] = nil
else
AConnects.t[i] = v
end
end
end
function TrigOnRev(curUser,data)
return CheckForEorLShare(curUser,data,"PAS")
end
function TrigOnCon(curUser,data)
return CheckForEorLShare(curUser,data,"ACT")
end
function CheckForEorLShare(connector,data,mode)
local conNick = ""
if mode == "ACT" then
_,_,conNick = strfind(data,"^%$ConnectToMe%s(%S+)")
if conNick then
local entry = AConnects.t[connector.sName]
if entry and (entry[1] == conNick) then
AConnects.t[connector.sName] = nil
return
end
end
elseif mode == "PAS" then
_,_,conNick = strfind(data,"(%S+)|$")
end
if conNick then
local connected = GetItemByName(conNick)
local corShare = GetShare(connector.sMyInfoString)
local cedShare = GetShare(connected.sMyInfoString)
if not (corShare >= cedShare) then
return "toblock"
end
else
return "toblock"
end
if (mode == "PAS") then
AConnects.t[conNick] = { connector.sName,AConnects.timeout }
end
end
function GetShare(sMyINFO)
local _,_,share = strfind(sMyINFO,"%$(%d+)%$|+$")
share = share or 0
return share
end
-- Allowed Connects
AConnects = {}
AConnects.t = {}
Aconnects.timeout = 10
ConnectTriggs = {}
ConnectTriggs["$Rev"] = TrigOnRev
ConnectTriggs["$Con"] = TrigOnCon
function DataArrival(curUser,data)
if strsub(data,1,1) == "$" and (not curUser.bOperator) then
local str1 = strsub(data,1,4)
if ConnectTriggs[str1] then
if ConnectTriggs[str1](curUser,data) then
return 1
end
end
end
end
this one is quite stable, but it will have some problems with passive operators, but else it runs finest
--DownloadBlocker by Share V 001 by chill
--only allows connection to users who's share is less or equal to one owns share
function Main()
frmHub:EnableFullData(1)
SetTimer(1000)
StartTimer()
end
function OnTimer()
for i,v in AConnects.t do
local count = 0
for i2,v2 in v do
v2 = v2 - 1
if v2 <= 0 then
AConnects.t[i][i2] = nil
else
AConnects.t[i][i2] = v2
end
count = count + 1
end
if count == 0 then
AConnects.t[i] = nil
end
end
end
function TrigOnRev(curUser,data)
return CheckForEorLShare(curUser,data,"PAS")
end
function TrigOnCon(curUser,data)
return CheckForEorLShare(curUser,data,"ACT")
end
function CheckForEorLShare(connector,data,mode)
local conNick = ""
if mode == "ACT" then
_,_,conNick = strfind(data,"^%$ConnectToMe%s(%S+)")
if conNick then
local entry = AConnects.t[connector.sName]
if entry and (entry[conNick]) then
AConnects.t[connector.sName][conNick] = nil
return
end
end
elseif mode == "PAS" then
_,_,conNick = strfind(data,"(%S+)|$")
end
if conNick then
local connected = GetItemByName(conNick)
if connected then
local corShare = GetShare(connector.sMyInfoString)
local cedShare = GetShare(connected.sMyInfoString)
if (corShare < cedShare) then
return "toblock",ConvShare((cedShare-corShare)),conNick
end
else
return "toblock"
end
else
return "toblock"
end
if (mode == "PAS") then
AConnects.t[conNick] = AConnects.t[conNick] or {}
AConnects.t[conNick][connector.sName] = AConnects.timeout
end
end
function GetShare(sMyINFO)
local _,_,share = strfind(sMyINFO,"%$(%d+)%$|$")
share = tonumber(share) or 0
return share
end
function ConvShare(share)
local tmes = { "KB","MB","GB","TB","PB" }
local num = 1024
for i = getn(tmes),1,-1 do
local snum = num^i
if share > snum then
return format("%4.2f",share/snum).." "..tmes[i]
end
end
return format("%4.2f",share).." B"
end
-- Allowed Connects
AConnects = {}
AConnects.t = {}
AConnects.timeout = 10
ConnectTriggs = {}
ConnectTriggs["$Rev"] = TrigOnRev
ConnectTriggs["$Con"] = TrigOnCon
function DataArrival(curUser,data)
if strsub(data,1,1) == "$" and (not curUser.bOperator) then
local str1 = strsub(data,1,4)
if ConnectTriggs[str1] then
local ret,diff,nick = ConnectTriggs[str1](curUser,data)
if ret then
if diff then
curUser:SendData("*** You need "..diff.." more share to download from "..nick)
end
return 1
end
end
end
end
this version blocks downloads by share, but only by shareclasses, what is a bit fairer, so people with 0 share can still gte stuff from guys with < 20 Gigshare, and
the one with biggest share can share his stuff wqith all whos share is also big.
so all upper classes can download from lower classes.
lowest class int his exsample is 0-20 GB and uppest is 800-1024 GB and all whos share is a above 1 TB
--DownloadBlocker by Share V 002 by chill
--only allows connection to users who's share is equal or less to your share class
-- SHare Classes in GigaByte
-- e.g. Class 1 = 0-20, Class 2 = 20-40, and from 800 - endless
ShareClasses = { 0,20,40,60,80,100,200,400,600,800,1024 }
function Main()
ConvertShareClass()
frmHub:EnableFullData(1)
SetTimer(1000)
StartTimer()
end
function ConvertShareClass()
for i = 1,getn(ShareClasses) do
ShareClasses[i] = ShareClasses[i] * (1024*1024*1024)
end
end
function OnTimer()
for i,v in AConnects.t do
local count = 0
for i2,v2 in v do
v2 = v2 - 1
if v2 <= 0 then
AConnects.t[i][i2] = nil
else
AConnects.t[i][i2] = v2
end
count = count + 1
end
if count == 0 then
AConnects.t[i] = nil
end
end
end
function TrigOnRev(curUser,data)
return CheckForEorLShare(curUser,data,"PAS")
end
function TrigOnCon(curUser,data)
return CheckForEorLShare(curUser,data,"ACT")
end
function CheckForEorLShare(connector,data,mode)
local conNick = ""
if mode == "ACT" then
_,_,conNick = strfind(data,"^%$ConnectToMe%s(%S+)")
if conNick then
local entry = AConnects.t[connector.sName]
if entry and (entry[conNick]) then
AConnects.t[connector.sName][conNick] = nil
return
end
end
elseif mode == "PAS" then
_,_,conNick = strfind(data,"(%S+)|$")
end
if conNick then
local connected = GetItemByName(conNick)
if connected then
local corShare = GetShare(connector.sMyInfoString)
local cedShare = GetShare(connected.sMyInfoString)
local class1,lolimit1,uplimit1 = GetShareClass(corShare)
local class2,lolimit2,uplimit2 = GetShareClass(cedShare)
if (class1 < class2) then
return "toblock",class2,lolimit2,uplimit2,(lolimit2-corShare),conNick
end
else
return "toblock"
end
else
return "toblock"
end
if (mode == "PAS") then
AConnects.t[conNick] = AConnects.t[conNick] or {}
AConnects.t[conNick][connector.sName] = AConnects.timeout
end
end
function GetShare(sMyINFO)
local _,_,share = strfind(sMyINFO,"%$(%d+)%$|$")
share = tonumber(share) or 0
return share
end
function ConvShare(share)
local tmes = { "B","KB","MB","GB","TB","PB" }
local num = 1024
for i = 1,getn(tmes) do
local snum = num^i
if (share < snum) or (i==getn(tmes)) then
return format("%4.2f",share/snum*num).." "..tmes[i]
end
end
end
function GetShareClass(share)
for i = 1,getn(ShareClasses) do
if (share < ShareClasses[i]) or (i == getn(ShareClasses)) then
return i,(ShareClasses[(i-1)] or 0),ShareClasses[i]
end
end
end
-- Allowed Connects
AConnects = {}
AConnects.t = {}
AConnects.timeout = 10
ConnectTriggs = {}
ConnectTriggs["$Rev"] = TrigOnRev
ConnectTriggs["$Con"] = TrigOnCon
function DataArrival(curUser,data)
if strsub(data,1,1) == "$" and (not curUser.bOperator) then
local str1 = strsub(data,1,4)
if ConnectTriggs[str1] then
local ret,class,lolim,uplim,diff,nick = ConnectTriggs[str1](curUser,data)
if ret then
if class then
curUser:SendData("*** User "..nick.." is of ShareClass: "..class..
" ("..ConvShare(lolim).."-"..ConvShare(uplim).."), You need "..ConvShare(diff).." more share to be able to download.")
end
return 1
end
end
end
end
Ok, which script did yall post that blocks un regged users from downloading? Dont want the share size restriction one or the VIP and Master only one either. Just the simple one that blocks unregged users.
thankx
Umm... The first post in this thread ;)
Hello CHill
Is there a way that the users who are blocked in a user.dat files is? And that everybody can unblock them.
Know the Op who blocked them must unblock the users.
If it is standing in a user.dat maybe it is possible that every Op can unblock them..
ANd with a !blocked command can seen who is in the list of blocked persons.
It that difficult to make?
Greetings Honda
lol.... i got lost...
can someone tell me what is the latest version of this bot...
or if there is more that one version can someone please post them here....
cause i could use this bot!
better than GAG! :D
Thanks in advance!!!
hi honda,
no I think it won't be a problem, for witch script shall it be?
greets m0rri,
of witch script do you want the latest version, then I will check for new versions, but I think there are no new unposted ones, but I'm not sure.
chill
Hello Chill
Nerbos has made a change in other forum.. That is what i want.
The solution (http://board.univ-angers.fr/action.php?action=getlastboard&threadid=605&boardid=11)
I will try to make some changes by my self..
Not a big scripter but will try.
Greetings
ok guy's this is what i got this far
i think im on the good track but i cant get the command !showblock to work.
it would be nice if it generated a list of the blocked users in our opchat, maybe one of you guy's can help me out.
--100% Blocker by chill
--Table Load and Save (added by nErBoS)
sBot = "BLOCK-BOT"
cmd1 = "!block"
cmd2 = "!unblock"
cmd3 = "!showblock"
BlockedNicks = {}
fBlock = "block.dat"
OpChatName = frmHub:GetOpChatName() --Use this line for inbuilt Px opchat
--## Configuration ##--
uLaterPtokax = 0 -- Choose 0 if you are using Ptokax Version 0.3.3.0 or higher
-- Choose 1 if you are using Ptokax Version lower then 0.3.3.0
--## END ##--
function Main()
frmHub:RegBot(sBot)
frmHub:EnableFullData(1)
LoadFromFile(fBlock)
end
function OnExit()
SaveToFile(fBlock , BlockedNicks , "BlockedNicks")
end
BlockTriggs = {
["$Rev"] = 1,
["$Con"] = 2,
}
function DataArrival(curUser,data)
if strsub(data,1,1) == "$" then
local str1 = strsub(data,1,4)
if BlockTriggs[str1] then
if BlockedNicks[strlower(curUser.sName)] then
curUser:SendData("*** You are not authorized to download.")
return 1
else if BlockTriggs[str1] == 1 then
local _,_,conNick = strfind(data,"(%S+)|$")
if BlockedNicks[strlower(conNick)] then
curUser:SendData("*** The user ..nick.. you are trying to download from is not authorized to upload.")
return 1
end
else if BlockTriggs[str1] == 2 then
local _,_,conNick = strfind(strsub(data,14,strlen(data)),"^(%S+)")
if BlockedNicks[strlower(conNick)] then
curUser:SendData("*** The user ..nick.. test you are trying to download from is not authorized to upload.")
return 1
end
end
end
end
end
end
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) and curUser.iProfile == 5 or curUser.iProfile == 0 then
data = strsub(data,1,strlen(data)-1)
local _,_,cmd,nick = strfind(data,"%b<>%s+(%S+)%s+(%S+)")
------------------------------------------------------------------------------------------ added by johnynl
if (cmd=="!Showblock") then
ReadBlockedNicks(file)
return 1
end
------------------------------------------------------------------------------------------- end
if cmd and cmd == cmd2 and nick then
if BlockedNicks[strlower(nick)] then
BlockedNicks[strlower(nick)] = nil
SendPmToOps(OpChatName, nick.." is now unblocked.")
return 1
end
else if cmd and cmd == cmd1 then
if BlockedNicks[strlower(nick)] == 1 then
curUser:SendPM(sBot, nick.." is already blocked. Use !unblock to unblock this user.")
return 1
else
BlockedNicks[strlower(nick)] = 1
SendPmToOps(OpChatName, nick.." is now blocked.")
return 1
end
if (uLaterPtokax == 1) then
OnExit()
end
return 1 -- TELLS THE HUB TO STOP PROCESSING THE DATA
end
end
end
end
-------------------------------------------------------------------------------------------- added by johnynl
function ReadBlockedNicks(user, data, cmd)
local release = ""
readfrom(file)
while 1 do
local line = read()
if (line == nil) then
break
else
release = release.." "..line.."\r\n"
end
end
SendPmToOps(OpChatName, nick.."is a blocked nickname")
readfrom()
end
--------------------------------------------------------------------------------------------- end
function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");
sTab = sTab or "";
sTmp = ""
sTmp = sTmp..sTab..sTableName.." = {\n"
for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);
if(type(value) == "table") then
sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
sTmp = sTmp..",\n"
end
sTmp = sTmp..sTab.."}"
return sTmp
end
function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end
function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end
thanks in advance for your help with this prob.
Hi,
Check out the topic given by honda and you have there the script with that command.
Best regards, nErBoS
Some1 who has a script that blocks non-regged user to dload from OP's??
They must be a regged user t Dload from all OP's....
That request has already been posted in this thread.
QuoteOriginally posted by [G-T-E]Gate?
This was Edited for me bu Pus;
Levels for downloads;
function Main()
frmHub:EnableFullData(1)
Levels = {
Master = "1",
Operator = "1",
VIP = "1",
Reg = "0",
Default = "0"
}
end
function DataArrival(curUser, data)
if (strsub(data, 1, 15) == "$RevConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
if isEnabled(GetProfileName(GetItemByName(towho).iProfile))=="1" then
curUser:SendData("*** You must get registered to be able to download from Me so contact a person with [XXX] Tag to get Registered")
end
return 1
elseif (strsub(data, 1, 12) == "$ConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
if isEnabled(GetProfileName(GetItemByName(towho).iProfile))=="1" then
curUser:SendData("*** You must get registered to be able to download from Me so contact a person with [G-T-E] Tag to get Registered")
end
return 1
end
end
function isEnabled(profile)
ret = "0"
if profile then
for i, v in Levels do
if ( i == profile ) then
ret = v
end
end
Messege to user adjust to ur needs:
curUser:SendData("*** Add ur own messege to user here")
end
Goodluck G8
**Trying to get this script working in ptokax 0.3.3.0 but i get all kinda line erros , need this script to be modified for ptokax 0330?