[Release] [ESX] clothesmerfik | put on/take off your clothes

How do i make it so if i type the command again it puts on/takes off the shirt/pants/shoes without having to put on all the clothes at once

nice give me please

Not Sure If anyone wants it but ive put some code together, so you can take your hat and glasses off with [F10] menu and / commands, ive made some of the code in English, working with male & female skins, did try coding it with mask but had no luck (only got it to take off the mask and couldn’t make it put the mask back on)

ESX                     = nil

Citizen.CreateThread(function()
  while ESX == nil do
    TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
    Citizen.Wait(0)
  end
end)

RegisterNetEvent('smerfikubrania:koszulka')
AddEventHandler('smerfikubrania:koszulka', function()
	TriggerEvent('skinchanger:getSkin', function(skin)
		
		local clothesSkin = {
		['tshirt_1'] = 15, ['tshirt_2'] = 0,
		['torso_1'] = 15, ['torso_2'] = 0,
		['arms'] = 15, ['arms_2'] = 0
		}
		TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
	end)
end)

RegisterNetEvent('smerfikubrania:spodnie')
AddEventHandler('smerfikubrania:spodnie', function()
	TriggerEvent('skinchanger:getSkin', function(skin)

if skin.sex == 0 then
		local clothesSkin = {
		['pants_1'] = 21, ['pants_2'] = 0
		}
		TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
else
		local clothesSkin = {
		['pants_1'] = 15, ['pants_2'] = 0
		}
		TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
end
	end)
end)

RegisterNetEvent('smerfikubrania:buty')
AddEventHandler('smerfikubrania:buty', function()
	TriggerEvent('skinchanger:getSkin', function(skin)
	
if skin.sex == 0 then
		local clothesSkin = {
		['shoes_1'] = 34, ['shoes_2'] = 0
		}
		TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
else
		local clothesSkin = {
		['shoes_1'] = 35, ['shoes_2'] = 0
		}
		TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
end
	end)
end)

RegisterNetEvent('smerfikubrania:Kask')
AddEventHandler('smerfikubrania:Kask', function()
	TriggerEvent('skinchanger:getSkin', function(skin)
	
if skin.sex == 0 then
		local clothesSkin = {
		['helmet_1'] = -1, ['helmet_2'] = 0
		}
		TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
else
		local clothesSkin = {
		['helmet_1'] = -1, ['helmet_2'] = 0
		}
		TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
end
	end)
end)

RegisterNetEvent('smerfikubrania:Okulary')
AddEventHandler('smerfikubrania:Okulary', function()
	TriggerEvent('skinchanger:getSkin', function(skin)
	
if skin.sex == 0 then
		local clothesSkin = {
		['glasses_1'] = 0, ['glasses_2'] = 0
		}
		TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
else
		local clothesSkin = {
		['glasses_1'] = 5, ['glasses_2'] = 0
		}
		TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
end
	end)
end)

function OpenActionMenuInteraction(target)
	local elements = {}
	table.insert(elements, {label = ('To Put Clothes'), value = 'ubie'})
	table.insert(elements, {label = ('To Takeoff Shirt'), value = 'tul'})
	table.insert(elements, {label = ('To Takeoff Pants'), value = 'spo'})
	table.insert(elements, {label = ('To Takeoff Shoes'), value = 'but'})
	table.insert(elements, {label = ('To Takeoff Helmet'), value = 'one'})
	table.insert(elements, {label = ('To Takeoff Glasses'), value = 'two'})
  		ESX.UI.Menu.CloseAll()	


	ESX.UI.Menu.Open(
		'default', GetCurrentResourceName(), 'action_menu',
		{
			title    = ('Clothes'),
			align    = 'top-left',
			elements = elements
		},
    function(data, menu)

		if data.current.value == 'ubie' then			
		ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
		TriggerEvent('skinchanger:loadSkin', skin)
		end)
		ESX.UI.Menu.CloseAll()	
		elseif data.current.value == 'tul' then
		TriggerEvent('smerfikubrania:koszulka')
		ESX.UI.Menu.CloseAll()	
		elseif data.current.value == 'spo' then
		TriggerEvent('smerfikubrania:spodnie')
		ESX.UI.Menu.CloseAll()	
		elseif data.current.value == 'but' then
		TriggerEvent('smerfikubrania:buty')
		ESX.UI.Menu.CloseAll()	
	    elseif data.current.value == 'one' then
		TriggerEvent('smerfikubrania:Kask')
		ESX.UI.Menu.CloseAll()
	    elseif data.current.value == 'two' then
		TriggerEvent('smerfikubrania:Okulary')
		ESX.UI.Menu.CloseAll()
	  end
	end)
