From 8514d397e430e72436b4bc1f378609f8bf983f7a Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 9 May 2019 20:11:33 +0200 Subject: [PATCH] Fix Focus #167 --- resources/gcphone/client/client.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/resources/gcphone/client/client.lua b/resources/gcphone/client/client.lua index 0d84460..280e25d 100644 --- a/resources/gcphone/client/client.lua +++ b/resources/gcphone/client/client.lua @@ -22,7 +22,7 @@ local USE_RTC = false local useMouse = false local ignoreFocus = false local takePhoto = false -local lastFrameIsOpen = false +local hasFocus = false local PhoneInCall = {} local currentPlaySound = false @@ -89,17 +89,21 @@ Citizen.CreateThread(function() for _, value in ipairs(KeyToucheCloseEvent) do if IsControlJustPressed(1, value.code) then SendNUIMessage({keyUp = value.event}) + print(value.event) end end local nuiFocus = useMouse and not ignoreFocus - if nuiFocus == true then + if hasFocus == true and ignoreFocus == true then + SetNuiFocus(false, false) + hasFocus = false + elseif nuiFocus == true then SetNuiFocus(nuiFocus, nuiFocus) - lastFrameIsOpen = true + hasFocus = true end else - if lastFrameIsOpen == true then + if hasFocus == true then SetNuiFocus(false, false) - lastFrameIsOpen = false + hasFocus = false end end end