delete specific things in banlist
 

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

delete specific things in banlist

Started by blackwings, 08 October, 2005, 16:13:31

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

blackwings

Could someone make a script that delete all things in the banlist, except for ips and bans with username is made by just numbers?


blackwings

#1
hmm, this doesn't do what I wanted. I tried to modify so it did as I wanted it to,
but strangely enough I had no succes in doing that :(

I want it to do this =

First it checks the left column:
delete all things that isn't an IP or purly just numbers.

Then it checks the right column:
delete all things that isn't just purely just numbers(well, if its the exact number as 2154, then it should also be deleted)


blackwings

QuoteOriginally posted by Mutor
So I ask...
What columns are you talking about?
sorry,sorry, I was talking about when you look in ptokax gui :P

And no, your script isn't doing what I requested, your script deletes everything except for things that are just number, your script also deletes ips.


bastya_elvtars

#3
This explains why your things will be obsolete in 2 weeks or so... :)
Everything could have been anything else and it would have just as much meaning.

blackwings

#4
Well, I have now modified your script so it works the way I wanted it to =
function Main() 
	PermBanTab = frmHub:GetPermBanList()
	for k,v in PermBanTab do
		if string.find(v["sIP"],"%a") then
			Unban(v["sIP"])
		end		
		if v["sNick"]=="2154" then
			Unban(v["sIP"])	
		end
		
	end
end
Here is an image over what your script made Mutor = http://img481.imageshack.us/img481/2034/yourlua4nq.png


blackwings

I have already started to make an version for the comming new ptokax release, but I get an error =
Syntax C:\ptokax03321f\scripts\table.lua:7: bad argument #1 to `find' (string expected, got nil)
Here is the code =
SaveTheLast = 30  -- how many of the last made bans the script shouldn't delete

function Main() 
	PermBanTab = frmHub:GetPermBanList()
	for k,v in PermBanTab do
		if k <= (table.getn(PermBanTab) - SaveTheLast) then
			if string.find(v["sNick"],"%a") then
				Unban(v["sNick"])
			end

		end
	end
end
But it should work with the new table, see =
PermBanTab = {
	[1] = {
		["sIP"] = "IP",
		["bIpBan"] = 1,
		["bNickBan"] = 1,
		["sNick"] = "username",
	},
	[2] = {
		["sIP"] = "IP",
		["bIpBan"] = 1,
		["bNickBan"] = 1,
		["sNick"] = "username",
	},
	[3] = {
		["sIP"] = "IP",
		["bIpBan"] = 1,
		["bNickBan"] = 1,
		["sNick"] = "username",
	},
}


Dessamator

Look at ur code again, uve made an error in the variables, make sure u understand what the "k" value is and what "v" is .
Ignorance is Bliss.

blackwings

QuoteOriginally posted by Dessamator
Look at ur code again, uve made an error in the variables, make sure u understand what the "k" value is and what "v" is .
ehm, uhm, don't quite see what you mean. Ofcourse I know what k and v stand for.
The difference between the old banlist table and the new one is the new
["bIpBan"] and ["bNickBan"] + that in the new banlist, ["sIP"] stands first now. So the way I see it, it should work wit the new banlist, it worked with the old.

So, I dont see what you mean, can't see the mistake,
so could you explain my mistake.  

A metaphor =
Its like when you make a drawing etc, you think its great,
then you ask for criticism and they start to point out several mistakes.
Like you might should have made that shadow different,
wrong choice of color there or the lines are to visible etc.

It's always eaiser for the observer to see the mistakes +
you guys are elite programmers, I just program in lua and java as a small hobby.


Dessamator

QuoteOriginally posted by blackwings
QuoteOriginally posted by Dessamator
Look at ur code again, uve made an error in the variables, make sure u understand what the "k" value is and what "v" is .
ehm, uhm, don't quite see what you mean. Ofcourse I know what k and v stand for.
The difference between the old banlist table and the new one is the new
["bIpBan"] and ["bNickBan"] + that in the new banlist, ["sIP"] stands first now. So the way I see it, it should work wit the new banlist, it worked with the old.

So, I dont see what you mean, can't see the mistake,
so could you explain my mistake.  

A metaphor =
Its like when you make a drawing etc, you think its great,
then you ask for criticism and they start to point out several mistakes.
Like you might should have made that shadow different,
wrong choice of color there or the lines are to visible etc.

It's always eaiser for the observer to see the mistakes +
you guys are elite programmers, I just program in lua and java as a small hobby.

Well I was just giving you a hint so you could solve it by yourself, but i do agree with you some observers can see more than the creator, either way , in ur table  
e.g.:
K == "1"
v== "sNick"

so basically what ur doing is, "v["sNick"]" == "sNick["sNick"]

hope that helps.
Ignorance is Bliss.

SMF spam blocked by CleanTalk