end
		
Citizen.CreateThread(function()
  while true do
    Citizen.Wait(0)
    if IsControlJustReleased(0, 56) and not ESX.UI.Menu.IsOpen('default', GetCurrentResourceName(), 'action_menu') then
		OpenActionMenuInteraction()
    end
  end
end)

RegisterCommand("shirt", function()
	TriggerEvent('skinchanger:getSkin', function(skin)
		local clothesSkin = {
		['tshirt_1'] = 15, ['tshirt_2'] = 0,
		['torso_1'] = 15, ['torso_2'] = 0,
		['arms'] = 15, ['arms_2'] = 0
		}
		TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
	end)
end)

RegisterCommand("pants", function()
	TriggerEvent('skinchanger:getSkin', function(skin)
		if skin.sex == 0 then
		    local clothesSkin = {
			['pants_1'] = 21, ['pants_2'] = 0
			}
			TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
	    else
			local clothesSkin = {
			['pants_1'] = 15, ['pants_2'] = 0
			}
			TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
	    end
	end)
end)

RegisterCommand("shoes", function()
	TriggerEvent('skinchanger:getSkin', function(skin)
		if skin.sex == 0 then
			local clothesSkin = {
			['shoes_1'] = 34, ['shoes_2'] = 0
			}
			TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
		else
			local clothesSkin = {
			['shoes_1'] = 35, ['shoes_2'] = 0
			}
			TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
	    end
	end)
end)

RegisterCommand("helmet", function()
	TriggerEvent('skinchanger:getSkin', function(skin)
		if skin.sex == 0 then
			local clothesSkin = {
			['helmet_1'] = -1, ['helmet_2'] = 0
			}
			TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
	    else
			local clothesSkin = {
			['helmet_1'] = -1, ['helmet_2'] = 0
			}
			TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
	    end
	end)
end)

RegisterCommand("glasses", function()
	TriggerEvent('skinchanger:getSkin', function(skin)
		if skin.sex == 0 then
			local clothesSkin = {
			['glasses_1'] = 0, ['glasses_2'] = 0
			}
			TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
	    else
			local clothesSkin = {
			['glasses_1'] = 5, ['glasses_2'] = 0
			}
			TriggerEvent('skinchanger:loadClothes', skin, clothesSkin)
	    end
	end)
end)

RegisterCommand("cloths", function()
	ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
		TriggerEvent('skinchanger:loadSkin', skin)
	end)
end)
1 Like

thanks to everyone who made something new to this resource.

can some one help me i have a meny to but on and off helmets and stuff and i wanted to bake that functions frome this scritp to it looks like this

ESX = nil
local HasAlreadyEnteredMarker = false
local LastZone = nil
local CurrentAction = nil
local CurrentActionMsg = ‘’
local CurrentActionData = {}
local isDead = false

Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent(‘esx:getSharedObject’, function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)

function OpenAccessoryMenu()
ESX.UI.Menu.Open(‘default’, GetCurrentResourceName(), ‘set_unset_accessory’,
{
title = _U(‘set_unset’),
align = ‘top-left’,
elements = {
{label = _U(‘helmet’), value = ‘Helmet’},
{label = _U(‘ears’), value = ‘Ears’},
{label = _U(‘mask’), value = ‘Mask’},
{label = _U(‘glasses’), value = ‘Glasses’},

	}
}, function(data, menu)
	menu.close()
	SetUnsetAccessory(data.current.value)

end, function(data, menu)
	menu.close()
end)

