PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: [G-T-E]Gate? on 28 June, 2004, 15:27:26

Title: RoboCopv8b or standalone script Nick check
Post by: [G-T-E]Gate? on 28 June, 2004, 15:27:26
I'll post my Question/Requset here as Iam not sure if it will apply to RCv8b or just a stand alone script..

I as others are getting users with nicks such as;
Rambo216154 ; [telia]snovit1999 ; kabb8658 ; olwia870415 ; podox2256 ; 85ma ; 12lisl21 and many more.
Its just the users with numbers after and before their nick that I want out of the hub.
Is there a way to disconnect/or/kick/or/timeban the user with a messege that numbers after their nick are not allowed.

Running RCv8b on 0.3.3.0 15.25
Tks G8
Title: Not solved thru Ptx -> Rules and Bots
Post by: [G-T-E]Gate? on 29 June, 2004, 09:40:32
HI Mutor ,
I know the setting u mean in Ptx under Rules and Bots/Check with Names Enable or Except Ops..
But the thing is that when applies users using [NumericalMbit]Nick  will be effected by settings.

Is there another way to come to a solution thats just captures users with
numerical NICK numerical   //or// NICK numerical
Title:
Post by: Corayzon on 29 June, 2004, 10:54:59
strfind(sString, "%d+") will get all numerical chars from a string
Title:
Post by: NightLitch on 29 June, 2004, 12:07:58
Here you have a simple solusion:

-----------------------------------------
-----------------------------------------
--// Simple Nick Checker, by: NightLitch
--// Request by: [G-T-E]Gate?
-----------------------------------------
-----------------------------------------
function NewUserConnected(sUser)
local s,e,num1,isp,nick,num2 = strfind(sUser.sName, "^(%d*)%s*([%[%S*%]]*)%s*(%S*)%s*(%d*)")
if num1 or num2 then
sUser:SendData("It is not allowed to have numbers in your nick...")
sUser:Disconnected()
end
end
-----------------------------------------
-----------------------------------------

Hope it does what you want...

/NL
Title:
Post by: [G-T-E]Gate? on 29 June, 2004, 13:17:54
Just back and gonna give it a test run .

Tks NightLight

G8
Title:
Post by: [G-T-E]Gate? on 29 June, 2004, 13:33:23
Sorry NightLitch but ;
Upon restarting scripts and checkeing Syntax there is no problem but when
I connect with a nick such as 12tesrun12336 I get first the following mess in main chat and stay connected to the hub;

It is not allowed to have numbers in your nick...
 
Enhanced Right Click Support for [RoboCop] is available!
// Type !help in main for your available commands!
Welcome To SFS 12tesrun12336 to .....

and then when checking Ptx Gui I see a syntax error as follows;

No syntax errors in script file NoNumericalNick.lua
Syntax error: attempt to call field `Disconnected' (a nil value)
stack traceback:
   1:  function `NewUserConnected' at line 11 [file `...30 build 15.25 RCv8\scripts\NoNumericalNick.lua']

Awaiting ur reply egearly
G8
Title:
Post by: NightLitch on 29 June, 2004, 14:01:23
this one is right

-----------------------------------------
-----------------------------------------
--// Simple Nick Checker, by: NightLitch
--// Request by: [G-T-E]Gate?
--// Small fix
-----------------------------------------
-----------------------------------------
function NewUserConnected(sUser)
local s,e,num1,isp,nick,num2 = strfind(sUser.sName, "^(%d*)%s*([%[%S*%]]*)%s*(%S*)%s*(%d*)")
if num1 or num2 then
sUser:SendData("It is not allowed to have numbers in your nick...")
sUser:Disconnect()
end
end
-----------------------------------------
-----------------------------------------

/NL
Title: this one is right // this one is not right
Post by: [G-T-E]Gate? on 29 June, 2004, 15:14:12
NightLitch my man

