diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-01-15 18:35:35 +0000 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-01-15 18:35:35 +0000 |
commit | d4d4e489e4a1435e1df3cd1a1e3666e7ae713829 (patch) | |
tree | 6b4200eaa588b7df9f7262adef3b7970f1446fe8 | |
parent | e537ce2885f56880034be18f3828eb490c5349d9 (diff) | |
download | NorthstarLauncher-d4d4e489e4a1435e1df3cd1a1e3666e7ae713829.tar.gz NorthstarLauncher-d4d4e489e4a1435e1df3cd1a1e3666e7ae713829.zip |
improve ConCommand__DispatchHook CLIENTCMD_CAN_EXECUTE logic
-rw-r--r-- | NorthstarDedicatedTest/serverauthentication.cpp | 5 |
1 files 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) |