end

function SetUnsetAccessory(accessory)
ESX.TriggerServerCallback(‘esx_accessories:get’, function(hasAccessory, accessorySkin)
local _accessory = string.lower(accessory)

	if hasAccessory then
		TriggerEvent('skinchanger:getSkin', function(skin)
			local mAccessory = -1
			local mColor = 0
			if _accessory == "mask" then
				mAccessory = 0
			end
			if skin[_accessory .. '_1'] == mAccessory then
				mAccessory = accessorySkin[_accessory .. '_1']
				mColor = accessorySkin[_accessory .. '_2']
			end
			local accessorySkin = {}
			accessorySkin[_accessory .. '_1'] = mAccessory
			accessorySkin[_accessory .. '_2'] = mColor
			TriggerEvent('skinchanger:loadClothes', skin, accessorySkin)
		end)
	else
		ESX.ShowNotification(_U('no_' .. _accessory))
	end

end, accessory)

end

function OpenShopMenu(accessory)
local _accessory = string.lower(accessory)
local restrict = {}

restrict = { _accessory .. '_1', _accessory .. '_2' }

TriggerEvent('esx_skin:openRestrictedMenu', function(data, menu)

	menu.close()

	ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'shop_confirm',
	{
		title = _U('valid_purchase'),
		align = 'top-left',
		elements = {
			{label = _U('no'), value = 'no'},
			{label = _U('yes', Config.Price), value = 'yes'}
		}
	}, function(data, menu)
		menu.close()
		if data.current.value == 'yes' then
			ESX.TriggerServerCallback('esx_accessories:checkMoney', function(hasEnoughMoney)
				if hasEnoughMoney then
					TriggerServerEvent('esx_accessories:pay')
					TriggerEvent('skinchanger:getSkin', function(skin)
						TriggerServerEvent('esx_accessories:save', skin, accessory)
					end)
				else
					TriggerEvent('esx_skin:getLastSkin', function(skin)
						TriggerEvent('skinchanger:loadSkin', skin)
					end)
					ESX.ShowNotification(_U('not_enough_money'))
				end
			end)
		end

		if data.current.value == 'no' then
			local player = GetPlayerPed(-1)
			TriggerEvent('esx_skin:getLastSkin', function(skin)
				TriggerEvent('skinchanger:loadSkin', skin)
			end)
			if accessory == "Ears" then
				ClearPedProp(player, 2)
			elseif accessory == "Mask" then
				SetPedComponentVariation(player, 1, 0 ,0 ,2)
			elseif accessory == "Helmet" then
				ClearPedProp(player, 0)
			elseif accessory == "Glasses" then
				SetPedPropIndex(player, 1, -1, 0, 0)
				
			end
		end
		CurrentAction     = 'shop_menu'
		CurrentActionMsg  = _U('press_access')
		CurrentActionData = {}
	end, function(data, menu)
		menu.close()
		CurrentAction     = 'shop_menu'
		CurrentActionMsg  = _U('press_access')
		CurrentActionData = {}

	end)
end, function(data, menu)
	menu.close()
	CurrentAction     = 'shop_menu'
	CurrentActionMsg  = _U('press_access')
	CurrentActionData = {}
end, restrict)

end

AddEventHandler(‘playerSpawned’, function()
isDead = false
end)

AddEventHandler(‘esx:onPlayerDeath’, function()
isDead = true
end)

AddEventHandler(‘esx_accessories:hasEnteredMarker’, function(zone)
CurrentAction = ‘shop_menu’
CurrentActionMsg = _U(‘press_access’)
CurrentActionData = { accessory = zone }
end)

AddEventHandler(‘esx_accessories:hasExitedMarker’, function(zone)
ESX.UI.Menu.CloseAll()
CurrentAction = nil
end)

