Skip to content

Commit

Permalink
refactor: (esx_multicharacter\client\main.lua)♻️spawnmanagere revert
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Mar 25, 2024
1 parent 29cd6f1 commit 74b5ea5
Showing 1 changed file with 13 additions and 33 deletions.
46 changes: 13 additions & 33 deletions server-data/resources/[esx]/esx_multicharacter/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,14 @@ if ESX.GetConfig().Multichar then

SetupCharacter = function(index)
if not spawned then
exports.spawnmanager:spawnPlayer({
x = SpawnCoords.x,
y = SpawnCoords.y,
z = SpawnCoords.z,
heading = SpawnCoords.w,
model = Characters[index].model or mp_m_freemode_01,
skipFade = true,
}, function()
local skin = Characters[index] and Characters[index].skin or Characters[index] and Config.Default

if Characters[index] and not Characters[index].model then
skin.sex = Characters[index].sex == TranslateCap('female') and 1 or 0
end

ESX.SpawnPlayer(skin, {x = SpawnCoords.x, y = SpawnCoords.y, z = SpawnCoords.z}, function()
canRelog = false
if Characters[index] then
local skin = Characters[index].skin or Config.Default
if not Characters[index].model then
if Characters[index].sex == TranslateCap("female") then
skin.sex = 1
else
skin.sex = 0
end
end
TriggerEvent("skinchanger:loadSkin", skin)
end
DoScreenFadeIn(600)
end)
repeat
Expand Down Expand Up @@ -255,28 +243,20 @@ if ESX.GetConfig().Multichar then
Characters = data
slots = slots
local Character = next(Characters)
exports.spawnmanager:forceRespawn()

if not Character then
SendNUIMessage({
action = "closeui",
})
exports.spawnmanager:spawnPlayer({
x = SpawnCoords.x,
y = SpawnCoords.y,
z = SpawnCoords.z,
heading = SpawnCoords.w,
model = mp_m_freemode_01,
skipFade = true,
}, function()
ESX.SpawnPlayer({model = mp_m_freemode_01}, {x = SpawnCoords.x, y = SpawnCoords.y, z = SpawnCoords.z}, function()
canRelog = false
DoScreenFadeIn(400)
Wait(400)
local playerPed = PlayerPedId()
SetPedAoBlobRendering(playerPed, false)
SetEntityAlpha(playerPed, 0)
TriggerServerEvent("esx_multicharacter:CharacterChosen", 1, true)
TriggerEvent("esx_identity:showRegisterIdentity")
local ped = PlayerPedId()
SetPedAoBlobRendering(ped, false)
SetEntityAlpha(ped, 0)
TriggerServerEvent('esx_multicharacter:CharacterChosen', 1, true)
TriggerEvent('esx_identity:showRegisterIdentity')
end)
else
SelectCharacterMenu(Characters, slots)
Expand Down

0 comments on commit 74b5ea5

Please sign in to comment.