From 9ce8f963b4b36fa65d3bb13c6c5eb25cfb14b905 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Fri, 21 Apr 2023 12:31:33 +1000 Subject: [PATCH] fix(client/context): hide before triggering select actions --- resource/interface/client/context.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/resource/interface/client/context.lua b/resource/interface/client/context.lua index b9a0171..0feeccc 100644 --- a/resource/interface/client/context.lua +++ b/resource/interface/client/context.lua @@ -32,6 +32,8 @@ local function closeContext(_, cb, onExit) lib.resetNuiFocus() + if not openContextMenu then return end + if (cb or onExit) and contextMenus[openContextMenu].onExit then contextMenus[openContextMenu].onExit() end if not cb then SendNUIMessage({ action = 'hideContext' }) end @@ -98,15 +100,11 @@ RegisterNUICallback('clickContext', function(id, cb) openContextMenu = nil - lib.resetNuiFocus() + SendNUIMessage({ action = 'hideContext' }) if data.onSelect then data.onSelect(data.args) end if data.event then TriggerEvent(data.event, data.args) end if data.serverEvent then TriggerServerEvent(data.serverEvent, data.args) end - - SendNUIMessage({ - action = 'hideContext' - }) end) RegisterNUICallback('closeContext', closeContext)