mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-28 17:01:14 +00:00
Merge pull request #759 from tony-stark-17/tony-stark-17-patch-1
feat: add canClose to context menu
This commit is contained in:
@@ -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 @@
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user