diff --git a/[esx]/esx_context/index.html b/[esx]/esx_context/index.html index fa50034e..5d15770d 100644 --- a/[esx]/esx_context/index.html +++ b/[esx]/esx_context/index.html @@ -352,8 +352,11 @@ } function Close() { - $.post(`https://${GetParentResourceName()}/closed`) - Closed() + $.post(`https://${GetParentResourceName()}/closed`,(retVal)=>{ + if(retVal){ + Closed() + } + }) } window.addEventListener("message", (e) => { @@ -437,4 +440,4 @@ - \ No newline at end of file + diff --git a/[esx]/esx_context/main.lua b/[esx]/esx_context/main.lua index 5a879643..8a2769c9 100644 --- a/[esx]/esx_context/main.lua +++ b/[esx]/esx_context/main.lua @@ -12,10 +12,11 @@ function Post(fn,...) }) end -function Open(position,eles,onSelect,onClose) +function Open(position,eles,onSelect,onClose,canClose) activeMenu = { position = position, eles = eles, + canClose = canClose, onSelect = onSelect, onClose = onClose } @@ -74,11 +75,11 @@ end) -- NUI Callbacks -- [ closed | selected | changed ] -RegisterNUICallback("closed",function() - if not activeMenu then - return +RegisterNUICallback("closed",function(data,cb) + if not activeMenu or (activeMenu and not activeMenu.canClose) then + return cb(false) end - + cb(true) Closed() end) @@ -266,4 +267,4 @@ if Debug then exports["esx_context"]:Open(position,eles,onSelect,onClose) end) -end \ No newline at end of file +end diff --git a/[esx]/esx_multicharacter/client/main.lua b/[esx]/esx_multicharacter/client/main.lua index ca6f89ac..c37bf0f7 100644 --- a/[esx]/esx_multicharacter/client/main.lua +++ b/[esx]/esx_multicharacter/client/main.lua @@ -163,7 +163,7 @@ if ESX.GetConfig().Multichar then elseif Action.action == "return" then SelectCharacterMenu(Characters, slots) end - end, nil, true) + end, nil, false) end function SelectCharacterMenu(Characters, slots) @@ -211,7 +211,7 @@ if ESX.GetConfig().Multichar then SetPedAoBlobRendering(playerPed, true) ResetEntityAlpha(playerPed) end - end, nil, true) + end, nil, false) end RegisterNetEvent('esx_multicharacter:SetupUI') AddEventHandler('esx_multicharacter:SetupUI', function(data, slots)