forked from Simnation/Main
ed
This commit is contained in:
parent
ae1730aae7
commit
aa78a2febb
5 changed files with 20 additions and 22 deletions
|
@ -1,4 +1,5 @@
|
|||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
local isJobMenuOpen = false
|
||||
|
||||
local function GetJobs()
|
||||
local p = promise.new()
|
||||
|
@ -10,7 +11,8 @@ end
|
|||
|
||||
local function OpenUI()
|
||||
local job = QBCore.Functions.GetPlayerData().job
|
||||
SetNuiFocus(true,true)
|
||||
SetNuiFocus(true, true)
|
||||
isJobMenuOpen = true
|
||||
SendNUIMessage({
|
||||
action = 'sendjobs',
|
||||
activeJob = job["name"],
|
||||
|
@ -29,7 +31,8 @@ end)
|
|||
|
||||
RegisterNUICallback('closemenu', function(data, cb)
|
||||
cb({})
|
||||
SetNuiFocus(false,false)
|
||||
SetNuiFocus(false, false)
|
||||
isJobMenuOpen = false
|
||||
end)
|
||||
|
||||
RegisterNUICallback('removejob', function(data, cb)
|
||||
|
@ -73,18 +76,8 @@ RegisterKeyMapping('jobmenu', "Show Job Management", "keyboard", "J")
|
|||
|
||||
TriggerEvent('chat:removeSuggestion', '/jobmenu')
|
||||
|
||||
|
||||
-- Add this to cl_main.lua
|
||||
RegisterNetEvent('ps-multijob:refreshJobs', function()
|
||||
if not IsPauseMenuActive() then -- Only refresh if menu is open
|
||||
local isMenuOpen = false
|
||||
-- Check if the NUI is focused (menu is open)
|
||||
if IsPauseMenuActive() and IsPauseMenuRestarting() then
|
||||
isMenuOpen = true
|
||||
end
|
||||
|
||||
if isMenuOpen then
|
||||
OpenUI() -- Refresh the UI with updated job data
|
||||
end
|
||||
if isJobMenuOpen then
|
||||
OpenUI() -- Refresh the UI with updated job data
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue