diff --git a/code/components/citizen-server-impl/src/state/ServerGameState_Scripting.cpp b/code/components/citizen-server-impl/src/state/ServerGameState_Scripting.cpp index 619d155541..713d502a28 100644 --- a/code/components/citizen-server-impl/src/state/ServerGameState_Scripting.cpp +++ b/code/components/citizen-server-impl/src/state/ServerGameState_Scripting.cpp @@ -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(entity->type) + 1; + })); + fx::ScriptEngine::RegisterNativeHandler("SET_ROUTING_BUCKET_POPULATION_ENABLED", [](fx::ScriptContext& context) { int bucket = context.GetArgument(0); diff --git a/ext/native-decls/GetEntityTypeSpecific.md b/ext/native-decls/GetEntityTypeSpecific.md new file mode 100644 index 0000000000..6a522fe100 --- /dev/null +++ b/ext/native-decls/GetEntityTypeSpecific.md @@ -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.