Skip to content

GetEntityArchetypeName invoke error on ground #2840

Open
@Mathu-lmn

Description

@Mathu-lmn

What happened?

When trying to start an StartExpensiveSynchronousShapeTestLosProbe, if the returned entity is not a ped, a vehicle or a game object, the GetEntityArchetype function will error

Expected result

Return the correct entity archetype or an empty string

Reproduction steps

Execute the following "bug" command while on the ground

RegisterCommand("bug", function()
    local playerPed = PlayerPedId()
    local coordA = GetEntityCoords(playerPed)
    local coordB = GetOffsetFromEntityInWorldCoords(playerPed, 0.0, 0.0, -5.0)

    local rayHandle = StartExpensiveSynchronousShapeTestLosProbe(coordA.x, coordA.y, coordA.z, coordB.x, coordB.y, coordB.z, -1, PlayerPedId(), 0)
    local _, hit, _, _, _, entity = GetShapeTestResultIncludingMaterial(rayHandle)

    if hit == 1 or hit == true then
		print(entity)
		print(GetEntityArchetypeName(entity))
    end
end)

Importancy

Slight inconvenience

Area(s)

FiveM, Natives, ScRT: Lua

Specific version(s)

server 10191 - client canary b3095

Additional information

No response

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