Seems as though ur script doesnt like RoboCop v8b.
It works to damn well disconnecting users with numericals in their nick, Disconnects even users with [10Mbit]Nick which isnt right.
It needs to catch the numericals after the nick and before but not within the brackets [ ].
Upon restarting scripts and syntax check all went ok but when connecting to hub it produced a syntax error as follows;


No syntax errors in script file NoNumericalNick.lua
Syntax error: bad argument #1 to `strsub' (string expected, got nil)
stack traceback:
   1:  function `strsub' [C]
   2:  function `NewUserConnected' at line 428 [file `Robocop\RoboCopv8.0b.lua']

Syntax error: bad argument #1 to `strsub' (string expected, got nil)
stack traceback:
   1:  function `strsub' [C]
   2:  function `NewUserConnected' at line 428 [file `Robocop\RoboCopv8.0b.lua']

Did I give ya something to bite into  :D

G8
Title:
Post by: NightLitch on 29 June, 2004, 15:16:40
so it does take the tag 2 hmm... load RoboC. first then mine... always the masterbot before the small ones that is what I do...

gonna test it some more then...
Title:
Post by: NightLitch on 29 June, 2004, 16:41:28
Finished with some help from Plop:

----------------------------------------
-----------------------------------------
--// Simple Nick Checker, by: NightLitch
--// Request by: [G-T-E]Gate?
--// Small fix
--// Got help form Plop for strfind.
-----------------------------------------
-----------------------------------------
function NewUserConnected(sUser)
local s,e,num1,tag2,num2,tag3,num3 = strfind(sUser.sName, "^(%d*)(%p*%P*%p*)(%d*)(%D*)(%d*)")
if num1~="" or num2~="" or num3~="" then
sUser:SendData("It is not allowed to have numbers in your nick...")
sUser:Disconnect()
end
end
-----------------------------------------
-----------------------------------------

/NL
Title:
Post by: [G-T-E]Gate? on 29 June, 2004, 17:21:30
Will run a quick check before I pop out to work,,,  Grrr !!

Tks u 2 :D
Title:
Post by: [G-T-E]Gate? on 29 June, 2004, 17:33:25
Quick check seems ok
get responce in main chat ;
*** Connection closed  or *** Connection reset by server.

The order of startingthe scripts is very imortant. Will explain when I get back.

G8
Title:
Post by: [G-T-E]Gate? on 30 June, 2004, 00:23:53
To the order of starting the script first.

Start Nick Checker then all other scripts or else u will get a syntax error when a user is connected and kicked.

Now to the remaining problem;

Messege received in main chat is
*** Connection closed or *** Connection reset by server.  
and not
It is not allowed to have numbers in your nick...

So that part still needs checking.

Appreciate it NightLitch and Plop if u can get around to it.

Closer then U know m8s

Tks G8

Heres the code again

----------------------------------------
-----------------------------------------
--// Simple Nick Checker, by: NightLitch
--// Request by: [G-T-E]Gate?
--// Small fix
--// Got help form Plop for strfind.
-----------------------------------------
-----------------------------------------
function NewUserConnected(sUser)
local s,e,num1,tag2,num2,tag3,num3 = strfind(sUser.sName, "^(%d*)(%p*%P*%p*)(%d*)(%D*)(%d*)")
if num1~="" or num2~="" or num3~="" then
sUser:SendData("It is not allowed to have numbers in your nick...")
sUser:Disconnect()
end
end
-----------------------------------------
-----------------------------------------
Title:
Post by: nErBoS on 30 June, 2004, 00:38:59
Hi,

Little mod on the script more simple,

----------------------------------------
-----------------------------------------
--// Simple Nick Checker, by: NightLitch
--// Request by: [G-T-E]Gate?
--// Small fix
--// Got help form Plop for strfind.
--// Littl Mod by nErBoS
-----------------------------------------
-----------------------------------------
function NewUserConnected(sUser)
if (strfind(sUser.sName, "%d+") ~= nil) then
sUser:SendData("It is not allowed to have numbers in your nick...")
sUser:Disconnect()
end
end
-----------------------------------------

