Skip to content

GetVariantProp not working #2791

Open
Open
@Mathu-lmn

Description

@Mathu-lmn

What happened?

I tried using the GetVariantProp native but it always returns 0 for the three returned values (nameHash, enumValue, anchorPoint)

Expected result

Getting the actual prop variant

Reproduction steps

  1. Set Player's ped model to mp_m_freemode_01
  2. Use this snippet and see the results
function GetAltPropVariationData(ped, propId)
    local res = {}
    local prop = 0
    for prop=0, GetNumberOfPedPropDrawableVariations(ped, propId), 1 do
        
        print(prop)
        
        local propHashName = GetHashNameForProp(PlayerPedId(), propId, prop, 0)
        local maxVariations = GetShopPedApparelVariantPropCount(propHashName)

        if (maxVariations > 0) then
            print("Got " .. maxVariations .. " variants")

            for i = 1, maxVariations, 1 do
                local nameHash --[[ Hash ]], enumValue --[[ integer ]], anchorPoint --[[ integer ]] = GetVariantProp(propHashName, i)

                table.insert(res, {
                    initialProp = prop,
                    nameHash = nameHash,
                    enumValue = enumValue,
                    anchorPoint = anchorPoint
                })
            end
        end
    end
    return json.encode(res)
end

return GetAltPropVariationData(PlayerPedId(), 0)

Importancy

Slight inconvenience

Area(s)

FiveM, Natives, ScRT: Lua

Specific version(s)

Tested in b3258 and b1604 - FXVersion 9823

Additional information

Note that the GetShopPedApparelVariantPropCount function works as sometimes, maxVariations is > 0 and the GetVariantProp is called

Metadata

Metadata

Assignees

No one assigned

    Labels

    ScRT: LuaIssues/PRs related to the Lua scripting runtimebugtriageNeeds a preliminary assessment to determine the urgency and required action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions