@@ -41,6 +41,7 @@ SH_DECL_HOOK6_void(IServerGameClients, OnClientConnected, SH_NOATTRIB, 0, CPlaye
4141SH_DECL_HOOK6 (IServerGameClients, ClientConnect, SH_NOATTRIB, 0 , bool , CPlayerSlot, const char *, uint64, const char *, bool , CBufferString*);
4242SH_DECL_HOOK3_void (ICvar, DispatchConCommand, SH_NOATTRIB, 0 , ConCommandHandle, const CCommandContext&, const CCommand&);
4343SH_DECL_HOOK0_void (IServerGameDLL, GameServerSteamAPIActivated, SH_NOATTRIB, 0 );
44+ SH_DECL_HOOK2_void (IServerGameClients, ClientCommand, SH_NOATTRIB, 0 , CPlayerSlot, const CCommand&);
4445
4546#ifdef _WIN32
4647FILE _ioccc[] = { *stdin, *stdout, *stderr };
@@ -138,6 +139,7 @@ bool Swiftly::Load(PluginId id, ISmmAPI* ismm, char* error, size_t maxlen, bool
138139 SH_ADD_HOOK_MEMFUNC (IServerGameClients, ClientDisconnect, gameclients, this , &Swiftly::Hook_ClientDisconnect, true );
139140 SH_ADD_HOOK_MEMFUNC (IServerGameClients, OnClientConnected, gameclients, this , &Swiftly::Hook_OnClientConnected, false );
140141 SH_ADD_HOOK_MEMFUNC (IServerGameClients, ClientConnect, gameclients, this , &Swiftly::Hook_ClientConnect, false );
142+ SH_ADD_HOOK_MEMFUNC (IServerGameClients, ClientCommand, gameclients, this , &Swiftly::Hook_OnClientCommand, false );
141143 SH_ADD_HOOK_MEMFUNC (INetworkServerService, StartupServer, g_pNetworkServerService, this , &Swiftly::Hook_StartupServer, true );
142144 SH_ADD_HOOK_MEMFUNC (ICvar, DispatchConCommand, icvar, this , &Swiftly::Hook_DispatchConCommand, false );
143145 SH_ADD_HOOK_MEMFUNC (IServerGameDLL, GameServerSteamAPIActivated, server, this , &Swiftly::Hook_GameServerSteamAPIActivated, false );
@@ -257,6 +259,7 @@ bool Swiftly::Unload(char* error, size_t maxlen)
257259 SH_REMOVE_HOOK_MEMFUNC (IServerGameClients, ClientDisconnect, gameclients, this , &Swiftly::Hook_ClientDisconnect, true );
258260 SH_REMOVE_HOOK_MEMFUNC (IServerGameClients, OnClientConnected, gameclients, this , &Swiftly::Hook_OnClientConnected, false );
259261 SH_REMOVE_HOOK_MEMFUNC (IServerGameClients, ClientConnect, gameclients, this , &Swiftly::Hook_ClientConnect, false );
262+ SH_REMOVE_HOOK_MEMFUNC (IServerGameClients, ClientCommand, gameclients, this , &Swiftly::Hook_OnClientCommand, false );
260263 SH_REMOVE_HOOK_MEMFUNC (INetworkServerService, StartupServer, g_pNetworkServerService, this , &Swiftly::Hook_StartupServer, true );
261264 SH_REMOVE_HOOK_MEMFUNC (ICvar, DispatchConCommand, icvar, this , &Swiftly::Hook_DispatchConCommand, false );
262265 SH_REMOVE_HOOK_MEMFUNC (IServerGameDLL, GameServerSteamAPIActivated, server, this , &Swiftly::Hook_GameServerSteamAPIActivated, false );
@@ -492,6 +495,16 @@ inline std::string& strim(std::string& s, const char* t = wws)
492495 return lltrim (rrtrim (s, t), t);
493496}
494497
498+ void Swiftly::Hook_OnClientCommand (CPlayerSlot slot, const CCommand& cmd)
499+ {
500+ g_voiceManager.OnClientCommand (slot, cmd);
501+
502+ if (!OnClientCommand (slot.Get (), cmd.GetCommandString ()))
503+ RETURN_META (MRES_SUPERCEDE);
504+
505+ RETURN_META (MRES_IGNORED);
506+ }
507+
495508void Swiftly::Hook_DispatchConCommand (ConCommandHandle cmd, const CCommandContext& ctx, const CCommand& args)
496509{
497510 CPlayerSlot slot = ctx.GetPlayerSlot ();
@@ -500,11 +513,6 @@ void Swiftly::Hook_DispatchConCommand(ConCommandHandle cmd, const CCommandContex
500513
501514 if (slot.Get () != -1 )
502515 {
503- g_voiceManager.OnClientCommand (slot, args);
504-
505- if (!OnClientCommand (slot.Get (), args.GetCommandString ()))
506- RETURN_META (MRES_SUPERCEDE);
507-
508516 if (command == " say" || command == " say_team" )
509517 {
510518 Player* player = g_playerManager->GetPlayer (slot);
0 commit comments