Skip to content

Commit

Permalink
Merge pull request #47 from Tinky124/patch-1
Browse files Browse the repository at this point in the history
fix: Character invisible to user upon registration
wasabirobby authored Dec 3, 2022
2 parents 8738800 + ef0eaf6 commit 521f66b
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions client/client.lua
Original file line number Diff line number Diff line change
@@ -288,6 +288,43 @@ AddEventHandler('skinchanger:loadSkin', function(skin, cb)
end
end)

AddEventHandler('skinchanger:loadDefaultModel', function(loadMale, cb)
LoadDefaultModel(loadMale, cb)
end)

function LoadDefaultModel(malePed, cb)
local playerPed = PlayerPedId()
local characterModel

if malePed then
characterModel = `mp_m_freemode_01`
else
characterModel = `mp_f_freemode_01`
end

RequestModel(characterModel)

CreateThread(function()
while not HasModelLoaded(characterModel) do
RequestModel(characterModel)
Wait(0)
end

if IsModelInCdimage(characterModel) and IsModelValid(characterModel) then
SetPlayerModel(PlayerId(), characterModel)
SetPedDefaultComponentVariation(playerPed)
end

SetModelAsNoLongerNeeded(characterModel)

if cb ~= nil then
cb()
end

TriggerEvent('skinchanger:modelLoaded')
end)
end


RegisterNetEvent('skinchanger:loadClothes')
AddEventHandler('skinchanger:loadClothes', function(skin, clothes)

0 comments on commit 521f66b

Please sign in to comment.