Skip to content

Instantly share code, notes, and snippets.

@cyberium
Last active November 4, 2015 20:54
Show Gist options
  • Save cyberium/3275f8a531129b6b1d14 to your computer and use it in GitHub Desktop.
Save cyberium/3275f8a531129b6b1d14 to your computer and use it in GitHub Desktop.
ignore /script from chat messages
diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp
index 3bda8d9..c8715c9 100644
--- a/src/game/ChatHandler.cpp
+++ b/src/game/ChatHandler.cpp
@@ -53,6 +53,22 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg
KickPlayer();
return false;
}
+
+ // check if the message start with /script wish is not permitted in any case
+ const std::string script = "/SCRIPT";
+ bool found = true;
+ for (uint32 i = 0; i < script.length(); ++i)
+ {
+ char c = toupper(msg[i]);
+ if (c != script[i])
+ {
+ found = false;
+ break;
+ }
+ }
+
+ if (found)
+ return false;
}
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment