Okay finished, I’ll try my best to explain
Instead of making a whole new resource, I edited the code within esx_police
I created a locker room function example:
function OpenLockerMenu()
local playerPed = PlayerPedId()
local grade = PlayerData.job.grade_name
local elements = {}
for name, list in pairs(categoryOutfits) do
for id, outfit in pairs(list) do
print('Outfit: ', outfit)
table.insert(elements, {
label = (id),
label_real = outfit
})
end
end
ESX.UI.Menu.CloseAll()
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'locker', {
title = _U('locker'),
align = 'top-right',
elements = elements
}, function(data, menu)
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'locker_confirm', {
title = _U('locker_confirm', data.id),
align = 'top-right',
elements = {
{label = _U('confirm_no'), value = 'confirm_no'},
{label = _U('confirm_yes'), value = 'confirm_yes'}
}
}, function(data2, menu2)
if data2.current.value == 'confirm_yes' then
setEupOutfit(data.current.label_real)
end
menu2.close()
end, function(data2, menu2)
menu2.close()
end)
end, function(data, menu)
menu.close()
CurrentAction = 'locker_menu'
CurrentActionMsg = _U('open_locker')
CurrentActionData = {}
end)
end
-
Local playerPed and local grade are there cause I will be adding a check for job to make sure only police can access this
-
as you see the “for - do” loop checks all available categoryOutfits and puts them table.
then it’s simply confirming select outfit and calling this next function,
function setEupOutfit(outfit)
local ped = PlayerPedId()
RequestModel(outfit.ped)
while not HasModelLoaded(outfit.ped) do
Wait(0)
end
if GetEntityModel(ped) ~= GetHashKey(outfit.ped) then
SetPlayerModel(PlayerId(), outfit.ped)
end
ped = PlayerPedId()
for _, comp in ipairs(outfit.components) do
SetPedComponentVariation(ped, comp[1], comp[2] - 1, comp[3] - 1, 0)
end
for _, comp in ipairs(outfit.props) do
if comp[2] == 0 then
ClearPedProp(ped, comp[1])
else
SetPedPropIndex(ped, comp[1], comp[2] - 1, comp[3] - 1, true)
end
end
end
this function is copied from EUP_UI
just grabs the selected model and apply it to the player ped
inside the police config lua I added our server custom EUP outfits in this format
['Title of clothing'] = {
category = 'Category',
ped = 'mp_f_freemode_01', <-- import this is the ped
props = {
{ 0, 0, 0 },
{ 1, 0, 0 },
{ 2, 0, 0 },
{ 3, 0, 0 },
},
components = {
{ 1, 1, 1 },
{ 3, 15, 1 },
{ 4, 42, 3 },
{ 5, 49, 1 },
{ 6, 53, 1 },
{ 7, 9, 1 },
{ 8, 32, 2 },
{ 9, 1, 1 },
{ 10, 1, 1 },
{ 11, 26, 1 },
},
},
As you can see this format is different then the actual default one in the Police Config, which is why your code wasn’t working. I hope this helps