From a2fcb21b4fd24b8a770e2f4034e14831cc82f666 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sat, 22 Jul 2023 11:35:05 +0200 Subject: [PATCH] Improve character npc name check --- system/libs/validator.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/system/libs/validator.php b/system/libs/validator.php index 271f1d67..5d8d5009 100644 --- a/system/libs/validator.php +++ b/system/libs/validator.php @@ -333,9 +333,13 @@ class Validator if ($npcCheck) { require_once LIBS . 'npc.php'; NPCS::load(); - if(NPCS::$npcs && in_array($name_lower, NPCS::$npcs)) { - self::$lastError = "Invalid name format. Do not use NPC Names"; - return false; + if(NPCS::$npcs) { + foreach (NPCs::$npcs as $npc) { + if(strpos($name_lower, $npc) !== false) { + self::$lastError = 'Your name cannot contains NPC name.'; + return false; + } + } } }