From c916b56db325b890e95400d0a0c502f931f486ba Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 29 Aug 2025 17:08:48 +0300 Subject: [PATCH 1/2] Add new arg to onClientCoreCommand --- Client/mods/deathmatch/ClientCommands.cpp | 11 +++++++++++ Client/mods/deathmatch/logic/CClientGame.cpp | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Client/mods/deathmatch/ClientCommands.cpp b/Client/mods/deathmatch/ClientCommands.cpp index 84529b4c9d5..6913b486f51 100644 --- a/Client/mods/deathmatch/ClientCommands.cpp +++ b/Client/mods/deathmatch/ClientCommands.cpp @@ -101,7 +101,18 @@ bool COMMAND_Executed(const char* szCommand, const char* szArguments, bool bHand { // Call the onClientCoreCommand event CLuaArguments Arguments; + CLuaArguments LuaTable; + std::istringstream iss(szArguments); + std::string arguments; + int i = 0; + + while (iss >> arguments) + { + LuaTable.PushNumber(++i); + LuaTable.PushString(arguments.c_str()); + } Arguments.PushString(szCommand); + Arguments.PushTable(&LuaTable); localPlayer->CallEvent("onClientCoreCommand", Arguments, true); } diff --git a/Client/mods/deathmatch/logic/CClientGame.cpp b/Client/mods/deathmatch/logic/CClientGame.cpp index b5a48a1e754..3b586896b27 100644 --- a/Client/mods/deathmatch/logic/CClientGame.cpp +++ b/Client/mods/deathmatch/logic/CClientGame.cpp @@ -2717,7 +2717,7 @@ void CClientGame::AddBuiltInEvents() // Console events m_Events.AddEvent("onClientConsole", "text", NULL, false); - m_Events.AddEvent("onClientCoreCommand", "command", NULL, false); + m_Events.AddEvent("onClientCoreCommand", "command, arguments", NULL, false); // Chat events m_Events.AddEvent("onClientChatMessage", "text, r, g, b, messageType", NULL, false); From d50d82edaebca1cc69d90941a2660970b23ac2b6 Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 29 Aug 2025 17:39:11 +0300 Subject: [PATCH 2/2] Hide sensitive arguments (/connect) --- Client/mods/deathmatch/ClientCommands.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Client/mods/deathmatch/ClientCommands.cpp b/Client/mods/deathmatch/ClientCommands.cpp index 6913b486f51..1940d7cb572 100644 --- a/Client/mods/deathmatch/ClientCommands.cpp +++ b/Client/mods/deathmatch/ClientCommands.cpp @@ -108,8 +108,17 @@ bool COMMAND_Executed(const char* szCommand, const char* szArguments, bool bHand while (iss >> arguments) { - LuaTable.PushNumber(++i); - LuaTable.PushString(arguments.c_str()); + ++i; + if (stricmp(szCommand, "connect") == 0 && i == 4) + { + LuaTable.PushNumber(i); + LuaTable.PushString("***"); + } + else + { + LuaTable.PushNumber(i); + LuaTable.PushString(arguments.c_str()); + } } Arguments.PushString(szCommand); Arguments.PushTable(&LuaTable);