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