– Create Blips –
Citizen.CreateThread(function()
for k,v in pairs(Config.ShopsBlips) do
if v.Pos ~= nil then
for i=1, #v.Pos, 1 do
local blip = AddBlipForCoord(v.Pos[i].x, v.Pos[i].y, v.Pos[i].z)

			SetBlipSprite (blip, v.Blip.sprite)
			SetBlipDisplay(blip, 4)
			SetBlipScale  (blip, 1.0)
			SetBlipColour (blip, v.Blip.color)
			SetBlipAsShortRange(blip, true)

			BeginTextCommandSetBlipName("STRING")
			AddTextComponentString(_U('shop', _U(string.lower(k))))
			EndTextCommandSetBlipName(blip)
		end
	end
end

end)

– Display markers
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local coords = GetEntityCoords(GetPlayerPed(-1))
for k,v in pairs(Config.Zones) do
for i = 1, #v.Pos, 1 do
if(Config.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos[i].x, v.Pos[i].y, v.Pos[i].z, true) < Config.DrawDistance) then
DrawMarker(Config.Type, v.Pos[i].x, v.Pos[i].y, v.Pos[i].z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.Size.x, Config.Size.y, Config.Size.z, Config.Color.r, Config.Color.g, Config.Color.b, 100, false, true, 2, false, false, false, false)
end
end
end
end
end)

Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
local coords = GetEntityCoords(GetPlayerPed(-1))
local isInMarker = false
local currentZone = nil
for k,v in pairs(Config.Zones) do
for i = 1, #v.Pos, 1 do
if(GetDistanceBetweenCoords(coords, v.Pos[i].x, v.Pos[i].y, v.Pos[i].z, true) < Config.Size.x) then
isInMarker = true
currentZone = k
end
end
end

	if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then
		HasAlreadyEnteredMarker = true
		LastZone = currentZone
		TriggerEvent('esx_accessories:hasEnteredMarker', currentZone)
	end

	if not isInMarker and HasAlreadyEnteredMarker then
		HasAlreadyEnteredMarker = false
		TriggerEvent('esx_accessories:hasExitedMarker', LastZone)
	end

end

end)

– Key controls
Citizen.CreateThread(function()
while true do
Citizen.Wait(10)

	if CurrentAction ~= nil then

		ESX.ShowHelpNotification(CurrentActionMsg)

		if IsControlJustReleased(0, Keys['E']) and CurrentActionData.accessory then
			OpenShopMenu(CurrentActionData.accessory)
			CurrentAction = nil
		end

	elseif CurrentAction == nil and not Config.EnableControls then
		Citizen.Wait(500)
	end

	if Config.EnableControls then
		if IsControlJustReleased(0, Keys['K']) and GetLastInputMethod(2) and not isDead then
			OpenAccessoryMenu()
		end
	end

end

end)

anyone have a VRP script to take clothes off?

How can you change the open menu key ?

IsControlJustReleased(0, 56) change this

Having clothes in inventory and changing them would be really great.
Is it even possible at FiveM?

yea it is, but you would have to define all clothes as items

So it’s possible, just no one does? I have seen this function in other places and I really like it.

indeed

If you want to delete keybinds, delete this (057):

Thanks man, i’ll try to make the masks work, if I can I share it here.
Nice script

I have been seen your code and then I have been try this on my site of https://xxxtentacionmerch.net/ but it was not working on this and also try this inheritance - C# Clothing System for Character - Stack Overflow and their repective code as

public class Clothing
{
    public EClothingBind[] Types;
    public int ID;
    public int Priority;
    public bool HidesUnderlying;
    public AnimatedSpriteMap Graphic;
    public Color Blend = Color.White;

    public virtual void Update(GameTime gameTime) 
    {
        Graphic.Update(gameTime);
    }

    public virtual void Draw(Vector2 position)
    {
        Graphic.Tint = Blend;
        Graphic.Draw(position);
    }
}

public interface IClothingHead { ... }
public interface IClothingChest { ... }
public interface IClothingLegs { ... }
public interface IClothingFeet { ... }

then its works properly.

Thank u for this simple Script :slight_smile: i`ve made a Scuba Gear Menu with it. <3
I have looked for serveral Hours to find a way for Scuba Gear. Without an Admin Spawner.

Feel free to Download!

mdiving.rar (1.1 KB)

good script