From 99dac40452d251dfd9e2a77c3b248316423e1edf Mon Sep 17 00:00:00 2001 From: astatine Date: Sun, 3 May 2020 20:33:29 +0200 Subject: [PATCH] chat2: fix hide state being permanently overridden when faded out/paused --- resources/[gameplay]/chat/cl_chat.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/resources/[gameplay]/chat/cl_chat.lua b/resources/[gameplay]/chat/cl_chat.lua index da0491f..084dda9 100644 --- a/resources/[gameplay]/chat/cl_chat.lua +++ b/resources/[gameplay]/chat/cl_chat.lua @@ -278,13 +278,17 @@ Citizen.CreateThread(function() if chatLoaded then local forceHide = IsScreenFadedOut() or IsPauseMenuActive() + local wasForceHide = false - if forceHide then - origChatHideState = chatHideState - chatHideState = CHAT_HIDE_STATES.ALWAYS_HIDE - elseif origChatHideState ~= -1 then + if chatHideState ~= CHAT_HIDE_STATES.ALWAYS_HIDE then + if forceHide then + origChatHideState = chatHideState + chatHideState = CHAT_HIDE_STATES.ALWAYS_HIDE + end + elseif not forceHide and origChatHideState ~= -1 then chatHideState = origChatHideState origChatHideState = -1 + wasForceHide = true end if chatHideState ~= lastChatHideState then @@ -293,7 +297,7 @@ Citizen.CreateThread(function() SendNUIMessage({ type = 'ON_SCREEN_STATE_CHANGE', hideState = chatHideState, - fromUserInteraction = not forceHide and not isFirstHide + fromUserInteraction = not forceHide and not isFirstHide and not wasForceHide }) isFirstHide = false