mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
Fix identity not showing up to wait NUI until ready
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
local loadingScreenFinished = false
|
||||
local ready = false
|
||||
|
||||
RegisterNetEvent('esx_identity:alreadyRegistered')
|
||||
AddEventHandler('esx_identity:alreadyRegistered', function()
|
||||
@@ -13,18 +14,20 @@ AddEventHandler('esx:loadingScreenOff', function()
|
||||
loadingScreenFinished = true
|
||||
end)
|
||||
|
||||
RegisterNUICallback('ready', function(data, cb)
|
||||
ready = true
|
||||
cb(1)
|
||||
end)
|
||||
|
||||
if not Config.UseDeferrals then
|
||||
local guiEnabled = false
|
||||
|
||||
function EnableGui(state)
|
||||
SetNuiFocus(state, state)
|
||||
guiEnabled = state
|
||||
--[[ CreateThread(function()
|
||||
while true do
|
||||
Wait(20000) -- UNCOMMENT THIS METHOD IF YOU ARE EXPERIENCING ISSUES WITH THE UI ON LOCALHOST | IF YOU STILL EXPERIENCE ISSUES AFTER REMOVING COMMENTS, INCREASE THE TIME.
|
||||
end
|
||||
end)
|
||||
]]--
|
||||
while not ready do
|
||||
Citizen.Wait(500)
|
||||
end
|
||||
SendNUIMessage({
|
||||
type = "enableui",
|
||||
enable = state
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
$(function() {
|
||||
$.post('http://esx_identity/ready', JSON.stringify({}));
|
||||
|
||||
window.addEventListener('message', function(event) {
|
||||
if (event.data.type == "enableui") {
|
||||
document.body.style.display = event.data.enable ? "block" : "none";
|
||||
|
||||
Reference in New Issue
Block a user