I am using the CreatePed function to spawn peds into the server and stand in one position, is it possible to select which outfit each ped spawns in with?
Thanks!
I am using the CreatePed function to spawn peds into the server and stand in one position, is it possible to select which outfit each ped spawns in with?
Thanks!
You could set their playermodel with (list here):
Citizen.CreateThread(function()
local model = GetHashKey(currentskin)
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(0)
end
SetPlayerModel(PlayerId(), model)
end)
Or set their clothes like so (more info here):
Citizen.CreateThread(function()
local playerPed = GetPlayerPed(-1)
local characterModel = GetHashKey('mp_m_freemode_01')
RequestModel(characterModel)
while not HasModelLoaded(characterModel) do
RequestModel(characterModel)
Citizen.Wait(1)
end
SetPlayerModel(PlayerId(), characterModel)
SetPedDefaultComponentVariation(playerPed)
SetModelAsNoLongerNeeded(characterModel)
SetPedComponentVariation(GetPlayerPed(-1), category, i1, i2, 2)
end)
Do you know if this would work with AI models? I am spawning in models with the CreatePed() function, but they keep spawning in with random stuff on?
https://runtime.fivem.net/doc/reference.html#_0xD49F9B0955C367DE
CreatePed(int pedType, Hash modelHash, float x, float y, float z, float heading, BOOL isNetwork, BOOL thisScriptCheck)
From this I would do
local skin = 'a_f_m_soucentmc_01'
local pedtype = ?????
Citizen.CreateThread(function()
local model = GetHashKey(skin)
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(0)
end
CreatePed(pedtype, model, x, y, z, 0.0, true, true)
end)