mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 23:01:36 +00:00
Fix triggerservercallback too early
This commit is contained in:
+18
-5
@@ -22,6 +22,8 @@ local HasAlreadyEnteredMarker = false
|
||||
local CurrentAction = nil
|
||||
local CurrentActionMsg = ''
|
||||
local CurrentActionData = {}
|
||||
local FirstSpawn = true
|
||||
local PlayerLoaded = false
|
||||
|
||||
function DrawSub(text, time)
|
||||
ClearPrints()
|
||||
@@ -791,16 +793,22 @@ function OpenPlayerInventoryMenu(property)
|
||||
|
||||
end
|
||||
|
||||
local FirstSpawn = true
|
||||
|
||||
AddEventHandler('playerSpawned', function()
|
||||
|
||||
if FirstSpawn then
|
||||
|
||||
ESX.TriggerServerCallback('esx_property:getLastProperty', function(propertyName)
|
||||
if propertyName ~= nil then
|
||||
EnterProperty(propertyName)
|
||||
Citizen.CreateThread(function()
|
||||
|
||||
while not PlayerLoaded do
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
|
||||
ESX.TriggerServerCallback('esx_property:getLastProperty', function(propertyName)
|
||||
if propertyName ~= nil then
|
||||
EnterProperty(propertyName)
|
||||
end
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
FirstSpawn = false
|
||||
@@ -808,6 +816,11 @@ AddEventHandler('playerSpawned', function()
|
||||
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:playerLoaded')
|
||||
AddEventHandler('esx:playerLoaded', function(xPlayer)
|
||||
PlayerLoaded = true
|
||||
end)
|
||||
|
||||
AddEventHandler('esx_property:getProperties', function(cb)
|
||||
cb(GetProperties())
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user