PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Shurlock on 14 January, 2005, 01:52:33

Title: Nick check (against leecheers??)
Post by: Shurlock on 14 January, 2005, 01:52:33
Hi all,

I would like to eliminate the possibility for people to enter the hub with nicknames that contain characters that are repeated MORE than twice within their nick.

They tend to 'change' 3 to 4 characters, 4 to 5, etc. etc.
Sample: nickname__  will be changed into nickname____ (One more underscore!)
Or... nicccknamme  will be changed into niccknammme

Above that, I would like to filter the name to pure ASCII characters ONLY! No ?  or ?  or other non-alpha/numeric characters, except for '-' and underscores.

I realize this will probably slow down the hub, but.... changing nick will eliminate the downloads of other HONEST users.

I hope someone comes up with a bright idea to check this without causing too much 'lag' on the hub as the  HONEST users (and I !!!) experience this as very annoying!

Thanks in advance!

((Should PtoKax have this option built in, please explain to me. Thanks!))  
Title:
Post by: ??????Hawk?????? on 14 January, 2005, 02:04:29
hi m8  

by  blocking  ascii   youll  find  you'll block  half of the dc users...

like  me  for instance   lol

i never did like that option on that ...   Ehem..... Other y-Hub soft


Most ppl have the  ' auto find alternative download locations  '  enabled in their clients anyway.
so there downloads will continue.




??????Hawk??????    <---- dont KILL the ascii... :P  :P
Title:
Post by: Shurlock on 15 January, 2005, 01:40:59
Thanks for the warning Hawk, but....
I would prefer securing the hub against fakers.

Thing is, that these 'non-ASCII' characters are not checked by DOS-oriented programs that do very good jobs.

I'd rather have users in my hub that are serious, than users that have 'imagination'. (Sorry, nothing peronal!!)

So, if anyone can help me out on this subject,, I would be very happy!

Thanks.
Title:
Post by: imby on 15 January, 2005, 16:21:22
Yeah, I agree, I dislike ASCII. Any way to block non-alphanumeric characters in PtokaX? Keeping [{()}]_- of course, possibly @ to.
Title:
Post by: ??????Hawk?????? on 15 January, 2005, 18:18:19
heya peeps  ..

its  not  perfect  but seems to  do the job..







--// Hawk Blocker By ....
--//  ??????Hawk??????   <---- well if your gonna block me  ill get my ascii in here  :p
--//  15/01/2005


bot = "Hawk-Blocker"  -- Bots name

function Main()
OKchars ="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ1234567890-_(){}[]@"
end



function NewUserConnected(curUser)
local CharsLeft = curUser.sName
local CharToCheck = "a"
while CharToCheck do
_,_,CharToCheck,CharsLeft = strfind(CharsLeft,"(%S)(.*)")
if  CharsLeft == nil then break
else
if not strfind(OKchars,CharToCheck) then
curUser:SendData(bot,"\r\n\r\nYou have Illegal Chars in your nick Please Use Standard Charicters:-\r\n\r\nok Chars are:-\r\n\r\n"..OKchars.."\r\n\r\n")
curUser:Disconnect()
end
end
end
end


function OpConnected(curUser)
NewUserConnected(curUser)
end







Change it,, edit it  and make it work for  you  :-)

Have fun peeps  and dont ask me in ur hubs  lololol

??????Hawk??????
Title:
Post by: BoJlk on 15 January, 2005, 19:13:24
Isn't there a build in option in PX?

(http://img.photobucket.com/albums/v509/BoJlk/Forum%20Use/PXnicks.jpg)

i'm just asking because i have the same problem with nicknames
Title:
Post by: imby on 03 July, 2005, 16:42:56
QuoteOriginally posted by ??????Hawk??????
heya peeps  ..

its  not  perfect  but seems to  do the job..







--// Hawk Blocker By ....
--//  ??????Hawk??????   <---- well if your gonna block me  ill get my ascii in here  :p
--//  15/01/2005


bot = "Hawk-Blocker"  -- Bots name

function Main()
OKchars ="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ1234567890-_(){}[]@"
end



function NewUserConnected(curUser)
local CharsLeft = curUser.sName
local CharToCheck = "a"
while CharToCheck do
_,_,CharToCheck,CharsLeft = strfind(CharsLeft,"(%S)(.*)")
if  CharsLeft == nil then break
else
if not strfind(OKchars,CharToCheck) then
curUser:SendData(bot,"\r\n\r\nYou have Illegal Chars in your nick Please Use Standard Charicters:-\r\n\r\nok Chars are:-\r\n\r\n"..OKchars.."\r\n\r\n")
curUser:Disconnect()
end
end
end
end


function OpConnected(curUser)
NewUserConnected(curUser)
end







Change it,, edit it  and make it work for  you  :-)

