mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-17 14:06:02 +01:00
Refactor ESX Core loading
I realised I was loading ESX the stupidest way I think I was loading ESX object, then instantly clearing it and then used workarounds to try and reload it (thinking is hard ok) It should now load correctly and faster also I realised my custom `onPlayerLoaded()` function was loading too fast, so I've added a delay to it but removed the while loops for esx checks that could potentially break the script
This commit is contained in:
@@ -40,6 +40,7 @@ function onPlayerLoaded(func, onStart)
|
||||
|
||||
if not loaded then
|
||||
local tempFunc = function()
|
||||
Wait(2000)
|
||||
debugPrint("^6Bridge^7: ^2Executing onPlayerLoaded")
|
||||
func()
|
||||
end
|
||||
@@ -138,9 +139,7 @@ function waitForLogin()
|
||||
local loggedIn = false
|
||||
|
||||
if isStarted(ESXExport) then
|
||||
debugPrint("^6Bridge^7: ^3ESX waitForLogin^7() ^2running^7")
|
||||
while (GetGameTimer() - startTime) < timeout do
|
||||
while not ESX do Wait(100) end
|
||||
local playerData = ESX.GetPlayerData()
|
||||
if playerData and playerData.job then
|
||||
loggedIn = true
|
||||
|
||||
Reference in New Issue
Block a user