Hello I wanted to ask if someone can help me creating an command that opens an menu where all outfits that are saved are listed. I already tried to code one myself but I failed pls tell me why.
client.lua:
ESX = nill
Citizen.CreateThread(function()
TriggerEvent('chat:addSuggestion', '/command', 'Description')
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
RegisterCommand("outfits",
function(source, args, rawCommand)
print(source)
ESX.TriggerServerCallback('esx_property:getPlayerDressing', function(dressing)
local elements = {}
for i=1, #dressing, 1 do
table.insert(elements, {
label = dressing[i],
value = i
})
end
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'player_dressing', {
title = property.label .. ' - ' .. _U('player_clothes'),
align = 'top-left',
elements = elements
}, function(data2, menu2)
TriggerEvent('skinchanger:getSkin', function(skin)
ESX.TriggerServerCallback('esx_property:getPlayerOutfit', function(clothes)
TriggerEvent('skinchanger:loadClothes', skin, clothes)
TriggerEvent('esx_skin:setLastSkin', skin)
TriggerEvent('skinchanger:getSkin', function(skin)
TriggerServerEvent('esx_skin:save', skin)
end)
end, data2.current.value)
end)
end, function(data2, menu2)
menu2.close()
end)
end)
-- else
-- print("This command was executed by the server console, RCON client, or a resource.")
-- end,
false)
__resource.lua:
resource_manifest_version "44febabe-d386-4d18-afbe-5e627f4af937"
client_scripts {
'client.lua'
}
shared_script '@es_extended/imports.lua'
I think im just stupid but if someone can help me it would be great.
Thanks