PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: NightLitch on 01 July, 2004, 11:55:50

Title: No Numbers in Nickname Check
Post by: NightLitch on 01 July, 2004, 11:55:50
----------------------------------------
-----------------------------------------
--// 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
Title: The Wizard does it again :D
Post by: [G-T-E]Gate? on 01 July, 2004, 14:38:10
NIGHTLITCH Ur A WIZARD !!
Ur final Result is JUST AMAZING !!!
A toast to u my friend is worth loads Thanks from G8 (http://www.hiderbooks.com/HB_-johnwalker.JPG)

Iam sure that loads of our members at Lua will enjoy this script u made for me... Tks again ...

----------------------------------------
-----------------------------------------
--// 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
-----------------------------------------
-----------------------------------------
Title:
Post by: pHaTTy on 01 July, 2004, 14:44:50
QuoteOriginally posted by NightLitch
----------------------------------------
-----------------------------------------
--// 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

u should also add filter setting for []nick

as utb and some others sometimes use [420]Nick
Title:
Post by: [G-T-E]Gate? on 01 July, 2004, 14:47:33
I already check it pH?tt? and they get in as well
G8
Title:
Post by: NightLitch on 03 July, 2004, 12:39:29
QuoteOriginally posted by [G-T-E]Gate?
NIGHTLITCH Ur A WIZARD !!
Ur final Result is JUST AMAZING !!!
A toast to u my friend is worth loads Thanks from G8 (http://www.hiderbooks.com/HB_-johnwalker.JPG)

Iam sure that loads of our members at Lua will enjoy this script u made for me... Tks again ...


Am just doing my job ;-P hehe

poff / NL
Title:
Post by: NightLitch on 03 July, 2004, 12:40:20
QuoteOriginally posted by (uk-kingdom)pH?tt?
u should also add filter setting for []nick

as utb and some others sometimes use [420]Nick

Check it real good Phatty m8 the you see it is a ok code... ;-D

cheers / NL
Title:
Post by: [G-T-E]Gate? on 03 July, 2004, 12:53:21
NL
 I wanna thank u once again, I never had such a CLEAN Users List before and I mean Really Clean !!!!!!!!!!!
Thanks M8

Regards and Happy Summer
G8
Title: New additive Request for Nick Checker by NightLitch
Post by: [G-T-E]Gate? on 03 July, 2004, 17:42:36
A new request
 NightLitch
Emperor

Its still concerning Nick Checker,
Can u adjust the scipt so that it does not check the profiles  Master, Operator,Vip, Reg, Moderator and Netfounder
That would be the Gr8
G8
Title:
Post by: NightLitch on 03 July, 2004, 18:42:09
Gonna see what I can do when I get the time...

Cheers / NL
Title:
Post by: [G-T-E]Gate? on 03 July, 2004, 19:45:24
ok NL looking forward to another testrun
G8   ;)
Title:
Post by: NightLitch on 03 July, 2004, 22:43:20
New one out:

----------------------------------------
-----------------------------------------
--// 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
--// Added ProfileChecking
--// Registered UsersName is Case Sensitive...
-----------------------------------------
-----------------------------------------

--// Level Check ( Just fix it so your Profiles.dat is right for this table... )
ProfileCheck = {
[-1] = 1, -- User
[3] = 2, -- Reg
[2] = 3, -- Vip
[1] = 4, -- Operator
[0] = 5, --Master
}

--// User over This level is not Checked...
CheckLevel = 3

-----------------------------------------
-----------------------------------------
RegT = {}
RegF = "../RegisteredUsers.dat"

function Main()
LoadRegistredFile()
end

function DataArrival(sUser, sData)
if strsub(sData, 1, 13) == "$ValidateNick" then
local s,e,Nick = strfind(sData, "k (.*)%|$")
if Nick then
if tonumber(ProfileCheck[LevelCheck(Nick)]) <= tonumber(CheckLevel) 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
end

function LevelCheck(nick)
if RegT[nick] then
return RegT[nick][2]
else
return -1
end
end

function LoadRegistredFile()
local handle = openfile(RegF, "r")
if (handle) then
    local line = read(handle)
    while line do
s,e,nick,password,status = strfind(line, "(.+)|(.+)|(%d+)")
RegT[strlower(nick)] = {password, status}
line = read(handle)
    end
  closefile(handle)
end
end

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

Hope it works as it should / NL
Title:
Post by: [G-T-E]Gate? on 03 July, 2004, 23:29:34
will testrun i a bit , so many new users that need assistance .
Thanks M8
G8
Title:
Post by: NightLitch on 04 July, 2004, 01:27:58
All ready notice a bug that I will fix...
Title:
Post by: NightLitch on 04 July, 2004, 01:40:59
Updated:

----------------------------------------
-----------------------------------------
--// 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
--// Added ProfileChecking
--// Registered UsersName is Case Sensitive...
-----------------------------------------
-----------------------------------------

--// Level Check ( Just fix it so your Profiles.dat is right for this table... )
ProfileCheck = {
[-1] = 1, -- User
[3] = 2, -- Reg
[2] = 3, -- Vip
[1] = 4, -- Operator
[0] = 5, --Master
}

--// User over This level is not Checked...
CheckLevel = 3

-----------------------------------------
-----------------------------------------
RegT = {}
RegF = "../RegisteredUsers.dat"

function Main()
LoadRegistredFile()
end

function DataArrival(sUser, sData)
if strsub(sData, 1, 13) == "$ValidateNick" then
local s,e,Nick = strfind(sData, "k (.*)%|$")
if Nick then
Profile = LevelCheck(Nick)
if ProfileCheck[tonumber(Profile)] <= tonumber(CheckLevel) 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
end

function LevelCheck(nick)
if RegT[nick] then
return RegT[nick][2]
else
return -1
end
end

function LoadRegistredFile()
local handle = openfile(RegF, "r")
if (handle) then
    local line = read(handle)
    while line do
s,e,nick,password,status = strfind(line, "(.+)|(.+)|(%d+)")
RegT[nick] = {password, status}
line = read(handle)
    end
  closefile(handle)
end
end

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

Enjoy / NL
Title:
Post by: [G-T-E]Gate? on 08 July, 2004, 12:12:56
After running it for a few days the Response was PERFECT !!!

Tks again
 G8

"Its grand with summer house cleaning"
Title:
Post by: NightLitch on 08 July, 2004, 12:15:15
QuoteOriginally posted by [G-T-E]Gate?
After running it for a few days the Response was PERFECT !!!

Tks again
 G8

"Its grand with summer house cleaning"

yw / NL =)
Title: Numerical with , or . Stopped
Post by: [G-T-E]Gate? on 08 July, 2004, 21:25:48
Oppps!!!

 [0,5Mbit]Nick , [0.5Mbit]Nick , [1.5Mbit]Nick and [1,5Mbit]Nick is disconnected >>not good :(

But whole numericals [10Mbit]Nick gets in.

What ya think NL ???

G8
Title:
Post by: NightLitch on 08 July, 2004, 21:33:03
gonna see what I can do / NL
Title:
Post by: plop on 09 July, 2004, 00:46:48
here is the strfind for it.
i leave it 2 nightlitch 2 stuff it into the script.
tTable = {
["[0,5Mbit]Nick"]=1,
["[0.5Mbit]Nick"]=1 ,
["[1.5Mbit]Nick"]=1 ,
["[1,5Mbit]Nick"]=1,
["[10Mbit]Nick"]=1
}

print("")

function checkprefix(Nick)
   local s,e,num1,tag1,num2,tag2,num3 = strfind(Nick, "^(%d*)(%p*[%.%,%P]*%p*)(%d*)(%D*)(%d*)")
   print(Nick)
   print(tag1)
   print("")
end

for a,b in tTable do
   checkprefix(a)
end
the result=[1.5Mbit]Nick
[1.5Mbit]

[0,5Mbit]Nick
[0,5Mbit]

[10Mbit]Nick
[10Mbit]

[1,5Mbit]Nick
[1,5Mbit]

[0.5Mbit]Nick
[0.5Mbit]
plop
Title:
Post by: NightLitch on 09 July, 2004, 20:26:00
Updated:

----------------------------------------
-----------------------------------------
--// 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
--// Added ProfileChecking
--// Registered UsersName is Case Sensitive...
--// Updated strfind, thx 2 Plop
-----------------------------------------
-----------------------------------------

--// Level Check ( Just fix it so your Profiles.dat is right for this table... )
ProfileCheck = {
[-1] = 1, -- User
[3] = 2, -- Reg
[2] = 3, -- Vip
[1] = 4, -- Operator
[0] = 5, --Master
}

--// User over This level is not Checked...
CheckLevel = 3

-----------------------------------------
-----------------------------------------
RegT = {}
RegF = "../RegisteredUsers.dat"

function Main()
LoadRegistredFile()
end

function DataArrival(sUser, sData)
if strsub(sData, 1, 13) == "$ValidateNick" then
local s,e,Nick = strfind(sData, "k (.*)%|$")
if Nick then
Profile = LevelCheck(Nick)
if ProfileCheck[tonumber(Profile)] <= tonumber(CheckLevel) 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
end

function LevelCheck(nick)
if RegT[nick] then
return RegT[nick][2]
else
return -1
end
end

function LoadRegistredFile()
local handle = openfile(RegF, "r")
if (handle) then
    local line = read(handle)
    while line do
s,e,nick,password,status = strfind(line, "(.+)|(.+)|(%d+)")
RegT[nick] = {password, status}
line = read(handle)
    end
  closefile(handle)
end
end
-----------------------------------------
-----------------------------------------

Enjoy / NL
Title:
Post by: [G-T-E]Gate? on 09 July, 2004, 21:11:55
On to testing ..................
Thanks NL & Plop

Gate
Title:
Post by: belea on 22 September, 2004, 21:29:10
Hi there,

Can someone modify that script to let only the ppl with nomebrs in the last part of the nickname.. and ppl that have nombers at the begining of the nickname to be kicked ?

like: '1980Nick' to be out and 'Nick1980' to be let alone ?

Thx