- Personal DownloadBlocker -
 

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

- Personal DownloadBlocker -

Started by Optimus, 27 November, 2003, 16:40:32

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Optimus

Hi guy's

I want to have a Download bloker...

Ok what is different?

It must only Block persons that are on a list (Table)

Example:

BlockMeArray = {}

if !blockme then put me on the Block list so others can't download from me.

if !unblockme i will be removed from the list and people can download from me again.

I have tryed myself but without the results *lol*

Btw, for me it's usefull to have it for OP's only

For more Info just post  ;)



Fire Koboy

That's just the script I asked for a couple of days....
I'm too much interested for my OP to...
Burn Baby, Burn...

pHaTTy

Hmmm i actually put some thought into that other week, but, i cant come up with anything at the moment, well anythink that will work that is, atm i dont think it is possible form the server :/
Resistance is futile!

SaintSinner

how about modifying the leechblocker.
   


Optimus

Thx guy's,, still hope some 1 will have a briljant Idea... :]

pHaTTy

Hmmm i think i got it :))))


ok when use a command it get user my name do a function and grab user by

user = GetItemByName(whatever)

then using the leechblocker (modded)

you can block the user yep, but means it will block that user to all :/

ARRF I AINT :/


hmm unless if connect to blahblahg check file if the users name is in that file then block conenct to me thingy else return 0 :))) that wud work yep :))
Resistance is futile!

Fire Koboy

I don't understand well (uk-kingdom)pH?tt? ...
Could do write me a script...and explain it a lil bit for me pliz...Lua is hard to learn...and you seem to control it so good....
I wud thank you so much to help me...
I could help you to learn french ...:) lol
Thanx
Burn Baby, Burn...

pHaTTy

Hmm bugga, hmmm maybe someone else wiv the idea i got can, i bissy with many script atm, had only popped in with the idea srry :/

ir wud also take alot tme,,

srry agen maybe Opium will understand me and give it a shot :))

au revoir

-phatty
Resistance is futile!

honda

Hello

I search that script to.. To block a person only for all OP's but not the users and vips and regs.
Does any one have that sort of script??

Greetings Honda

bastya_elvtars

this really cuts into users' freedom i guess. i do not like to use this. If a user is a rulesbreaker, then kick/ban. No other things have effect.
Everything could have been anything else and it would have just as much meaning.

ARCHANGEL

The idea of DC is to share, I am growing very tired of seeing all these upload/download blockers. The ironic thing is this, you kick and ban people who use a speed limiter, yet it's okay for you to totally block?


  The word hypocrite springs to mind

To block everybody but OPs?

  What makes you so special?
That is no better than leeching with a superiority complex


You kick and ban leechers remember, isn't that what you are doing?


  Think about it, when you block sharing you are putting another nail in the coffin of DC.

honda

I only want to block one person!! Not everybody..
There are very much leechblockers but the block the other way.. If you are not reg then no download....

Skyhawk

Great Script...

However i have a small request:

Can you add...

1.  A botname so one can enter those commands in a PM with the bot.

2. A function that saves & loads those blocked nicks to & from a file. eg. blocked.dat


Thx in advance.

Skyhawk


nErBoS

#14
Hi,

Done...

--100% Blocker by chill
--Table Load and Save (added by nErBoS)

sBot = "BLOCK-BOT"

cmd1 = "+blocknick"

BlockedNicks = {}
fBlock = "block.dat"

--## 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
			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
	end
	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) and curUser.bOperator then
		data = strsub(data,1,strlen(data)-1)
		local _,_,cmd,nick = strfind(data,"%b<>%s+(%S+)%s+(%S+)")
		if cmd and cmd == cmd1 and nick 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
			if (uLaterPtokax == 1) then
				OnExit()
			end
			return 1  -- TELLS THE HUB TO STOP PROCESSING THE DATA
		end
	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

Best regards, nErBoS
--## nErBoS Spot ##--

bastya_elvtars

QuoteOriginally posted by Skyhawk
HELLO ???

patience m8 plz

this is a board, not a supermarket :evil:
Everything could have been anything else and it would have just as much meaning.

Skyhawk

hehe


sorry

i was just too anxoius

MANY THANKS

Skyhawk


nErBoS

Hi,

I think that you were talking about the commands i have fixed the script above.

Best regards, nErBoS
--## nErBoS Spot ##--

Skyhawk

I've now copied the script  from above but it wouldn't work   the bot doesn't even give any reaction

nErBoS

Hi,

I have fixed and test it, try it now.

Best regards, nErBoS
--## nErBoS Spot ##--

Skyhawk

It seems to work. However the table isn't saved until i manually restart the scripts. So therefore some small additional requests

1. Could you alter the script so that the table is saved directly after the +blocknick commmand is executed?

2. And maybe instead of Showing a short message in the mainchat could you do it that the bot answers in a PM to the one entering the command?

3. Finally could you alter the script so that only Masters (Profile number 0) can use this command since this is a very powerfull bot although tiny?


Many many thanks to the grandmaster of LUA

Skyhawk

#22
well i figured request 2 out by myself...

i just replaced this:

curUser:SendData("*** "..nick.." is now unblocked.")

with this:

curUser:SendPM(sBot, nick.." is now unblocked.")



Thanks to you i am really starting to learn LUA

Skyhawk

#23
well maybe it isn't neccessary in ptokax > 0.3.3.0 to save the table after command?


nErBoS

#24
Hi,

1) I assume that you are using the ptokax 0.3.3.0, the function OnExit works when you are shutting down the software or restarting the script, this function only existes on 0.3.3.0, then i made a configuration set for you to choose each ptokax version you are using, then if you want to save the table every time it has a change just put uLaterPtokax = 1 (it will act like you were using a Test Drive). But like you did is also possible  ;)

2) That's a start to learn LUA like you said. I have start by translating scripts, then i have start to put togheter some scripts, then i have start to make my own scripts. Good Luck if you are realy interested in learning LUA.

3) Just change this line ....

Quoteif (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) and curUser.bOperator then

for this...

Quoteif (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) and user.iProfile == 0 then

I have bolded the changrd parts to you understand  ;)

Best regards, nErBoS
--## nErBoS Spot ##--

SMF spam blocked by CleanTalk