Skip to content

Commit

Permalink
fix(client/character): showing non-default ped in char selection (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
Manason committed Oct 9, 2023
1 parent 31ae4ab commit 70a2cab
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions client/character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,16 @@ local function randomClothes(entity)
end

---@param citizenId? string
---@param gender? integer
local function previewPed(citizenId, gender)
local function previewPed(citizenId)
if not citizenId then
randomClothes(cache.ped)
return
end

local clothing, model = lib.callback.await('qbx_core:server:getPreviewPedData', false, citizenId)

if model then
local currentModel = GetEntityModel(cache.ped)
if (currentModel ~= `mp_m_freemode_01` and gender == 0) or (currentModel ~= `mp_f_freemode_01` and gender == 1) then
lib.requestModel(model)
SetPlayerModel(cache.playerId, model)
end
lib.requestModel(model)
SetPlayerModel(cache.playerId, model)
SetModelAsNoLongerNeeded(model)
end

Expand Down Expand Up @@ -294,7 +289,7 @@ local function chooseCharacter()
onSelect = function()
if character then
lib.showContext('qbx_core_multichar_character_'..i)
previewPed(character.citizenid, character.charinfo.gender)
previewPed(character.citizenid)
else
local success = createCharacter(i)
if success then return end
Expand Down

0 comments on commit 70a2cab

Please sign in to comment.