![]() |
[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 :D -- 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 |
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 :D
Thats a good one... thanks smeli. |
What checking this store procedure? I dont understund
|
Quote:
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]%' |
| All times are GMT. The time now is 15:27. |