Skip to content

Commit

Permalink
feat(gamestate/server): add GET_ENTITY_TYPE_SPECIFIC native
Browse files Browse the repository at this point in the history
Implements a new custom (server) native to get the specific NetObjEntity type of a networked entity.
  • Loading branch information
tens0rfl0w committed Nov 18, 2024
1 parent 4f7d5fa commit bfec75d
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,11 @@ static void Init()
return (int)GetEntityType(entity);
}));

fx::ScriptEngine::RegisterNativeHandler("GET_ENTITY_TYPE_SPECIFIC", makeEntityFunction([](fx::ScriptContext& context, const fx::sync::SyncEntityPtr& entity)
{
return static_cast<int>(entity->type) + 1;
}));

fx::ScriptEngine::RegisterNativeHandler("SET_ROUTING_BUCKET_POPULATION_ENABLED", [](fx::ScriptContext& context)
{
int bucket = context.GetArgument<int>(0);
Expand Down
69 changes: 69 additions & 0 deletions ext/native-decls/GetEntityTypeSpecific.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
ns: CFX
apiset: server
---
## GET_ENTITY_TYPE_SPECIFIC

```c
int GET_ENTITY_TYPE_SPECIFIC(Entity entity);
```
Gets the specific entity type (as an integer), which can be one of the following defined down below:
#### FiveM
| Index | Type |
|-------|-----------------|
| 1 | Automobile |
| 2 | Bike |
| 3 | Boat |
| 4 | Door |
| 5 | Heli |
| 6 | Object |
| 7 | Ped |
| 8 | Pickup |
| 9 | PickupPlacement |
| 10 | Plane |
| 11 | Submarine |
| 12 | Player |
| 13 | Trailer |
| 14 | Train |
#### RedM
| Index | Type |
|-------|--------------------|
| 1 | Animal |
| 2 | Automobile |
| 3 | Bike |
| 4 | Boat |
| 5 | Door |
| 6 | Heli |
| 7 | Object |
| 8 | Ped |
| 9 | Pickup |
| 10 | PickupPlacement |
| 11 | Plane |
| 12 | Submarine |
| 13 | Player |
| 14 | Trailer |
| 15 | Train |
| 16 | DraftVeh |
| 17 | StatsTracker |
| 18 | PropSet |
| 19 | AnimScene |
| 20 | GroupScenario |
| 21 | Herd |
| 22 | Horse |
| 23 | WorldState |
| 24 | WorldProjectile |
| 25 | Incident |
| 26 | Guardzone |
| 27 | PedGroup |
| 28 | CombatDirector |
| 29 | PedSharedTargeting |
| 30 | Persistent |
## Parameters
* **entity**: The entity to get the specific type of.
## Return value
The specific entity type returned as an integer value.

0 comments on commit bfec75d

Please sign in to comment.