-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat(gamestate/server): add GET_ENTITY_TYPE_RAW native #2945
base: master
Are you sure you want to change the base?
feat(gamestate/server): add GET_ENTITY_TYPE_RAW native #2945
Conversation
GET_ENTITY_TYPE_RAW might be a better name here, it matches other natives |
Implements a new custom (server) native to get the specific NetObjEntity type of a networked entity.
bfec75d
to
c2ad330
Compare
I agree that Thanks for the feedback! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of returning the raw integer value. Maybe use GetNetObjEntityName to return the string value instead?
My intention was to match existing other custom native implementations like: GET_VEHICLE_TYPE_RAW. I would argue that comparing to an int is less user-error prone and also faster in some cases (though this probably doesn't really matter). But of course, if you prefer returning the type as a string here, I will change this👍🏼 |
Would it not be better to just make two natives new natives for this and have one return the string and one return the raw integer value?
I don't think many people (though i could be a bit biased here) really care about the string representation unless they're debugging. |
I also prefer strings due to the fact that we don't have enums or equivalents |
Goal of this PR
While working on #2940 it was mentioned that there is currently no way to get the specific entity type on the server-side.
This implements a new custom (server) native to get the specific
NetObjEntity
type of a networked entity.How is this PR achieving the goal
Reading
entity->type
and returning the specific type as an int on callingGET_ENTITY_TYPE_RAW
.This PR applies to the following area(s)
FiveM, RedM, Natives, Server
Successfully tested on
Game builds: 3258
Platforms: Windows
Checklist
Fixes issues
/