From d4d4e489e4a1435e1df3cd1a1e3666e7ae713829 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Sat, 15 Jan 2022 18:35:35 +0000 Subject: improve ConCommand__DispatchHook CLIENTCMD_CAN_EXECUTE logic --- NorthstarDedicatedTest/serverauthentication.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NorthstarDedicatedTest/serverauthentication.cpp b/NorthstarDedicatedTest/serverauthentication.cpp index 794c6c1d..8cbf666e 100644 --- a/NorthstarDedicatedTest/serverauthentication.cpp +++ b/NorthstarDedicatedTest/serverauthentication.cpp @@ -318,7 +318,7 @@ void CBaseClient__DisconnectHook(void* self, uint32_t unknownButAlways1, const c // maybe this should be done outside of auth code, but effort to refactor rn and it sorta fits // hack: store the client that's executing the current stringcmd for pCommand->Dispatch() hook later -void* pExecutingGameClient; +void* pExecutingGameClient = 0; char CGameClient__ExecuteStringCommandHook(void* self, uint32_t unknown, const char* pCommandString) { @@ -351,7 +351,7 @@ char CGameClient__ExecuteStringCommandHook(void* self, uint32_t unknown, const c void ConCommand__DispatchHook(ConCommand* command, const CCommand& args, void* a3) { // patch to ensure FCVAR_GAMEDLL concommands without FCVAR_CLIENTCMD_CAN_EXECUTE can't be executed by remote clients - if (*sv_m_State == server_state_t::ss_active && command->IsFlagSet(FCVAR_GAMEDLL) && !command->IsFlagSet(FCVAR_CLIENTCMD_CAN_EXECUTE)) + if (*sv_m_State == server_state_t::ss_active && !command->IsFlagSet(FCVAR_CLIENTCMD_CAN_EXECUTE) && !!pExecutingGameClient) { if (IsDedicated()) return; @@ -362,6 +362,7 @@ void ConCommand__DispatchHook(ConCommand* command, const CCommand& args, void* a } ConCommand__Dispatch(command, args, a3); + pExecutingGameClient = 0; } char __fastcall CNetChan___ProcessMessagesHook(void* self, void* buf) -- cgit v1.2.3