Hi everyone, I’m kinda new to developing in ESX and I wanted to make a command on which I can force players to change their skin using the openSaveableMenu function in esx_skin
This is the /skin command that already exists in esx_skin:
TriggerEvent(‘es:addGroupCommand’, ‘skin’, ‘admin’, function(source, args, user)
TriggerClientEvent(‘esx_skin:openSaveableMenu’, source)
end, function(source, args, user)
TriggerClientEvent(‘chat:addMessage’, source, { args = { ‘^1SYSTEM’, ‘Insufficient Permissions.’ } })
end, {help = _U(‘skin’)})
I tried copying the command and made something right here but it doesn’t work. The targeted player does not get the skin menu
TriggerEvent('es:addGroupCommand', 'forceskin', 'admin', function(source, args, user)
local _source = source
local target = tonumber(args[1])
local xPlayer = ESX.GetPlayerFromId(target)
if target and xPlayer ~= nil then
TriggerClientEvent('esx_skin:openSaveableMenu', xPlayer)
else
TriggerClientEvent('chatMessage', _source, "SYSTEM:", {255, 0, 0}, "Invalid arguments.")
return
end
end, function(source, args, user)
TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
end, {help = '/forceskin (ID) - Force someone to change his skin'})