Skip to content
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

feat(client): Display player's first character ped... #596

Merged
merged 10 commits into from
Dec 18, 2024
9 changes: 6 additions & 3 deletions client/character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ local function createCharacter(cid)
end

local function chooseCharacter()
---@type PlayerEntity[], integer
local characters, amount = lib.callback.await('qbx_core:server:getCharacters')
local firstCharacterCitizenId = characters[1] and characters[1].citizenid
previewPed(firstCharacterCitizenId)

randomLocation = config.characters.locations[math.random(1, #config.characters.locations)]
SetFollowPedCamViewMode(2)
DisplayRadar(false)
Expand All @@ -379,8 +384,6 @@ local function chooseCharacter()
ShutdownLoadingScreenNui()
setupPreviewCam()

---@type PlayerEntity[], integer
local characters, amount = lib.callback.await('qbx_core:server:getCharacters')
local options = {}
for i = 1, amount do
local character = characters[i]
Expand Down Expand Up @@ -410,6 +413,7 @@ local function chooseCharacter()
local success = createCharacter(i)
if success then return end

previewPed(firstCharacterCitizenId)
lib.showContext('qbx_core_multichar_characters')
end
end
Expand Down Expand Up @@ -505,7 +509,6 @@ CreateThread(function()
if NetworkIsSessionStarted() then
pcall(function() exports.spawnmanager:setAutoSpawn(false) end)
Wait(250)
randomPed()
chooseCharacter()
break
end
Expand Down
Loading