diff options
author | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2023-01-08 02:10:48 +0000 |
---|---|---|
committer | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2023-01-08 02:10:48 +0000 |
commit | b78f7dc3f9b277c22843cc289346fc68b29fc087 (patch) | |
tree | 31b7bffb57bba8cbac5bc4eb82a92e5ab53fc7c4 /NorthstarDLL/server/auth | |
parent | b56684cd86eeb21ff2a4008938286ff7d593a544 (diff) | |
download | NorthstarLauncher-b78f7dc3f9b277c22843cc289346fc68b29fc087.tar.gz NorthstarLauncher-b78f7dc3f9b277c22843cc289346fc68b29fc087.zip |
assign bot teams and fix issue with bot_add occasionally not workin
Diffstat (limited to 'NorthstarDLL/server/auth')
-rw-r--r-- | NorthstarDLL/server/auth/serverauthentication.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/NorthstarDLL/server/auth/serverauthentication.cpp b/NorthstarDLL/server/auth/serverauthentication.cpp index c6283b7a..7b3f7436 100644 --- a/NorthstarDLL/server/auth/serverauthentication.cpp +++ b/NorthstarDLL/server/auth/serverauthentication.cpp @@ -399,6 +399,27 @@ void,, (R2::CBaseClient* self, uint32_t unknownButAlways1, const char* pReason, _CBaseClient__Disconnect(self, unknownButAlways1, buf); } +// clang-format off +AUTOHOOK(CBaseClient__Clear, engine.dll + 0x101480, + void, __fastcall, (R2::CBaseClient* self)) +// clang-format on +{ + // final cleanup, humans should never hit this without being disconnected already! + // bots generally will on level change, however, so this is necessary + if (g_pServerAuthentication->m_PlayerAuthenticationData.find(self) != g_pServerAuthentication->m_PlayerAuthenticationData.end()) + { + if (!self->m_bFakePlayer) + spdlog::warn("player {} has auth data in CBaseClient::Clear()!"); + + // fully cleanup + g_pServerAuthentication->RemovePlayerAuthData(self); + g_pServerAuthentication->RemovePlayer(self); + g_pServerLimits->RemovePlayer(self); + } + + CBaseClient__Clear(self); +} + void ConCommand_ns_resetpersistence(const CCommand& args) { if (*R2::g_pServerState == R2::server_state_t::ss_active) |