@@ -34,43 +34,13 @@ bool COMMAND_Executed ( const char* szCommand, const char* szArguments, bool bHa
34
34
// Has the core already handled this command?
35
35
if ( !bHandled )
36
36
{
37
- // char szBuffer [256];
38
- CLuaArguments Arguments;
39
-
40
37
const char * szCommandBufferPointer = szCommand;
41
38
42
39
if ( !bHandleRemotely )
43
40
{
44
41
// Is the command "say" and the arguments start with '/' ? (command comes from the chatbox)
45
42
if ( stricmp ( szCommand, " chatboxsay" ) == 0 )
46
43
{
47
- /* This code seems redundant, the chatbox now properly simulates commands.
48
- // His line starts with '/'?
49
- if ( *szArguments == '/' )
50
- {
51
- // Copy the characters after the slash to the 0 terminator to a seperate buffer
52
- strncpy ( szBuffer, &szArguments [ 1 ], 256 );
53
- szBuffer [ 255 ] = 0;
54
-
55
- // Split it into command and arguments
56
- char* szNewCommand = strtok ( szBuffer, " " );
57
- char* szNewArguments = strtok ( NULL, "\0" );
58
- if ( szNewCommand )
59
- {
60
- // Execute it as another command
61
- if ( szNewArguments )
62
- {
63
- g_pCore->GetCommands ()->Execute ( szNewCommand, szNewArguments );
64
- }
65
- else
66
- {
67
- g_pCore->GetCommands ()->Execute ( szNewCommand, "" );
68
- }
69
-
70
- return true;
71
- }
72
- }
73
- */
74
44
szCommandBufferPointer = " say" ;
75
45
}
76
46
}
@@ -90,11 +60,21 @@ bool COMMAND_Executed ( const char* szCommand, const char* szArguments, bool bHa
90
60
g_pClientGame->GetRegisteredCommands ()->ProcessCommand ( szCommandBufferPointer, szArguments );
91
61
92
62
// Call the onClientConsole event
93
- Arguments.PushString ( strClumpedCommand );
63
+ auto pLocalPlayer = g_pClientGame->GetLocalPlayer ();
64
+
65
+ if ( pLocalPlayer ) {
66
+ CLuaArguments Arguments;
67
+
68
+ // Censor input for /login command
69
+ if ( !stricmp ( szCommandBufferPointer, " login" ) ) {
70
+ Arguments.PushString ( SString ( " %s ***" , szCommandBufferPointer ) );
71
+ }
72
+ else {
73
+ Arguments.PushString ( strClumpedCommand );
74
+ }
94
75
95
- // Call the event on the local player's onClientConsole first
96
- if ( g_pClientGame->GetLocalPlayer () )
97
- g_pClientGame->GetLocalPlayer ()->CallEvent ( " onClientConsole" , Arguments, true );
76
+ pLocalPlayer->CallEvent ( " onClientConsole" , Arguments, true );
77
+ }
98
78
99
79
// Write the chatlength and the content
100
80
NetBitStreamInterface* pBitStream = g_pNet->AllocateNetBitStream ();
0 commit comments