Have fun peeps  and dont ask me in ur hubs  lololol

??????Hawk??????

Great, thanks very much, two things:

can someone convert this to LUA5?

and is this fast? Wont take any considerable bandwidth/resources?
Title: Lua 5 version
Post by: Markitos on 03 July, 2005, 18:36:30
Here u go:
--// Hawk Blocker By ....

--//  ??????Hawk??????   <---- well if your gonna block me  ill get my ascii in here  :p

--//  15/01/2005

--// Lua 5 version by Markitos


bot = "Hawk-Blocker"  -- Bots name

function Main()

OKchars ="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ1234567890-_(){}[]@"

end


function NewUserConnected(curUser)

local CharsLeft = curUser.sName

local CharToCheck = "a"

while CharToCheck do

_,_,CharToCheck,CharsLeft = string.find(CharsLeft,"(%S)(.*)")

if  CharsLeft == nil then break

else

if not string.find(OKchars,CharToCheck) then

curUser:SendData(bot,"\r\n\r\nYou have Illegal Chars in your nick Please Use Standard Charicters:-\r\n\r\nok Chars are:-\r\n\r\n"..OKchars.."\r\n\r\n")

curUser:Disconnect()

end

end

end

end


function OpConnected(curUser)

NewUserConnected(curUser)

end





About bandwith nd resources no worry...Ive tested the script nd its really fast and efficient

Cheers...

[18:33]

You have Illegal Chars in your nick Please Use Standard Charicters:-

ok Chars are:-

aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ1234567890-_(){}[]@
Title:
Post by: imby on 04 July, 2005, 01:30:53
No syntax errors in script file nickcheck.lua
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:83: unfinished capture
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:83: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:83: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:83: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:83: malformed pattern (missing `]')
Title:
Post by: ??????Hawk?????? on 04 July, 2005, 01:46:00
QuoteSyntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:83: unfinished capture


Hmmmm  there is no line 83  

even with Markitos double line spaced  there is only 64 lines ...  

i think you maby  copied and pasted a little too much from his post  ..  

try again m8
Title:
Post by: imby on 04 July, 2005, 13:28:21
QuoteOriginally posted by ??????Hawk??????
QuoteSyntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:83: unfinished capture


Hmmmm  there is no line 83  

even with Markitos double line spaced  there is only 64 lines ...  

i think you maby  copied and pasted a little too much from his post  ..  

try again m8

Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')


Hi, this is the third time i've tryed and got errors... I may not be the greatest at scripting ever, but I think I have the capacity to copy and paste correctly! Seriously you guys should try it, if there's nothing wrong with the code, then there's something wrong with the formatting that makes it impossible to copy and paste.
Title:
Post by: Madman on 04 July, 2005, 14:42:34
You should copy from
--// Hawk Blocker By ....
to
NewUserConnected(curUser)

end

but dont copy the
----------------------------------
line...
Title:
Post by: jiten on 04 July, 2005, 14:57:04
QuoteOriginally posted by imby
Seriously you guys should try it, if there's nothing wrong with the code, then there's something wrong with the formatting that makes it impossible to copy and paste.
Tested it here and it's working fine.

Cheers
Title:
Post by: imby on 04 July, 2005, 15:22:34
QuoteOriginally posted by madman
You should copy from
--// Hawk Blocker By ....
to
NewUserConnected(curUser)

end

but dont copy the
----------------------------------
line...

Exactly what I did X(
Title:
Post by: imby on 04 July, 2005, 15:23:48
QuoteOriginally posted by jiten
QuoteOriginally posted by imby
Seriously you guys should try it, if there's nothing wrong with the code, then there's something wrong with the formatting that makes it impossible to copy and paste.
Tested it here and it's working fine.

Cheers

Leave it loaded for an hour or so/try testing by signing in with an invalid character. Mine doesn't generate errors as soon as I load it, it generates them when it's been left in for a while.
Title:
Post by: imby on 04 July, 2005, 15:24:32
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: unfinished capture
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: unfinished capture
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: unfinished capture
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: unfinished capture
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: unfinished capture
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: unfinished capture
Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:65: malformed pattern (missing `]')

