Skip to content

Commit

Permalink
fix(client) : show only the UI if fully playerloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
renzuzu committed Aug 18, 2021
1 parent 2eb3c7a commit bef472a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
17 changes: 12 additions & 5 deletions renzu_hud/client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,24 +174,26 @@ CreateThread(function()
AddEventHandler('esx:playerLoaded', function(xPlayer)
Hud.playerloaded = true
Wait(2000)
----print("ESX")
print("ESX")
Hud.lastped = PlayerPedId()
TriggerServerEvent("renzu_hud:getdata",Hud.charslot)
DecorSetBool(PlayerPedId(), "PLAYERLOADED", true)
Wait(5000)
SendNUIMessage({content = true, type = 'pedface'})
SendNUIMessage({content = true, type = 'playerloaded'})
end)
elseif config.framework == 'QBCORE' then
RegisterNetEvent('QBCore:Client:OnPlayerLoaded')
AddEventHandler('QBCore:Client:OnPlayerLoaded', function()
Hud.playerloaded = true
Wait(2000)
----print("ESX")
print("QB")
Hud.lastped = PlayerPedId()
TriggerServerEvent("renzu_hud:getdata",Hud.charslot)
DecorSetBool(PlayerPedId(), "PLAYERLOADED", true)
Wait(5000)
SendNUIMessage({content = true, type = 'pedface'})
SendNUIMessage({content = true, type = 'playerloaded'})
end)
else
RegisterNetEvent('playerSpawned')
Expand All @@ -203,7 +205,8 @@ CreateThread(function()
DecorSetBool(PlayerPedId(), "PLAYERLOADED", true)
TriggerServerEvent("renzu_hud:getdata",Hud.charslot)
Wait(5000)
SendNUIMessage({content = true, type = 'pedface'})
SendNUIMessage({content = true, type = 'pedface'})
SendNUIMessage({content = true, type = 'playerloaded'})
end)
end
Wait(1000)
Expand All @@ -214,26 +217,30 @@ CreateThread(function()
Citizen.Wait(4000)
end
if DecorExistOn(PlayerPedId(), "PLAYERLOADED") and Hud.charslot ~= nil then
----print("PLAYERLOADED")
print("PLAYERLOADED")
TriggerServerEvent("renzu_hud:getdata",Hud.charslot)
Hud.playerloaded = true
SendNUIMessage({content = true, type = 'playerloaded'})
end
Wait(500)
if DecorExistOn(PlayerPedId(), "PLAYERLOADED") and config.loadedasmp and Hud:isplayer() then
--print("ISMP")
print("ISMP")
TriggerServerEvent("renzu_hud:getdata",0, true)
DecorSetBool(PlayerPedId(), "PLAYERLOADED", true)
Hud.playerloaded = true
SendNUIMessage({content = true, type = 'pedface'})
SendNUIMessage({content = true, type = 'playerloaded'})
elseif Hud:isplayer() and config.forceplayerload then
Wait(10000)
Hud.playerloaded = true
print("isplayer f")
Wait(2000)
Hud.lastped = PlayerPedId()
DecorSetBool(PlayerPedId(), "PLAYERLOADED", true)
TriggerServerEvent("renzu_hud:getdata",Hud.charslot)
Wait(5000)
SendNUIMessage({content = true, type = 'pedface'})
SendNUIMessage({content = true, type = 'playerloaded'})
end
while not Hud.playerloaded do
Wait(1000)
Expand Down
6 changes: 5 additions & 1 deletion renzu_hud/ui/js/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2004,10 +2004,13 @@ function SetNotify(table) {
}

function setStatusType(type) {
document.getElementById("uibody").style.display = 'block'
status_type = type
}

function playerloaded() {
document.getElementById("uibody").style.display = 'block'
}

function isAmbulance(bool) {
isambulance = bool
}
Expand Down Expand Up @@ -2073,6 +2076,7 @@ var renzu_hud = {
setCompass,
setRadioChannel,
setShowClothing,
playerloaded,
setClotheState,
ResetClotheState,
setStatusUILocation,
Expand Down

0 comments on commit bef472a

Please sign in to comment.