@@ -1287,11 +1287,14 @@ static void ConsoleCommandCallback(const CCommandContext &context, const CComman
12871287 for (int i = 1 ; i < args.ArgC (); i++)
12881288 cmdArgs.push_back (args[i]);
12891289
1290- // Dispatch with slot = -1 (server console), silent = false
1291- g_CS2ACommandSystem.DispatchConsoleCommand (cmdName, cmdArgs);
1290+ // Use the player slot from the command context (-1 for server console)
1291+ int slot = context.GetPlayerSlot ().Get ();
1292+
1293+ // Dispatch with the caller's slot, silent = false
1294+ g_CS2ACommandSystem.DispatchConsoleCommand (cmdName, cmdArgs, slot);
12921295}
12931296
1294- void CS2ACommandSystem::DispatchConsoleCommand (const char *cmdName, const std::vector<std::string> &args)
1297+ void CS2ACommandSystem::DispatchConsoleCommand (const char *cmdName, const std::vector<std::string> &args, int slot )
12951298{
12961299 std::string lower (cmdName);
12971300 std::transform (lower.begin (), lower.end (), lower.begin (),
@@ -1304,7 +1307,7 @@ void CS2ACommandSystem::DispatchConsoleCommand(const char *cmdName, const std::v
13041307 return ;
13051308 }
13061309
1307- it->second (- 1 , args, false );
1310+ it->second (slot , args, false );
13081311}
13091312
13101313void CS2ACommandSystem::RegisterConsoleCommands ()
@@ -1321,6 +1324,6 @@ void CS2ACommandSystem::RegisterConsoleCommands()
13211324 for (auto &entry : m_consoleCommands)
13221325 {
13231326 entry.cmd = new ConCommand (entry.name .c_str (), ConsoleCommandCallback,
1324- entry.desc .c_str (), FCVAR_NONE );
1327+ entry.desc .c_str (), FCVAR_CLIENT_CAN_EXECUTE );
13251328 }
13261329}
0 commit comments