Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 Server Modifications ONLY!
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 02.04.2007, 14:48   #1
smeli
Архивный участник
 
Join Date: Apr 2006
Posts: 181
Default [share] char_name check modification SQL

-- place this script to SQL function: "lin_CreateChar"
-- after this code of blank space checking:
IF @char_name LIKE N' '
BEGIN
RAISERROR ('Character name has space : name = [%s]', 16, 1, @char_name)
RETURN -1
END
-- and your server will get less weird names



-- check lenght

if Len(@char_name)< 3
BEGIN
RAISERROR ('Character name too short : name = [%s]', 16, 1, @char_name)
RETURN -1
END

-- check for invalid characters
DECLARE @r Int
SET @r = 0
SELECT @r = 1 WHERE @char_name LIKE '%[^a-z]%'
if @r = 1
BEGIN
RAISERROR ('Character have invalid characters : name = [%s]', 16, 1, @char_name)
RETURN -1
END

-- check for repeating x3 letters

/* 3. check for repeats x3 */
DECLARE
@Position Int,
@Counter Int,
@SearchString Varchar(255),
@SearchFor1 Varchar(255),
@SearchFor2 Varchar(255),
@SearchFor3 Varchar(255)

SET @SearchString = @char_name
Set @Position = 3
Set @Counter = 0
SET @SearchFor1 = 'W'
SET @SearchFor2 = SUBSTRING(@SearchString,1,1)
SET @SearchFor3 = SUBSTRING(@SearchString,2,1)

While @Position <= Len(@SearchString)
Begin
SET @SearchFor1=@SearchFor2
SET @SearchFor2=@SearchFor3
SET @SearchFor3=SUBSTRING(@SearchString,@Position,1)

if @SearchFor1 = @SearchFor2
if @SearchFor2 = @SearchFor3
BEGIN
RAISERROR ('Character have 3 repeating letters : name = [%s]', 16, 1, @char_name)
RETURN -1
END

Select @Position = (@Position + 1)
End
smeli is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 22:49.