From 5aaa57a99bfd0ad6c5559a67dc63ec7609a62e24 Mon Sep 17 00:00:00 2001 From: ColombuxMaximus Date: Wed, 16 Jul 2025 20:12:16 +0200 Subject: [PATCH 1/3] Update ClientCommands.cpp --- Client/mods/deathmatch/ClientCommands.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Client/mods/deathmatch/ClientCommands.cpp b/Client/mods/deathmatch/ClientCommands.cpp index e71b5a3a26e..af0ed7d819d 100644 --- a/Client/mods/deathmatch/ClientCommands.cpp +++ b/Client/mods/deathmatch/ClientCommands.cpp @@ -45,6 +45,18 @@ bool COMMAND_Executed(const char* szCommand, const char* szArguments, bool bHand } } + // Give scripts a chance to cancel this command before processing + CClientPlayer* localPlayer = g_pClientGame->GetLocalPlayer(); + if (localPlayer != nullptr) + { + CLuaArguments cancelArguments; + cancelArguments.PushString(szCommandBufferPointer); + if (!localPlayer->CallEvent("onClientCommand", cancelArguments, true)) + { + return true; + } + } + // Toss them together so we can send it to the server SString strClumpedCommand; if (szArguments && szArguments[0]) @@ -60,7 +72,6 @@ bool COMMAND_Executed(const char* szCommand, const char* szArguments, bool bHand g_pClientGame->GetRegisteredCommands()->ProcessCommand(szCommandBufferPointer, szArguments); // Call the onClientConsole event - CClientPlayer* localPlayer = g_pClientGame->GetLocalPlayer(); if (localPlayer != nullptr) { From dd3014b60b0e3c263b36e0293d9a2cb5225684ee Mon Sep 17 00:00:00 2001 From: ColombuxMaximus Date: Wed, 16 Jul 2025 20:12:47 +0200 Subject: [PATCH 2/3] Update CClientGame.cpp --- Client/mods/deathmatch/logic/CClientGame.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Client/mods/deathmatch/logic/CClientGame.cpp b/Client/mods/deathmatch/logic/CClientGame.cpp index 9145708156c..fccf163ac1b 100644 --- a/Client/mods/deathmatch/logic/CClientGame.cpp +++ b/Client/mods/deathmatch/logic/CClientGame.cpp @@ -2722,6 +2722,7 @@ void CClientGame::AddBuiltInEvents() // Console events m_Events.AddEvent("onClientConsole", "text", NULL, false); m_Events.AddEvent("onClientCoreCommand", "command", NULL, false); + m_Events.AddEvent("onClientCommand", "command", NULL, false); // Chat events m_Events.AddEvent("onClientChatMessage", "text, r, g, b, messageType", NULL, false); From 8f0decf6bb91467b67e3ef489b6d10690a6d7729 Mon Sep 17 00:00:00 2001 From: ColombuxMaximus Date: Tue, 22 Jul 2025 00:01:31 +0200 Subject: [PATCH 3/3] Update ClientCommands.cpp --- Client/mods/deathmatch/ClientCommands.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/mods/deathmatch/ClientCommands.cpp b/Client/mods/deathmatch/ClientCommands.cpp index af0ed7d819d..ec58538c478 100644 --- a/Client/mods/deathmatch/ClientCommands.cpp +++ b/Client/mods/deathmatch/ClientCommands.cpp @@ -47,7 +47,7 @@ bool COMMAND_Executed(const char* szCommand, const char* szArguments, bool bHand // Give scripts a chance to cancel this command before processing CClientPlayer* localPlayer = g_pClientGame->GetLocalPlayer(); - if (localPlayer != nullptr) + if (localPlayer) { CLuaArguments cancelArguments; cancelArguments.PushString(szCommandBufferPointer);