mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
feat(client/radial): add lib.disableRadial to prevent radial access
This commit is contained in:
@@ -271,11 +271,25 @@ RegisterNUICallback('radialTransition', function(_, cb)
|
|||||||
cb(true)
|
cb(true)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
local isDisabled = false
|
||||||
|
|
||||||
|
---Disallow players from opening the radial menu.
|
||||||
|
---@param state boolean
|
||||||
|
function lib.disableRadial(state)
|
||||||
|
isDisabled = state
|
||||||
|
|
||||||
|
if isOpen and state then
|
||||||
|
return lib.hideRadial()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
lib.addKeybind({
|
lib.addKeybind({
|
||||||
name = 'ox_lib-radial',
|
name = 'ox_lib-radial',
|
||||||
description = 'Open radial menu',
|
description = 'Open radial menu',
|
||||||
defaultKey = 'z',
|
defaultKey = 'z',
|
||||||
onPressed = function()
|
onPressed = function()
|
||||||
|
if isDisabled then return end
|
||||||
|
|
||||||
if isOpen then
|
if isOpen then
|
||||||
return lib.hideRadial()
|
return lib.hideRadial()
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user