fix(client/context): hide before triggering select actions

This commit is contained in:
Linden
2023-04-21 12:31:33 +10:00
parent d1606af88e
commit 9ce8f963b4

View File

@@ -32,6 +32,8 @@ local function closeContext(_, cb, onExit)
lib.resetNuiFocus() lib.resetNuiFocus()
if not openContextMenu then return end
if (cb or onExit) and contextMenus[openContextMenu].onExit then contextMenus[openContextMenu].onExit() end if (cb or onExit) and contextMenus[openContextMenu].onExit then contextMenus[openContextMenu].onExit() end
if not cb then SendNUIMessage({ action = 'hideContext' }) end if not cb then SendNUIMessage({ action = 'hideContext' }) end
@@ -98,15 +100,11 @@ RegisterNUICallback('clickContext', function(id, cb)
openContextMenu = nil openContextMenu = nil
lib.resetNuiFocus() SendNUIMessage({ action = 'hideContext' })
if data.onSelect then data.onSelect(data.args) end if data.onSelect then data.onSelect(data.args) end
if data.event then TriggerEvent(data.event, data.args) end if data.event then TriggerEvent(data.event, data.args) end
if data.serverEvent then TriggerServerEvent(data.serverEvent, data.args) end if data.serverEvent then TriggerServerEvent(data.serverEvent, data.args) end
SendNUIMessage({
action = 'hideContext'
})
end) end)
RegisterNUICallback('closeContext', closeContext) RegisterNUICallback('closeContext', closeContext)