Best regard, nErBoS
Title:
Post by: [G-T-E]Gate? on 30 June, 2004, 00:55:02
Sorry nErBoS but
1- Allows user in with numericals Nick numericals
2- Gives syntax error in RC v8b , no matter in which order the 2 scripts are started.

G8
Title:
Post by: nErBoS on 30 June, 2004, 01:00:14
Hi,

Try this then...

----------------------------------------
-----------------------------------------
--// Simple Nick Checker, by: NightLitch
--// Request by: [G-T-E]Gate?
--// Small fix
--// Got help form Plop for strfind.
--// Little Modification by nErBoS
-----------------------------------------
-----------------------------------------
function NewUserConnected(sUser)
if (strfind(sUser.sName, "%d+") ~= nil) then
sUser:SendData("It is not allowed to have numbers in your nick...")
sUser:Disconnect()
return 1
end
end
-----------------------------------------

Best regards, nErBoS
Title:
Post by: [G-T-E]Gate? on 30 June, 2004, 01:24:27
Here ya go nErBoS

Result after test running ONLY RCv8b and Nick Check

***Kicks users with Tags [10Mbit]Nick and users with Numerical Nick Numerical
Suppose to catch only  Numerical Nick Numerical

A- Order of scripts start

1- Nick Check
2- RCv8b
Main chat messege = ***Connection Closed
No Syntax Error

----------------------------------------------------------------------

A- Order of scripts start

1- RC v8b
2- Nick Check
Main Chat Messege= It is not allowed to have numbers in your nick..
***Disconnected

Produces Syntax error: bad argument #1 to `strsub' (string expected, got nil)
stack traceback:
1: function `strsub' [C]
2: function `NewUserConnected' at line 428 [file `Robocop\RoboCopv8.0b.lua']

G8 ;)
Title:
Post by: nErBoS on 30 June, 2004, 01:29:09
Hi,

Well about that error is because of data not catch by robocop, i wouldn't mind that error, to be apeared will not affect the work of both scripts i think.

Best regards, nErBoS
Title:
Post by: [G-T-E]Gate? on 30 June, 2004, 01:57:20
Ive tested different placements of the scripts and get either
***Connection Closed
No Syntax Error
or
It is not allowed to have numbers in your nick..
***Disconnected
With Syn Error.

I'll run it for a day or so to see what effect it has with syn error..

Tks and open to more tests
I'ld love to see a clean Syntax Board

G8
Title:
Post by: NightLitch on 30 June, 2004, 10:56:20
Rewrote it from NewUserConnected to DataArrival ($ValidateNick)

This should be no problem running along side RoboCop, works withour problem for me with THOR and I have had the same problems, just hadn't enabled the checks in NewUser....

Here is the code:

----------------------------------------
-----------------------------------------
--// Simple Nick Checker, by: NightLitch
--// Request by: [G-T-E]Gate?
--// Small fix
--// Got help form Plop for strfind.
--// Rewrote it from UserConnected to DataArrival
-----------------------------------------
-----------------------------------------
function DataArrival(sUser, sData)
if strsub(sData, 1, 13) == "$ValidateNick" then
local s,e,Nick = strfind(sData, "k (.*)%|$")
if Nick then
local s,e,num1,tag2,num2,tag3,num3 = strfind(Nick, "^(%d*)(%p*%P*%p*)(%d*)(%D*)(%d*)")
if num1~="" or num2~="" or num3~="" then
sUser:SendData("It is not allowed to have numbers in your nick...")
sUser:Disconnect()
end
end
end
end
-----------------------------------------
-----------------------------------------

Cheers / NL
Title:
Post by: [G-T-E]Gate? on 30 June, 2004, 15:45:39
Jo NL

Just back from work and started my vacation YaHoo!!!

