From 9d756f69365875cff7b1fd78b52b23f59a3752a1 Mon Sep 17 00:00:00 2001 From: Andreas Maerten <24669514+Yimura@users.noreply.github.com> Date: Mon, 10 Jul 2023 23:06:08 +0200 Subject: [PATCH] fix(session): hard lock when switching too early (#1678) --- src/util/session.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/util/session.hpp b/src/util/session.hpp index 22eca992..f6885075 100644 --- a/src/util/session.hpp +++ b/src/util/session.hpp @@ -34,8 +34,15 @@ namespace big::session } } - inline void join_type(eSessionType session) + inline bool join_type(eSessionType session) { + if (SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) != 0 || STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS()) + { + g_notification_service->push_error("RID Joiner", "Player switch in progress, wait a bit."); + + return false; + } + *script_global(2695915).as() = (session == eSessionType::SC_TV ? 1 : 0); // If SC TV Then Enable Spectator Mode if (session == eSessionType::LEAVE_ONLINE) @@ -46,6 +53,8 @@ namespace big::session *script_global(1574589).as() = 1; script::get_current()->yield(200ms); *script_global(1574589).as() = 0; + + return true; } inline void set_fm_event_index(int index)