Im very confused. Simply returns 0 regardless of what the player is wearing with any drawableId passed…
They return just fine for me?
print(GetPedDrawableVariation(PlayerPedId(), 6))
print(GetPedTextureVariation(PlayerPedId(), 6))
For my freemode ped this^ returns 31 and 2 respectively. Maybe you used the natives the the wrong way?
Without any example of your code it is impossible to help you.
I would imagine the problem lies in the following code for loading the player model and setting the player to it…
I cant seem to find the issue though:
clothing = {
modelMappings = {
Male = "mp_m_freemode_01",
Female = "mp_f_freemode_01"
}
}
clothing.loadModel = function(modelGender)
print(modelGender)
local model = clothing.modelMappings[modelGender]
if not model then
print("Big error... model doesnt exist")
end
model = GetHashKey(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(1)
end
SetPlayerModel(PlayerId(), model)
SetModelAsNoLongerNeeded(model)
SetPedDefaultComponentVariation(PlayerPedId())
end
And also, GetPedPropIndex works fine
Have you set their drawables and then tested this native?
That was the issue… Woulda thought the SetPedDefaultComponentVariation would do similar?
Maybe thats a bug?
I would presume that if you use SetPedDefaultComponentVariation all the drawable and texture variation would be set to 0. So I’m not sure what the issue is, am I missing something?
The default ones aren’t always 0 as far as im aware? For instance with the freemode peds, i don’t think 0 are the default components?
0 is the default component id, hence why GetPedDrawableVariation returns 0 after you call the SetPedDefaultComponentVariation native.
Here is some code you can use to test it.
local compList = {
[0] = "Head",
[1] = "Beard",
[2] = "Hair",
[3] = "Torso",
[4] = "Legs",
[5] = "Hands",
[6] = "Foot",
[7] = "------",
[8] = "Accessories 1",
[9] = "Accessories 2",
[10]= "Decals",
[11] = "Auxiliary parts for torso",
}
RegisterCommand("componentTest", function(source, args, rawCommand)
local playerPed = PlayerPedId()
local oldComponents = {}
for i = 1, 11 do
oldComponents[i] = {}
oldComponents[i].draw = GetPedDrawableVariation(playerPed, i)
oldComponents[i].texture = GetPedTextureVariation(playerPed, i)
end
SetPedDefaultComponentVariation(playerPed)
local components = {}
for i = 1, 11 do
components[i] = {}
components[i].draw = GetPedDrawableVariation(playerPed, i)
components[i].texture = GetPedTextureVariation(playerPed, i)
end
for index, data in pairs(components) do
print(compList[index].." was "..oldComponents[index].draw.."/"..oldComponents[index].texture.." but after SetPedDefaultComponentVariation it is "..data.draw.."/"..data.texture)
end
end, false)
This is what it returned for me:
Edit: Added GetPedTextureVariation into the code to show it as well.
That makes sense. Thanks for clearing that up