From 0ec17f081ec652b4218cf9dddbd420f352e37f39 Mon Sep 17 00:00:00 2001 From: Linden Date: Mon, 2 Aug 2021 22:13:36 +1000 Subject: [PATCH] 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 --- client/main.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/main.lua b/client/main.lua index 242d159d..87dccc3e 100644 --- a/client/main.lua +++ b/client/main.lua @@ -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