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

entityCreating Event: Ambient Pickup GetEntityModel returns 0 #2924

Open
borianm opened this issue Nov 12, 2024 · 1 comment · May be fixed by #2940
Open

entityCreating Event: Ambient Pickup GetEntityModel returns 0 #2924

borianm opened this issue Nov 12, 2024 · 1 comment · May be fixed by #2940
Labels
bug triage Needs a preliminary assessment to determine the urgency and required action

Comments

@borianm
Copy link
Contributor

borianm commented Nov 12, 2024

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

@borianm borianm added bug triage Needs a preliminary assessment to determine the urgency and required action labels Nov 12, 2024
@tens0rfl0w tens0rfl0w linked a pull request Nov 18, 2024 that will close this issue
4 tasks
@tens0rfl0w
Copy link
Contributor

While this still wouldn't return the correct model hash on the server-side weaponModel needs to be an actual model and not a weapon type (in your case w_pi_pistol).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Needs a preliminary assessment to determine the urgency and required action
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants