Skip to content

entityCreating Event: Ambient Pickup GetEntityModel returns 0 #2924

@airbon99

Description

@airbon99

What happened?

I created an ambient pickup on the client. I listened to the entityCreating event on the server.
The creation triggered the event, but when I run GetEntityModel(entity) it returns 0.

Expected result

GetEntityModel(entity) should return the pickup hash

Reproduction steps

  1. Create this client command and run it:
RegisterCommand('test_pickup', function()
    local pickupCoords = GetEntityCoords(PlayerPedId())
    local weaponModel = GetHashKey("weapon_pistol")
    local pickupHash = GetHashKey("PICKUP_WEAPON_PISTOL")

    Citizen.CreateThread(function()
        local pickup = CreateAmbientPickup(pickupHash, pickupCoords.x, pickupCoords.y, pickupCoords.z + 2.0, 0, 100, weaponModel, true, true)
    end)
end)
  1. Listen to the entityCreating event on the server and fetch the entity model:
on('entityCreating', (entity) => {
    console.log(GetEntityModel(entity))
})
  1. It should return the same pickup hash when the command is ran, but it returns 0.

Importancy

Unknown

Area(s)

FiveM, FXServer, Natives

Specific version(s)

Client 10939 / FXServer 10367 Windows

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriageNeeds 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