lib.addRadialItem({
{
id = 'police',
label = 'Police',
icon = 'shield-halved',
menu = 'police_menu'
},
{
id = 'police2',
label = 'Police 2',
icon = 'shield-halved',
menu = 'police_menu'
},
{
id = 'police3',
label = 'Police 3',
icon = 'shield-halved',
menu = 'police_menu'
},
{
id = 'police4',
label = 'Police 4',
icon = 'shield-halved',
menu = 'police_menu'
},
{
id = 'police5',
label = 'Police5',
icon = 'shield-halved',
menu = 'police_menu'
},
{
id = 'garage_access',
icon = 'warehouse',
label = 'Garage',
onSelect = function()
print('Garage')
end
},
})
local coords = GetEntityCoords(cache.ped)
local point = lib.points.new(coords, 5)
function point:onEnter()
print('police_menu updated onEnter')
lib.registerRadial({
id = 'police_menu',
items = {
{
id = 'dandcuff',
label = 'Handcuff',
icon = 'handcuffs',
menu = 'police_handcuff'
},
{
id = 'frisk',
label = 'Frisk',
icon = 'hand',
menu = 'police_frisk'
},
{
label = 'Fingerprint',
icon = 'fingerprint'
},
{
label = 'Jail',
icon = 'bus',
onSelect = function()
print('Jail')
end
},
{
label = 'Search',
icon = 'magnifying-glass',
onSelect = function()
print('Search')
end
}
}
})
end
function point:onExit()
print('police_menu updated onExit')
lib.registerRadial({
id = 'police_menu',
items = {
{
id = 'garage_access',
icon = 'warehouse',
label = 'Garage',
onSelect = function()
print('Garage')
end
}
}
})
end
2. Select any `Police` option
3. Select `Frisk` option
3. Walk away until the console prints `police_menu updated onExit`
4. Menu doesn't close
**Expected behavior**
Menu should close if the option to access it gets removed
**Screenshots**
[Video](https://streamable.com/6t4diz)
Honestly, this is not very impacting assuming there are more server and/or client safety checks and not only rely in showing/hiding the option. It's just visually confusing
Describe the bug After re-registering a radial menu, if a nested menu is open it doesn't get updated and the player can still access old options.
To Reproduce Steps to reproduce the behavior:
lib.registerRadial({ id = 'police_handcuff', items = { { label = 'Handcuff', icon = 'handcuffs', }, { label = 'Handcuff', icon = 'handcuffs', }, { label = 'Handcuff', icon = 'handcuffs', }, } })
lib.addRadialItem({ { id = 'police', label = 'Police', icon = 'shield-halved', menu = 'police_menu' }, { id = 'police2', label = 'Police 2', icon = 'shield-halved', menu = 'police_menu' }, { id = 'police3', label = 'Police 3', icon = 'shield-halved', menu = 'police_menu' },
{ id = 'police4', label = 'Police 4', icon = 'shield-halved', menu = 'police_menu' },
{ id = 'police5', label = 'Police5', icon = 'shield-halved', menu = 'police_menu' }, { id = 'garage_access', icon = 'warehouse', label = 'Garage', onSelect = function() print('Garage') end }, })
local coords = GetEntityCoords(cache.ped) local point = lib.points.new(coords, 5)
function point:onEnter() print('police_menu updated onEnter') lib.registerRadial({ id = 'police_menu', items = { { id = 'dandcuff', label = 'Handcuff', icon = 'handcuffs', menu = 'police_handcuff' }, { id = 'frisk', label = 'Frisk', icon = 'hand', menu = 'police_frisk' }, { label = 'Fingerprint', icon = 'fingerprint' }, { label = 'Jail', icon = 'bus', onSelect = function() print('Jail') end }, { label = 'Search', icon = 'magnifying-glass', onSelect = function() print('Search') end } } }) end
function point:onExit() print('police_menu updated onExit') lib.registerRadial({ id = 'police_menu', items = { { id = 'garage_access', icon = 'warehouse', label = 'Garage', onSelect = function() print('Garage') end } } }) end