=/
Title:
Post by: Dessamator on 04 July, 2005, 16:51:21
hmm, nasty bug , but well, u need to show us line 65 of ur script, we cant help until u do so !
Title:
Post by: imby on 07 July, 2005, 03:51:29
Right, I've reformatted it into an uber condensed version:

bot = "Hawk-Blocker"  -- Bots name
function Main()
OKchars ="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ1234567890-_(){}[]@"
end
function NewUserConnected(curUser)
local CharsLeft = curUser.sName
local CharToCheck = "a"
while CharToCheck do
_,_,CharToCheck,CharsLeft = string.find(CharsLeft,"(%S)(.*)")
if  CharsLeft == nil then break
else
if not string.find(OKchars,CharToCheck) then
curUser:SendData(bot,"\r\n\r\nYou have Illegal Chars in your nick Please Use Standard Charicters:-\r\n\r\nok Chars are:-\r\n\r\n"..OKchars.."\r\n\r\n")
curUser:Disconnect()
end
end
end
end
function OpConnected(curUser)
NewUserConnected(curUser)
end

Which gives the error:

Syntax ... - Games\0.3.3.0.b17.03.nt.rls\scripts\nickcheck.lua:12: malformed pattern (missing `]')
Title:
Post by: NotRabidWombat on 07 July, 2005, 14:26:37
You're using magic characters in the search pattern.

malformed pattern (missing `]') - exactly what it says
unfinished capture - missing a ')'

You must either escape all the magic chars with a function like:
function util.escapeMagicChars( sString )
local sRet = string.gsub(sString, "([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1");
return sRet;
end
or set plain in string.find to true:
bot = "Lame-Blocker"  -- Bots name

validChars ="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ1234567890-_(){}[]@";

function NewUserConnected(curUser)
local pos = string.find(curUser.sName,validChars,1,true);
if( pos ) then
local msg = string.format("Illegal character '%s' in nick. Valid characters are:\r\n%s",
string.sub(curUser.sName, pos, 1),
validChars);
curUser:SendData(bot,msg);
curUser:Disconnect();
end
end

OpConnected = NewUserConnected;

You guys have used lua before, right? ;-)

-NotRabidWombat
Title:
Post by: imby on 07 July, 2005, 15:59:04
Well I thought it was blatantly obvious that the reason this error was not found was because it pointed to a line that did not exist.

Least these guys post without mocking other people's abilities and choice of scripts...

Further, some people don't like 'kewl', trendy looking characters, your opinion on this matter is not above all others, you arrogant swine.

Anyway thankyou for your help.  :P
Title: I'm a snooty piggy!!
Post by: NotRabidWombat on 07 July, 2005, 21:45:53
Well I thought it was blatantly obvious that the reason this error was not found was because it pointed to a line that did not exist.
I thought it was blatantly obvious that copying text from a post here results in doubled new lines.
Line 65 of Markitos' post (with the double new lines) is:
if not string.find(OKchars,CharToCheck) then
The same as line 12 of your "uber condensed" version ;-)

Besides, you can still infer the problem from the debug message.

Least these guys post without mocking other people's abilities and choice of scripts...
Kindly spoken misinformation is supposed to be better than blunt correctness?

Further, some people don't like 'kewl', trendy looking characters, your opinion on this matter is not above all others, you arrogant swine.
I wasn't aware I made a comment on 'kewl' ASCII. However, the script is lame that it will not do what the original author requested; block fakers.

Anyway thankyou for your help.
You are welcome.

Edit: s/white space/new lines/g

-NotRabidWombat
Title:
Post by: imby on 08 July, 2005, 02:09:40
1. Indeed, but I gather those who offered help at that particular stage only took a quick glance at the problem. One cannot expect anything more as obviously you can't expect people to give you hours of their personal time.

2. Good question actually, you might be right.

3. Okay, my apologies for making assumptions on what you were actually implying.