[Release] Skin_customization V1.0

changing skin refreshes your weapons, check the script you can add a triggerevent when your skin updates to update whatever you want. i’m using the banking system with the html gui so you might want to try that

I have changed the menu to this to display English. May not be perfect.
heres the English client.lua file

skins = {
	{
		name = "mp_f_freemode_01",
		display = "Female"
	},
	{
		name = "mp_m_freemode_01",
		display = "Male"
	}
}

local isSpawnedInHospitalOnDeath = true

RegisterNetEvent("skin_customization:Customization")
RegisterNetEvent("skin_customization:OnDeath")

function InitMenu()
	ClearMenu()
	Menu.addTitle("Choose a skin");
   	Menu.addButton(skins[2].display, "SendSkin", skins[2].name);
	--Menu.addButton(skins[1].display, "SendSkin", skins[1].name);
end

function SendSkin(skin)
    TriggerServerEvent("skin_customization:ChoosenSkin",skin)
end

--Notification joueur
function Notify(text)
    SetNotificationTextEntry('STRING')
    AddTextComponentString(text)
    DrawNotification(false, false)
end

AddEventHandler("skin_customization:Customization",function(skin)
    ChangeSkin(skin,nil)
	--Notify("Skin chargé")
	InitDrawMenu()
end)

AddEventHandler("skin_customization:OnDeath",function()
	print("ondeath")
	if isSpawnedInHospitalOnDeath then
		SetEntityCoords(GetPlayerPed(-1), 295.83, -1446.94, 29.97, 1, 0, 0, 1) -- Hospital
		print("spawn")
	end
	TriggerServerEvent("skin_customization:SpawnPlayer")
end)

RegisterNetEvent("skin_customization:updateComponents")
AddEventHandler("skin_customization:updateComponents",function(args)
		ChangeComponent({0,0,args[1],args[2]})-- 1:componentID; 2: page; 3: drawbleID; 4: textureID
		ChangeComponent({2,0,args[3],args[4]})
		ChangeComponent({4,0,args[5],args[6]})
		ChangeComponent({6,0,args[7],args[8]})
		ChangeComponent({11,0,args[9],args[10]})
		ChangeComponent({8,0,args[11],args[12]})
		Notify("Skin components")
end)

function InitDrawMenu()
	ClearMenu()
	Menu.addButton("Face","DrawableChoice",{0,0})
	Menu.addButton("Hair","DrawableChoice",{2,0})
	Menu.addButton("Torso","DrawableChoice",{11,0})
	Menu.addButton("T-shirt","DrawableChoice",{8,0})
	Menu.addButton("Pants","DrawableChoice",{4,0})
	Menu.addButton("Shoes","DrawableChoice",{6,0})
end

function DrawableChoice(args)
	ClearMenu()
	local max = GetNumberOfPedDrawableVariations(GetPlayerPed(-1), args[1])

	if max > (args[2]+1)*8 then
		max = (args[2]+1)*8
	end
	if args[2] > 0 then
		Menu.addButton("Previous Page","DrawableChoice",{args[1],args[2]-1})
	end
	for i = args[2]*8,max-1 do				
		Menu.addButton("Draw: "..i,"TextureChoice",{args[1],0,i})
	end
	if max <= (args[2]+1)*8 then
		Menu.addButton("Next Page","DrawableChoice",{args[1],args[2]+1})
	end
	Menu.addButton("Return","InitDrawMenu","")
end

function TextureChoice(args)
	ClearMenu()
	local max = GetNumberOfPedTextureVariations(GetPlayerPed(-1),args[1],args[3])
	if max > (args[2]+1)*8 then
		max = (args[2]+1)*8
	end
	if args[2] > 0 then
		Menu.addButton("Previous page","TextureChoice",{args[1],args[2]-1,args[3]})
	end
	for i = args[2]*8,max-1 do
		if IsPedComponentVariationValid(GetPlayerPed(-1), args[1], args[3], i) then
			Menu.addButton("Text: "..i,"ChangeComponent",{args[1],args[2],args[3],i})
		end
	end
	if max <= (args[2]+1)*8 then
		Menu.addButton("Next page","TextureChoice",{args[1],args[2]+1,args[3]})
	end
	Menu.addButton("Return","DrawableChoice",args)
end

function ChangeComponent(args)-- 1:componentID; 2: page; 3: drawbleID; 4: textureID
	SetPedComponentVariation(GetPlayerPed(-1), args[1], args[3], args[4], 2)
	TriggerServerEvent("skin_customization:SaveComponents",args)
