Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела

Notices

 
 
Thread Tools Search this Thread Display Modes
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  
Old 02.04.2007, 14:58   #2
FidoW
Архивный участник
 
Join Date: Sep 2005
Posts: 1,014
Default

Umm , intereseting, looks better than my own :P i have a similar store procedure in my server, in my server isnt possible to create names like ... "XXMageXX" etc etc.. about the invalid characteres.. thats a solution to hlapex charname with moded packets, i forget to do that

Thats a good one... thanks smeli.
FidoW is offline  
Old 02.04.2007, 15:18   #3
HF
Архивный участник
 
Join Date: Aug 2005
Posts: 1,531
Default

What checking this store procedure? I dont understund
HF is offline  
Old 02.04.2007, 17:18   #4
FidoW
Архивный участник
 
Join Date: Sep 2005
Posts: 1,014
Default

Quote:
Originally Posted by HF View Post
What checking this store procedure? I dont understund
With that SP you cant create chars with less than 3 letters.... and you cant use numbers in the name (thats the only part of the SP i dont like)... and cant create chars with names like... "XXXMageXXX" or... "MysticXXX" or any three identical letters together (lllKinglll, etc).. but the invalid characters code... fix the charname injection packet with hlapex too... i dont know if amped fix that, i think doesnt. In the past with Hlapex you can create chars with name not visible with the client, resulting in .. you cant whisp that player... and i not sure but possible crash others clients when trying to target it.

To modify the invalid characters check to allow numbers only make something like this

Search:
SELECT @r = 1 WHERE @char_name LIKE '%[^a-z]%'

Replace with:
SELECT @r = 1 WHERE @char_name LIKE '%[^a-z0-9]%'
FidoW is offline  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 18:59.