From d1ab7c45b5b8954a399e2c195e4e759331fbc6f9 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 9 May 2019 21:50:27 +0200 Subject: [PATCH] Fix Focus photo #167 --- resources/gcphone/client/client.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/resources/gcphone/client/client.lua b/resources/gcphone/client/client.lua index 280e25d..a6b2501 100644 --- a/resources/gcphone/client/client.lua +++ b/resources/gcphone/client/client.lua @@ -89,16 +89,15 @@ 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 hasFocus == true and ignoreFocus == true then + if useMouse == true and hasFocus == ignoreFocus then + local nuiFocus = not hasFocus + SetNuiFocus(nuiFocus, nuiFocus) + hasFocus = nuiFocus + elseif useMouse == false and hasFocus == true then SetNuiFocus(false, false) hasFocus = false - elseif nuiFocus == true then - SetNuiFocus(nuiFocus, nuiFocus) - hasFocus = true end else if hasFocus == true then @@ -734,9 +733,13 @@ RegisterNUICallback('takePhoto', function(data, cb) CreateMobilePhone(1) CellCamActivate(true, true) takePhoto = true + Citizen.Wait(0) + if hasFocus == true then + SetNuiFocus(false, false) + hasFocus = false + end while takePhoto do Citizen.Wait(0) - SetNuiFocus(false, false) if IsControlJustPressed(1, 27) then -- Toogle Mode frontCam = not frontCam