Skip to content

Update character.lua #665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions client/character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if resource is stopped , uninitialized or any other state, would be better just ~= 'started'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also no real need to make that a function

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if resource is stopped , uninitialized or any other state, would be better just ~= 'started'

Even better I did not check that qbx_apartments is achieved

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also no real need to make that a function

It's user friendly for people who don't know a lot, and as u can see on the discord there are multiple people with the black screen issue

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isResourceMissing(qbx_spawn) says the exact same thing as GetResourceState('qbx_spawn') == 'missing'. It's unneeded

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind, but I think since we're already using GetResourceState with its method in the same file, we should just continue using it so GetResourceState('qbx_spawn'):find('start') would be better.

end

local function setupPreviewCam()
DoScreenFadeIn(1000)
SetTimecycleModifier('hud_def_blur')
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -517,4 +528,4 @@ CreateThread(function()
break
end
end
end)
end)
Loading