Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ RegisterNetEvent('QBCore:Client:UpdateObject', function() QBCore = exports['qb-c

local headerShown = false
local sendData = nil
local menuFocus = false

-- Functions

local function setMenuFocus(state)
menuFocus = state
SetNuiFocus(state, state)
end

local function sortData(data, skipfirst)
local header = data[1]
local tempData = data
Expand All @@ -27,7 +33,7 @@ local function openMenu(data, sort, skipFirst)
end
end
end
SetNuiFocus(true, true)
setMenuFocus(true)
headerShown = false
sendData = data
SendNUIMessage({
Expand All @@ -39,7 +45,7 @@ end
local function closeMenu()
sendData = nil
headerShown = false
SetNuiFocus(false)
setMenuFocus(false)
SendNUIMessage({
action = 'CLOSE_MENU'
})
Expand Down Expand Up @@ -70,7 +76,7 @@ end)
RegisterNUICallback('clickedButton', function(option, cb)
if headerShown then headerShown = false end
PlaySoundFrontend(-1, 'Highlight_Cancel', 'DLC_HEIST_PLANNING_BOARD_SOUNDS', 1)
SetNuiFocus(false)
setMenuFocus(false)
if sendData then
local data = sendData[tonumber(option)]
sendData = nil
Expand Down Expand Up @@ -102,16 +108,16 @@ end)
RegisterNUICallback('closeMenu', function(_, cb)
headerShown = false
sendData = nil
SetNuiFocus(false)
setMenuFocus(false)
cb('ok')
TriggerEvent("qb-menu:client:menuClosed")
end)

-- Command and Keymapping

RegisterCommand('playerfocus', function()
if headerShown then
SetNuiFocus(true, true)
if headerShown and not menuFocus then
setMenuFocus(true)
end
end)

Expand Down