Could someone make a script that delete all things in the banlist, except for ips and bans with username is made by just numbers?
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)
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.
This (http://ptxwiki.psycho-chihuahua.net/doku.php/changelogs/ptokax/changes_after_0.330_15.31#next_release) explains why your things will be obsolete in 2 weeks or so... :)
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
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",
},
}
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 .
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.
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.