diff options
Diffstat (limited to 'NorthstarDLL')
-rw-r--r-- | NorthstarDLL/misccommands.cpp | 11 | ||||
-rw-r--r-- | NorthstarDLL/scriptserverbrowser.cpp | 9 |
2 files changed, 9 insertions, 11 deletions
diff --git a/NorthstarDLL/misccommands.cpp b/NorthstarDLL/misccommands.cpp index b316571c..3aae19d0 100644 --- a/NorthstarDLL/misccommands.cpp +++ b/NorthstarDLL/misccommands.cpp @@ -29,11 +29,8 @@ void ConCommand_ns_start_reauth_and_leave_to_lobby(const CCommand& arg) void ConCommand_ns_end_reauth_and_leave_to_lobby(const CCommand& arg) { - R2::Cbuf_AddText( - R2::Cbuf_GetCurrentPlayer(), - fmt::format("serverfilter {}", g_pServerAuthentication->m_RemoteAuthenticationData.begin()->first).c_str(), - R2::cmd_source_t::kCommandSrcCode); - R2::Cbuf_Execute(); + if (g_pServerAuthentication->m_RemoteAuthenticationData.size()) + R2::g_pCVar->FindVar("serverfilter")->SetValue(g_pServerAuthentication->m_RemoteAuthenticationData.begin()->first.c_str()); // weird way of checking, but check if client script vm is initialised, mainly just to allow players to cancel this if (g_pSquirrel<ScriptContext::CLIENT>->m_pSQVM) @@ -108,6 +105,7 @@ void FixupCvarFlags() pCommand->m_nFlags |= FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS; } while (ppEngineClientCommands[++i]); + // array of cvars and the flags we want to add to them const std::vector<std::tuple<const char*, uint32_t>> CVAR_FIXUP_ADD_FLAGS = { // system commands (i.e. necessary for proper functionality) // servers need to be able to disconnect @@ -138,10 +136,13 @@ void FixupCvarFlags() {"test_setteam", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}, {"melee_lunge_ent", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}}; + // array of cvars and the flags we want to remove from them const std::vector<std::tuple<const char*, uint32_t>> CVAR_FIXUP_REMOVE_FLAGS = { // unsure how this command works, not even sure it's used on retail servers, deffo shouldn't be used on northstar {"migrateme", FCVAR_SERVER_CAN_EXECUTE | FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}, {"recheck", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}, // we don't need this on northstar servers, it's for communities + + // unsure how these work exactly (rpt system likely somewhat stripped?), removing anyway since they won't be used {"rpt_client_enable", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}, {"rpt_password", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}}; diff --git a/NorthstarDLL/scriptserverbrowser.cpp b/NorthstarDLL/scriptserverbrowser.cpp index a361aeb8..e33406fc 100644 --- a/NorthstarDLL/scriptserverbrowser.cpp +++ b/NorthstarDLL/scriptserverbrowser.cpp @@ -371,8 +371,7 @@ SQRESULT SQ_ConnectToAuthedServer(HSquirrelVM* sqvm) // set auth token, then try to connect // i'm honestly not entirely sure how silentconnect works regarding ports and encryption so using connect for now - R2::Cbuf_AddText( - R2::Cbuf_GetCurrentPlayer(), fmt::format("serverfilter {}", info.authToken).c_str(), R2::cmd_source_t::kCommandSrcCode); + R2::g_pCVar->FindVar("serverfilter")->SetValue(info.authToken); R2::Cbuf_AddText( R2::Cbuf_GetCurrentPlayer(), fmt::format( @@ -403,10 +402,8 @@ SQRESULT SQ_CompleteAuthWithLocalServer(HSquirrelVM* sqvm) { // literally just set serverfilter // note: this assumes we have no authdata other than our own - R2::Cbuf_AddText( - R2::Cbuf_GetCurrentPlayer(), - fmt::format("serverfilter {}", g_pServerAuthentication->m_RemoteAuthenticationData.begin()->first).c_str(), - R2::cmd_source_t::kCommandSrcCode); + if (g_pServerAuthentication->m_RemoteAuthenticationData.size()) + R2::g_pCVar->FindVar("serverfilter")->SetValue(g_pServerAuthentication->m_RemoteAuthenticationData.begin()->first.c_str()); return SQRESULT_NULL; } |