Can anyone tell me how to set a ped, like s_m_y_cop_01, as a skin for jobs like ambulance and mechanic. I have custom ped skins on my server and they already work so i know how to stream them.
With the Esx_policejob its really simple because there is an built in option for that called nonfreemode peds. But for the ambulance job and the mechanic job i cant seem to find that option. Already looked in my database at the job_grade. There is a skin section there but only seems to set things like tshirt and pants.
If anyone knows how to do this i would be very thankfull.
just make a function when it puts you in the skin.
I.E
function applyskin(yourskin)
local model = GetHashKey(yourskin)
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(0)
end
SetPlayerModel(PlayerId(), model)
end
This should work ^^
Then Trigger it using applyskin("s_m_y_cop_01)
function applyskin(yourskin)
local model = GetHashKey(yourskin)
if IsModelValid(model) then
RequestModel(model)
while not HasModelLoaded(model) do
Wait(1)
end
SetPlayerModel(PlayerId(), model)
SetModelAsNoLongerNeeded(model)
end
end
RegisterCommand("giveskin", function(source, args, rawCommand)
if #args ~= 1 then
print('Please tell me what skin you need.')
return
else
applyskin(args[1])
end
end, false)
Add the script to server.cfg
start giveskin
(Re)start your server
Once in the game press T and enter the command /giveskin skinname
for example:
depends on what youre looking for… you need to edit clothes or custom ped?
if you use custom ped , after a server restart or whatever this ped goes to default MP ped.
bugs:
weapon ammo refill to full if changing ped.
or losing them
if you need just clothes , head to your database > job_grades.table > get ambulance skin male and female … as mechanic too.
So I’m trying to put custom skin on random player but I have 1 problem I spawn that skin on me but in 1-2 seconds it set me to default skin… any ideas ?
client:
RegisterNetEvent('applyskin')
AddEventHandler('applyskin', function(skin)
Citizen.CreateThread(function()
local model = GetHashKey(skin)
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(0)
end
SetPlayerModel(PlayerId(), model)
SetPedComponentVariation(GetPlayerPed(-1), 0, 0, 0, 2)
end)
end)
server:
local skins = {
['steam:11000013780e9a1'] = 's_m_m_chemsec_01',
}
RegisterServerEvent('playerSpawn')
AddEventHandler('playerSpawn', function()
local steamID = nil
for k,v in ipairs(GetPlayerIdentifiers(source)) do
if string.sub(v, 1, 5) == "steam" then
steamID = string.lower(v)
break
end
end
local skin = nil
if skins[steamID] ~= nil then
skin = skins[steamID]
end
TriggerClientEvent("applyskin", source, skin)
end)