From 3f904cbec4f28f3a93f26e8fd4a0628002c19836 Mon Sep 17 00:00:00 2001 From: Whereiam <84282589+WhereiamL@users.noreply.github.com> Date: Mon, 27 Jan 2025 22:32:17 +0100 Subject: [PATCH] Update character.lua Fixed a Black Screen Issue: Resolved an issue where players encountered a black screen when creating an identity with "starting apartments" enabled. --- client/character.lua | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/client/character.lua b/client/character.lua index 159c2243f..48029c417 100644 --- a/client/character.lua +++ b/client/character.lua @@ -116,6 +116,12 @@ if config.characters.limitNationalities then end) end +--- @param resourceName string The name of the resource to check. +--- @return boolean True if the resource is missing, false otherwise. +local function isResourceMissing(resourceName) + return GetResourceState(resourceName) == 'missing' +end + local function setupPreviewCam() DoScreenFadeIn(1000) SetTimecycleModifier('hud_def_blur') @@ -342,14 +348,19 @@ local function createCharacter(cid) cid = cid }) - if GetResourceState('qbx_spawn') == 'missing' then + if isResourceMissing('qbx_spawn') then spawnDefault() - else - if config.characters.startingApartment then - TriggerEvent('apartments:client:setupSpawnUI', newData) + return + end + + if config.characters.startingApartment then + if isResourceMissing('qbx_apartments') then + spawnDefault() else - TriggerEvent('qbx_core:client:spawnNoApartments') + TriggerEvent('apartments:client:setupSpawnUI', newData) end + else + TriggerEvent('qbx_core:client:spawnNoApartments') end destroyPreviewCam() @@ -517,4 +528,4 @@ CreateThread(function() break end end -end) \ No newline at end of file +end)