diff --git a/[core]/esx_menu_dialog/client/main.lua b/[core]/esx_menu_dialog/client/main.lua index 82588182..24253846 100644 --- a/[core]/esx_menu_dialog/client/main.lua +++ b/[core]/esx_menu_dialog/client/main.lua @@ -1,10 +1,6 @@ -local Timeouts, OpenedMenus, MenuType = {}, {}, "dialog" +local OpenedMenus, MenuType = {}, "dialog" local function openMenu(namespace, name, data) - for i = 1, #Timeouts, 1 do - ESX.ClearTimeout(Timeouts[i]) - end - OpenedMenus[namespace .. "_" .. name] = true SendNUIMessage({ @@ -14,11 +10,11 @@ local function openMenu(namespace, name, data) data = data, }) - local timeoutId = ESX.SetTimeout(200, function() - SetNuiFocus(true, true) + ESX.SetTimeout(200, function() + if next(OpenedMenus) then + SetNuiFocus(true, true) + end end) - - table.insert(Timeouts, timeoutId) end local function closeMenu(namespace, name) diff --git a/[core]/esx_menu_list/client/main.lua b/[core]/esx_menu_list/client/main.lua index 690c8ef6..6bab13a3 100644 --- a/[core]/esx_menu_list/client/main.lua +++ b/[core]/esx_menu_list/client/main.lua @@ -12,7 +12,9 @@ CreateThread(function() data = data, }) SetTimeout(200, function() - SetNuiFocus(true, true) + if next(OpenedMenus) then + SetNuiFocus(true, true) + end end) end