Skip to content

Conversation

@tens0rfl0w
Copy link
Contributor

Goal of this PR

Allowing to get the entity model of a pickup object on the server-side.

How is this PR achieving the goal

Parse CPickupCreationDataNode partially and return the custom model hash (if set) on GET_ENTITY_MODEL.

This PR applies to the following area(s)

FiveM, Server

Successfully tested on

Game builds: 2060, 2699, 3258

Platforms: Windows (Client)

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

resolves #2924

@github-actions github-actions bot added the triage Needs a preliminary assessment to determine the urgency and required action label Nov 18, 2024
@spacevx
Copy link
Contributor

spacevx commented Nov 18, 2024

With this data node you could create a server setter no?

@tens0rfl0w
Copy link
Contributor Author

Without verifying: Yeah that should work, though this node has a lot more serialization stuff going on, so completing this isn't super easy.

@william-des
Copy link
Contributor

This bug made it possible to easily block the creation of pickups by canceling any entity with a model hash of 0 in the entityCreating event.
I don't think there is any other way to to distinguish between pickups and regular objects server side, and maybe a native can be created for that ?

@tens0rfl0w
Copy link
Contributor Author

The modelhash will still be 0 if no custom model is supplied, as the game will then just use the metadata of the pickup type to determine which model to render. This is a limitation that will be hard to overcome as we have no metadata on the server (yet). I can have a look if we can implement something like GET_PICKUP_HASH on the server-side to check what type of pickup this object is.

customModelHash = 0;
}

return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be worth adding a comment that this isn't all of the node data.

(Incomplete) Parsing for CPickupCreationDataNode to return a (custom) model hash for pickups on 'GetModelHash'.
@tens0rfl0w tens0rfl0w force-pushed the tweak/gamestate_server/CPickupCreationDataNode branch from 2b648f7 to cc55e81 Compare November 21, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage Needs a preliminary assessment to determine the urgency and required action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

entityCreating Event: Ambient Pickup GetEntityModel returns 0

4 participants