mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 09:01:24 +00:00
Add canClose function to context menu
Added a canClose parameter so that the user cannot close the menu by pressing ESC instead has to be force closed via code.
This commit is contained in:
@@ -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
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user