end
AddEventHandler('onPlayerDied', function(playerId, reason, position)
	print("ondeath")
	if isSpawnedInHospitalOnDeath then
		SetEntityCoords(GetPlayerPed(-1), 295.83, -1446.94, 29.97, 1, 0, 0, 1) -- Hospital
		print("spawn")
	end
	TriggerServerEvent("skin_customization:SpawnPlayer")
end)

--Action lors du spawn du joueur
local firstspawn = 0
AddEventHandler('playerSpawned', function(spawn)
--On verifie que c'est bien le premier spawn du joueur
if firstspawn == 0 then
	TriggerServerEvent("skin_customization:SpawnPlayer")
	firstspawn = 1
end
end)

function ChangeSkin(skin,components)
	--Menu.hidden = true
	-- Get model hash.
	local modelhashed = GetHashKey(skin)

    
    -- Request the model, and wait further triggering untill fully loaded.
	RequestModel(modelhashed)
	while not HasModelLoaded(modelhashed) do 
	    RequestModel(modelhashed)
	    Citizen.Wait(0)
	end
    -- Set playermodel.
	SetPlayerModel(PlayerId(), modelhashed)

	if components == nil then
		local playerPed = GetPlayerPed(-1)
	 	--SET_PED_COMPONENT_VARIATION(Ped ped, int componentId, int drawableId, int textureId, int paletteId)
		 --SetPedComponentVariation(playerPed, 0, 0, 0, 2) --Face
		 --SetPedComponentVariation(playerPed, 2, 11, 4, 2) --Hair 
		 --SetPedComponentVariation(playerPed, 4, 1, 5, 2) -- Pantalon
		 --SetPedComponentVariation(playerPed, 6, 1, 0, 2) -- Shoes
		 --SetPedComponentVariation(playerPed, 11, 7, 2, 2) -- Jacket
		 TriggerServerEvent("skin_customization:ChoosenComponents")
	end
	local a = "" -- nil doesnt work
	 TriggerServerEvent("weaponshop:playerSpawned",a)
	 TriggerServerEvent("item:getItems")
	SetModelAsNoLongerNeeded(modelhashed)
end

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)
		if IsControlJustPressed(1, 289) then -- INPUT_CELLPHONE_DOWN
			InitMenu()                       
			Menu.hidden = not Menu.hidden    
		end
		Menu.renderGUI()
	end
end)
2 Likes

thanks for your script?
but i need help,
i want the id of DOCTOR and YELLOW VEST for my script

you gotta search for them by testing them all

lol serious man check policejob v1.0.1 he say thanks to creator for give the id of police skin so it’s nice if he can give me what i need

dude i gave him the id because i needed them, how did i get them ? I **** SEARCHED THEM, going through them one by one. Now i gave you a way to do it, don’t expect more from me.

ok sorry for bother you

i need to use menu or i can use openIV http://gtaforums.com/topic/808513-changing-ped-clothes-and-attaching-props-to-ped-via-scripts/

is possible to use ES CUSTOMISATION with Skin_Custo active ? or it will create a conflict?

theese scripts are supposed to do the same thing so it could not work. I don’t think it would be usefull to have both

1 Like

salut merci pour le script .
j’ai une petite question quand j’appuie sur F2 j’ai le menu qui s’affiche mais j’ai que le Homme est le skin femme s’affiche pas.
est j’ai marqué que draw est texte sur le menu si vous avais une solution merci !

Hi thanks for the script.
I have a small question I have when I press F2 I have the menu that appears but I have that Man is the skin woman is not displayed.
Is I marked that draw is text on the menu if you had a solution thank you!

only male skin is working right now

Ok thank you, is for the menu one can change the draw and text? For clothing

Sorry for my english and thanks for the help

i probably don’t get the question but that’s what it is supposed to do yes

How can i make a black man ?

I think it’s the upper most option, you just need to go through the options one by one.

I Think that it could be a good option for those who want to have a Clothes Shop and a visualisation of their skin.

I tried to run both of the scripts, but I don’t achieve the save in the DB ( i add the miss DB column, change the DB info in es_custom.etc…) . Dunno Why it doesnt work :(.

Worked on it for 4 Hours… Don’t find a solution yet.

idk es_customization didnt save skins for me too

1 Like

Hello there !
is exist a list of all skin that you can use in the plugin ?
I fno, does someone know how to build EMS skin ?
ty

es_Customization save skin in the DB for me, but for now i’m unable to load it under Freeroam. But in “client.lua” in freeroam, we can make something like:

IF identifier = Null (in es_custom ‘Outfits’ table) do [1st spawn skin preset] else [Use info from ‘outfits’ table]
(sorry i’m clearly not a coder ^^)

Oh, and es_customization is not complete. In exemple, many torso (ID:3) are missing. And if you change your torso, you only have arms with gloves…

PS. i used skin_customization, but the lack of preview added to the unergonomic menu drive me crazy :confused: .