Hello shaiya community,
Today I am sharing a simple yet effective SQL query/trigger setup to block specific keywords, admin impersonation tags (e.g., [GM], [ADM]), or offensive words during character creation.
This prevents players from creating characters with forbidden names directly at the database level.
Features:
- Case-insensitive keyword matching.
- Easy to add/remove forbidden words.
- Instant error response on character creation.
Code:
USE [PS_GameDefs]
GO
/****** Object: Table [dbo].[BannedNames] Script Date: 06/20/2021 00:06:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[BannedNames](
[RowID] [int] IDENTITY(1,1) NOT NULL,
[BannedName] [varchar](max) NOT NULL,
CONSTRAINT [PK_BannedNames] PRIMARY KEY CLUSTERED
(
[RowID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
PS_GameData>usp_Create_Char_R
add to section
Code:
IF(@CharName IN (Select BannedName From PS_GameDefs.dbo.BannedNames))
BEGIN
RETURN -1
END