Now I say ur messege and was wiled to try ur fix.
Results Below:

Disconnects user and sends Messege to Main Chat with No syntax error ;

[10Mbit]Nick123
[10Mbit]Nick    <<==== Should not apply to this sort of Nick
1213Nick1213
123Nick
----------------------------------------------------------------------------

No Discconnection of User, Enters hub, No syn Error ;

Nick1213    <<==== Should apply to this sort of Nick

Iam sure u can see where the problem is left.
I have only tested it as Nick Check being loaded last.

Cheers / G8
Title:
Post by: [G-T-E]Gate? on 01 July, 2004, 00:02:56
Mutor will do.

I thought this would be interesting

G8
Title:
Post by: NightLitch on 01 July, 2004, 00:06:12
Doesn't above script do what it should ???

Kepp all users with numbers in nickname out ??

like:

2112[TAG]323nickname4343
or
[TAG]323nickname4343
or
[TAG]nickname4343
or
[TAG]323nickname
or
3232[TAG]323nickname

etc...

??????

seam to works for me ??

/NL
Title:
Post by: [G-T-E]Gate? on 01 July, 2004, 01:44:54
NL it disconnects [TAG]Nick like [10Mbit]Nick when I test it, it shouldnt.

G8
Title:
Post by: [G-T-E]Gate? on 01 July, 2004, 01:46:53
Oh and Nick1213 enters the hub , it should not..

G8
Title:
Post by: NightLitch on 01 July, 2004, 11:14:32
ok gonna check it some more then
Title:
Post by: nErBoS on 01 July, 2004, 11:27:28
Hi,

Little suggestion then...

----------------------------------------
-----------------------------------------
--// Simple Nick Checker, by: NightLitch
--// Request by: [G-T-E]Gate?
--// Small fix
--// Got help form Plop for strfind.
--// Rewrote it from UserConnected to DataArrival
--// Little Modification by nErBoS
-----------------------------------------
-----------------------------------------
function DataArrival(sUser, sData)
if strsub(sData, 1, 13) == "$ValidateNick" then
local s,e,Nick = strfind(sData, "k (.*)%|$")
if Nick then
local s,e,num1,num2 = strfind(Nick, "(%d+)%S+(%d+)")
if (num1 ~= nil or num2 ~= nil) then
sUser:SendData("It is not allowed to have numbers in your nick...")
sUser:Disconnect()
end
end
end
end
-----------------------------------------
-----------------------------------------

Best regards, nErBoS
Title:
Post by: NightLitch on 01 July, 2004, 11:49:34
This should be the final code...

takes on nicks with and without [TAG].

Not Allowed Nicks:

123Nick
123Nick456
Nick123
123[TAG]Nick
123[TAG]456Nick
123[TAG]456Nick789
[TAG]123Nick456
[TAG]123Nick
[TAG]Nick123

----------------------------------------
-----------------------------------------
--// Simple Nick Checker, by: NightLitch
--// Request by: [G-T-E]Gate?
--// Small fix
--// Got help form Plop for strfind.
--// Rewrote it from UserConnected to DataArrival
--// Bug fixed so not Nick234 or 535Nick432 can slip through
-----------------------------------------
-----------------------------------------
function DataArrival(sUser, sData)
if strsub(sData, 1, 13) == "$ValidateNick" then
local s,e,Nick = strfind(sData, "k (.*)%|$")
if Nick then
local s,e,num1,tag1,num2,tag2,num3 = strfind(Nick, "^(%d*)(%p*%P*%p*)(%d*)(%D*)(%d*)")
if tag1~="" and tag2=="" then
s,e,num1,tag1,num2 = strfind(Nick, "^(%d*)(%D*)(%d*)")
end
if num1~="" or num2~="" or num3~="" then
sUser:SendData("It is not allowed to have numbers in your nick...")
sUser:Disconnect()
end
end
end
end
-----------------------------------------
-----------------------------------------

Enjoy / NL