Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Client/mods/deathmatch/ClientCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
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])
Expand All @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/CClientGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullptr


// Chat events
m_Events.AddEvent("onClientChatMessage", "text, r, g, b, messageType", NULL, false);
Expand Down
Loading