Skip to content
Merged
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
48 changes: 14 additions & 34 deletions Client/mods/deathmatch/ClientCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,43 +34,13 @@ bool COMMAND_Executed ( const char* szCommand, const char* szArguments, bool bHa
// Has the core already handled this command?
if ( !bHandled )
{
//char szBuffer [256];
CLuaArguments Arguments;

const char* szCommandBufferPointer = szCommand;

if ( !bHandleRemotely )
{
// Is the command "say" and the arguments start with '/' ? (command comes from the chatbox)
if ( stricmp ( szCommand, "chatboxsay" ) == 0 )
{
/* This code seems redundant, the chatbox now properly simulates commands.
// His line starts with '/'?
if ( *szArguments == '/' )
{
// Copy the characters after the slash to the 0 terminator to a seperate buffer
strncpy ( szBuffer, &szArguments [ 1 ], 256 );
szBuffer [ 255 ] = 0;

// Split it into command and arguments
char* szNewCommand = strtok ( szBuffer, " " );
char* szNewArguments = strtok ( NULL, "\0" );
if ( szNewCommand )
{
// Execute it as another command
if ( szNewArguments )
{
g_pCore->GetCommands ()->Execute ( szNewCommand, szNewArguments );
}
else
{
g_pCore->GetCommands ()->Execute ( szNewCommand, "" );
}

return true;
}
}
*/
szCommandBufferPointer = "say";
}
}
Expand All @@ -90,11 +60,21 @@ bool COMMAND_Executed ( const char* szCommand, const char* szArguments, bool bHa
g_pClientGame->GetRegisteredCommands ()->ProcessCommand ( szCommandBufferPointer, szArguments );

// Call the onClientConsole event
Arguments.PushString ( strClumpedCommand );
auto pLocalPlayer = g_pClientGame->GetLocalPlayer();

if ( pLocalPlayer ) {
CLuaArguments Arguments;

// Censor input for /login command
if ( !stricmp( szCommandBufferPointer, "login" ) ) {
Arguments.PushString( SString( "%s ***", szCommandBufferPointer ) );
}
else {
Arguments.PushString( strClumpedCommand );
}

// Call the event on the local player's onClientConsole first
if ( g_pClientGame->GetLocalPlayer () )
g_pClientGame->GetLocalPlayer ()->CallEvent ( "onClientConsole", Arguments, true );
pLocalPlayer->CallEvent( "onClientConsole", Arguments, true );
}

// Write the chatlength and the content
NetBitStreamInterface* pBitStream = g_pNet->AllocateNetBitStream ();
Expand Down