aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/serverauthentication.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-01-15 18:35:35 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-01-15 18:35:35 +0000
commitd4d4e489e4a1435e1df3cd1a1e3666e7ae713829 (patch)
tree6b4200eaa588b7df9f7262adef3b7970f1446fe8 /NorthstarDedicatedTest/serverauthentication.cpp
parente537ce2885f56880034be18f3828eb490c5349d9 (diff)
downloadNorthstarLauncher-d4d4e489e4a1435e1df3cd1a1e3666e7ae713829.tar.gz
NorthstarLauncher-d4d4e489e4a1435e1df3cd1a1e3666e7ae713829.zip
improve ConCommand__DispatchHook CLIENTCMD_CAN_EXECUTE logic
Diffstat (limited to 'NorthstarDedicatedTest/serverauthentication.cpp')
-rw-r--r--NorthstarDedicatedTest/serverauthentication.cpp5
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)