Esx_skin menu is triggered after creating a new char - how to deactivate?

Hi,

i’m using cui_character, a custom character creator and it’s working fine but the game is triggering the Skin Menu from ESX right after i have created a new char.

If i just close the menu it will reset my skin to default.

I’ve have tried to uncomment the TriggerEvent but it seems to be required for spawning my char visible and with skin. If i uncomment the TriggerEvent, my char will remain invisible.

I’m pretty sure, esx_multichar is interpreting something wrong at this part of the client\main.lua

	RegisterNetEvent('esx:playerLoaded')
	AddEventHandler('esx:playerLoaded', function(playerData, isNew, skin)
		local spawn = playerData.coords or Config.Spawn
		if isNew or not skin or #skin == 1 then
			print("DEBUG: is new")
			local finished = false
			skin = Config.Default[playerData.sex]			
			skin.sex = playerData.sex == "m" and 0 or 1
			local model = skin.sex == 0 and mp_m_freemode_01 or mp_f_freemode_01
			RequestModel(model)
			while not HasModelLoaded(model) do
				RequestModel(model)
				Wait(0)
			end
			SetPlayerModel(PlayerId(), model)
			SetModelAsNoLongerNeeded(model)
			TriggerEvent('skinchanger:loadSkin', skin, function()
				local playerPed = PlayerPedId()
				SetPedAoBlobRendering(playerPed, true)
				ResetEntityAlpha(playerPed)
				TriggerEvent('esx_skin:openSaveableMenu', function()
					finished = true end, function() finished = true
				end)
			end)
			repeat Wait(200) until finished
		end

		SetCamActive(cam, false)
		RenderScriptCams(false, false, 0, true, true)
		cam = nil
		local playerPed = PlayerPedId()
		FreezeEntityPosition(playerPed, true)
		SetEntityCoordsNoOffset(playerPed, spawn.x, spawn.y, spawn.z, false, false, false, true)
		SetEntityHeading(playerPed, spawn.heading)
		if not isNew then TriggerEvent('skinchanger:loadSkin', skin or Characters[spawned].skin) 
		end
		Wait(400)
		print(isNew)
		DoScreenFadeIn(400)
		TriggerServerEvent('esx:onPlayerSpawn')
		TriggerEvent('esx:onPlayerSpawn')
		TriggerEvent('playerSpawned')
		TriggerEvent('esx:restoreLoadout')
		Characters, hidePlayers = {}, false
	end)

Please help :smiley:

Remove the TriggerEvent esx_skin:openSaveableMenu in your code this open the menu

Thank you @Tuncion again, but i have tried that before.

esx_skin:openSavableMenu is triggering something, that makes the char visible.
If i just uncomment the TriggerEvent at the esx_multichar\client\main.lua, my char remains invisible.

Do you have any idea how to fix this? maybe triggering something to make the char visible? i have tried to retrace the spawning process but it’s splitted over a couple scripts and i havent found anything that might shed light onto the whole process.

Thank you in advance

Anyone maybe a hint about the spawning process? the char is loaded but invisible.

This might be a dumb idea, but have you tried putting the TriggerEvent('esx_skin:openSaveableMenu', function() line before this: TriggerEvent('skinchanger:loadSkin', skin, function()?

not now because i dont want to have esx_skin open the menu. cui_character has already created the skin. My problem is that esx_skin got triggered even after cui_character has already created everything. so esx_skin is resetting the view. by commenting esx_skin:openSavableMenu out of the code, the char does not become visible until i relog

Could you send me the event handler for esx_skin:openSavableMenu?

Thank you for your help @itsdevsam

Here is the Event from the client.lua

RegisterNetEvent('esx_skin:openSaveableMenu')
AddEventHandler('esx_skin:openSaveableMenu', function(submitCb, cancelCb)
    if ESX.GetConfig().Multichar then
        ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
            if skin ~= nil then
                oldChar = skin
                LoadCharacter(skin, submitCb)
            end
        end)
    end
end)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.