fix: Close UI when setting up characters; spawn fallback position

- If playerData.coords don't exist then there's an issue with that character

- Instead of erroring out, spawn them at the character selection area

todo: setup default spawn location instead of relying on database
This commit is contained in:
Linden
2021-08-02 22:13:36 +10:00
parent b5b5f56a2b
commit 0ec17f081e
+3 -2
View File
@@ -35,7 +35,7 @@ if ESX.GetConfig().Multichar then
RenderScriptCams(true, false, 1, true, true)
SetCamCoord(cam, offset.x, offset.y, offset.z)
PointCamAtCoord(cam, Config.Spawn.x, Config.Spawn.y, Config.Spawn.z + 1.3)
ESX.UI.Menu.CloseAll()
ESX.UI.HUD.SetDisplay(0.0)
StartLoop()
ShutdownLoadingScreen()
@@ -147,6 +147,7 @@ if ESX.GetConfig().Multichar then
Characters = data
local elements = {}
local Character = next(Characters)
exports.spawnmanager:forceRespawn()
if Character == nil then
SendNUIMessage({
@@ -259,7 +260,7 @@ if ESX.GetConfig().Multichar then
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(playerData, isNew, skin)
local spawn = playerData.coords
local spawn = playerData.coords or Config.Spawn
if isNew or not skin or #skin == 1 then
local finished = false
local sex = skin.sex or 0