Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetVariantProp not working #2791

Open
Mathu-lmn opened this issue Sep 15, 2024 · 0 comments
Open

GetVariantProp not working #2791

Mathu-lmn opened this issue Sep 15, 2024 · 0 comments
Labels
bug ScRT: Lua Issues/PRs related to the Lua scripting runtime triage Needs a preliminary assessment to determine the urgency and required action

Comments

@Mathu-lmn
Copy link
Contributor

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

@Mathu-lmn Mathu-lmn added bug triage Needs a preliminary assessment to determine the urgency and required action labels Sep 15, 2024
@github-actions github-actions bot added the ScRT: Lua Issues/PRs related to the Lua scripting runtime label Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ScRT: Lua Issues/PRs related to the Lua scripting runtime triage Needs a preliminary assessment to determine the urgency and required action
Projects
None yet
Development

No branches or pull requests

1 participant