From 7754843858c27f677e5642529b2c538a01e2eb78 Mon Sep 17 00:00:00 2001 From: ahcenezdh Date: Tue, 7 May 2024 02:51:02 +0200 Subject: [PATCH] feat(natives/interior): update interiors natives/examples * Update PIN_INTERIOR_IN_MEMORY * Update IS_INTERIOR_ENTITY_SET_ACTIVE * Update ENABLE_SHADOW_CULL_MODEL_THIS_FRAME * Update ENABLE_EXTERIOR_CULL_MODEL_THIS_FRAME * Update DISABLE_METRO_SYSTEM * Update DEACTIVATE_INTERIOR_ENTITY_SET * Update ACTIVATE_INTERIOR_ENTITY_SET refactor(example): set the player into the interior * In the example of PinMemory when the interior is ready we are now teleporting the player in the interior * Removed the gtaforum link Co-Authored-By: Dillon Skaggs --- INTERIOR/ActivateInteriorEntitySet.md | 47 ++++++++++++++++-- INTERIOR/DeactivateInteriorEntitySet.md | 48 ++++++++++++++++++- INTERIOR/DisableMetroSystem.md | 35 ++++++++++++++ INTERIOR/EnableExteriorCullModelThisFrame.md | 27 ++++++++++- INTERIOR/EnableScriptCullModelThisFrame.md | 14 ------ INTERIOR/EnableShadowCullModelThisFrame.md | 50 ++++++++++++++++++++ INTERIOR/IsInteriorEntitySetActive.md | 38 ++++++++++++++- INTERIOR/N_0x9e6542f0ce8e70a3.md | 17 ------- INTERIOR/PinInteriorInMemory.md | 29 +++++++++++- 9 files changed, 264 insertions(+), 41 deletions(-) create mode 100644 INTERIOR/DisableMetroSystem.md delete mode 100644 INTERIOR/EnableScriptCullModelThisFrame.md create mode 100644 INTERIOR/EnableShadowCullModelThisFrame.md delete mode 100644 INTERIOR/N_0x9e6542f0ce8e70a3.md diff --git a/INTERIOR/ActivateInteriorEntitySet.md b/INTERIOR/ActivateInteriorEntitySet.md index 9967104af..283defcae 100644 --- a/INTERIOR/ActivateInteriorEntitySet.md +++ b/INTERIOR/ActivateInteriorEntitySet.md @@ -9,11 +9,52 @@ aliases: ["0x55E86AF2712B36A1","_ENABLE_INTERIOR_PROP"] void ACTIVATE_INTERIOR_ENTITY_SET(int interior, char* entitySetName); ``` +Activates the entity set with the specified name in the given interior. If you want to disable a entity set, use [`DEACTIVATE_INTERIOR_ENTITY_SET`](#_0x420BD37289EEE162). + ``` -More info: http://gtaforums.com/topic/836367-adding-props-to-interiors/ +NativeDB Introduced: v323 ``` ## Parameters -* **interior**: -* **entitySetName**: +* **interior**: The index of the interior. +* **entitySetName**: The name of the entity set to activate. + +## Examples +```lua +-- Get the interior id for the casino penthouse +local interiorID = GetInteriorAtCoords(976.6364, 70.29476, 115.1641) + +-- Activate certain entity sets for the casino penthouse +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Spa_Bar_Open') +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Media_Bar_Open') +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Arcade_Retro') +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Bar_Clutter') +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Clutter_03') +ActivateInteriorEntitySet(interiorID, 'Set_pent_bar_light_02') +``` +```javascript +// Get the interior id for the casino penthouse +const interiorID = GetInteriorAtCoords(976.6364, 70.29476, 115.1641); + +// Activate certain entity sets for the casino penthouse +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Spa_Bar_Open'); +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Media_Bar_Open'); +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Arcade_Retro'); +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Bar_Clutter'); +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Clutter_03'); +ActivateInteriorEntitySet(interiorID, 'Set_pent_bar_light_02'); +``` +```csharp +using static CitizenFX.Core.Native.API; + +// Get the interior id for the casino penthouse +int interiorID = GetInteriorAtCoords(976.6364, 70.29476, 115.1641); +// Activate certain entity sets for the casino penthouse +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Spa_Bar_Open'); +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Media_Bar_Open'); +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Arcade_Retro'); +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Bar_Clutter'); +ActivateInteriorEntitySet(interiorID, 'Set_Pent_Clutter_03'); +ActivateInteriorEntitySet(interiorID, 'Set_pent_bar_light_02'); +``` \ No newline at end of file diff --git a/INTERIOR/DeactivateInteriorEntitySet.md b/INTERIOR/DeactivateInteriorEntitySet.md index 71d5cba2d..086aaaf4e 100644 --- a/INTERIOR/DeactivateInteriorEntitySet.md +++ b/INTERIOR/DeactivateInteriorEntitySet.md @@ -9,8 +9,52 @@ aliases: ["0x420BD37289EEE162","_DISABLE_INTERIOR_PROP"] void DEACTIVATE_INTERIOR_ENTITY_SET(int interior, char* entitySetName); ``` +Deactivates the entity set with the specified name in the given interior. + +``` +NativeDB Introduced: v323 +``` ## Parameters -* **interior**: -* **entitySetName**: +* **interior**: The index of the interior. +* **entitySetName**: The name of the entity set to deactivate. + +## Examples +```lua +-- Get the interior id for the casino penthouse +local interiorID = GetInteriorAtCoords(976.6364, 70.29476, 115.1641) + +-- Deactivate certain entity sets for the casino penthouse +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Spa_Bar_Open') +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Media_Bar_Open') +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Arcade_Retro') +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Bar_Clutter') +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Clutter_03') +DeactivateInteriorEntitySet(interiorID, 'Set_pent_bar_light_02') +``` +```javascript +// Get the interior id for the casino penthouse +const interiorID = GetInteriorAtCoords(976.6364, 70.29476, 115.1641); + +// Deactivate certain entity sets for the casino penthouse +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Spa_Bar_Open'); +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Media_Bar_Open'); +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Arcade_Retro'); +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Bar_Clutter'); +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Clutter_03'); +DeactivateInteriorEntitySet(interiorID, 'Set_pent_bar_light_02'); +``` +```csharp +using static CitizenFX.Core.Native.API; + +// Get the interior id for the casino penthouse +int interiorID = GetInteriorAtCoords(976.6364, 70.29476, 115.1641); +// Deactivate certain entity sets for the casino penthouse +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Spa_Bar_Open'); +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Media_Bar_Open'); +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Arcade_Retro'); +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Bar_Clutter'); +DeactivateInteriorEntitySet(interiorID, 'Set_Pent_Clutter_03'); +DeactivateInteriorEntitySet(interiorID, 'Set_pent_bar_light_02'); +``` \ No newline at end of file diff --git a/INTERIOR/DisableMetroSystem.md b/INTERIOR/DisableMetroSystem.md new file mode 100644 index 000000000..daf915e84 --- /dev/null +++ b/INTERIOR/DisableMetroSystem.md @@ -0,0 +1,35 @@ +--- +ns: INTERIOR +aliases: ["0x9E6542F0CE8E70A3"] +--- +## DISABLE_METRO_SYSTEM + +```c +// 0x9E6542F0CE8E70A3 0x5EF9C5C2 +void DISABLE_METRO_SYSTEM(BOOL toggle); +``` + +Completely disables the metro system in the game. + +``` +NativeDB Introduced: v323 +``` + +## Parameters +* **toggle**: A boolean value indicating whether to disable (`true`) or enable (`false`) the metro system. + +## Examples +```lua +-- Disable metro system +DisableMetroSystem(true) +``` +```javascript +// Disable metro system +DisableMetroSystem(true); +``` +```csharp +using static CitizenFX.Core.Native.API; + +// Disable metro system +DisableMetroSystem(true); +``` \ No newline at end of file diff --git a/INTERIOR/EnableExteriorCullModelThisFrame.md b/INTERIOR/EnableExteriorCullModelThisFrame.md index 587ebd1fd..d6482cc82 100644 --- a/INTERIOR/EnableExteriorCullModelThisFrame.md +++ b/INTERIOR/EnableExteriorCullModelThisFrame.md @@ -9,10 +9,33 @@ aliases: ["0xA97F257D0151A6AB","_HIDE_MAP_OBJECT_THIS_FRAME"] void ENABLE_EXTERIOR_CULL_MODEL_THIS_FRAME(Hash mapObjectHash); ``` +Culls exterior objects from rendering (G-buffer only) based on the model name hash. Primarily used in multiplayer apartments to hide the exterior shell of buildings. This native needs to be called every frame. + ``` -This is the native that is used to hide the exterior of GTA Online apartment buildings when you are inside an apartment. +NativeDB Introduced: v323 ``` ## Parameters -* **mapObjectHash**: +* **mapObjectHash**: The hash of the model name to cull + +## Examples +```lua +CreateThread(function() + local buildingTopHash = GetHashKey("hei_kt1_08_buildingtop_a") + local emissiveHash = GetHashKey("hei_kt1_08_kt1_emissive_ema") + while (true) do + EnableExteriorCullModelThisFrame(buildingTopHash) + EnableExteriorCullModelThisFrame(emissiveHash) + Wait(0) + end +end) +``` +```javascript +const buildingTopHash = GetHashKey("hei_kt1_08_buildingtop_a"); +const emissiveHash = GetHashKey("hei_kt1_08_kt1_emissive_ema"); +setTick(() => { + EnableExteriorCullModelThisFrame(buildingTopHash); + EnableExteriorCullModelThisFrame(emissiveHash); +}); +``` \ No newline at end of file diff --git a/INTERIOR/EnableScriptCullModelThisFrame.md b/INTERIOR/EnableScriptCullModelThisFrame.md deleted file mode 100644 index f2cfb5c55..000000000 --- a/INTERIOR/EnableScriptCullModelThisFrame.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -ns: INTERIOR -aliases: ["0x50C375537449F369"] ---- -## _ENABLE_SCRIPT_CULL_MODEL_THIS_FRAME - -```c -// 0x50C375537449F369 -void _ENABLE_SCRIPT_CULL_MODEL_THIS_FRAME(cs_type(Any) Hash mapObjectHash); -``` - -## Parameters -* **mapObjectHash**: - diff --git a/INTERIOR/EnableShadowCullModelThisFrame.md b/INTERIOR/EnableShadowCullModelThisFrame.md new file mode 100644 index 000000000..d63e20bf1 --- /dev/null +++ b/INTERIOR/EnableShadowCullModelThisFrame.md @@ -0,0 +1,50 @@ +--- +ns: INTERIOR +aliases: ["0x50C375537449F369", "_ENABLE_SCRIPT_CULL_MODEL_THIS_FRAME"] +--- +## ENABLE_SHADOW_CULL_MODEL_THIS_FRAME + +```c +// 0x50C375537449F369 +void ENABLE_SHADOW_CULL_MODEL_THIS_FRAME(cs_type(Any) Hash mapObjectHash); +``` + +Culls exterior objects from rendering (cascade shadows only) based on the model name hash. Primarily used in multiplayer apartments to hide the exterior structure of buildings. This native needs to be called every frame and is generally used with [`ENABLE_EXTERIOR_CULL_MODEL_THIS_FRAME`](#_0xA97F257D0151A6AB). + +``` +NativeDB Introduced: v323 +``` + +## Parameters +* **mapObjectHash**: The hash of the model name to cull from shadow rendering. + +## Examples +```lua +CreateThread(function() + local buildingTopHash = GetHashKey("hei_kt1_08_buildingtop_a") + local emissiveHash = GetHashKey("hei_kt1_08_kt1_emissive_ema") + while (true) do + -- hei_kt1_08_buildingtop_a + EnableExteriorCullModelThisFrame(buildingTopHash) + EnableShadowCullModelThisFrame(buildingTopHash) + -- hei_kt1_08_kt1_emissive_ema + EnableExteriorCullModelThisFrame(emissiveHash) + EnableShadowCullModelThisFrame(emissiveHash) + + Wait(0) + end +end) +``` +```javascript +const buildingTopHash = GetHashKey("hei_kt1_08_buildingtop_a"); +const emissiveHash = GetHashKey("hei_kt1_08_kt1_emissive_ema"); + +setTick(() => { + // hei_kt1_08_buildingtop_a + EnableExteriorCullModelThisFrame(buildingTopHash); + EnableShadowCullModelThisFrame(buildingTopHash); + // hei_kt1_08_kt1_emissive_ema + EnableExteriorCullModelThisFrame(emissiveHash); + EnableShadowCullModelThisFrame(emissiveHash); +}); +``` \ No newline at end of file diff --git a/INTERIOR/IsInteriorEntitySetActive.md b/INTERIOR/IsInteriorEntitySetActive.md index 480c35a69..0748a370e 100644 --- a/INTERIOR/IsInteriorEntitySetActive.md +++ b/INTERIOR/IsInteriorEntitySetActive.md @@ -9,9 +9,43 @@ aliases: ["0x35F7DD45E8C0A16D","_IS_INTERIOR_PROP_ENABLED"] BOOL IS_INTERIOR_ENTITY_SET_ACTIVE(int interior, char* entitySetName); ``` +Determines whether the specified entity set is active within the given interior. + +``` +NativeDB Introduced: v323 +``` ## Parameters -* **interior**: -* **entitySetName**: +* **interior**: The index of the interior. +* **entitySetName**: The name of the entity set to check. ## Return value +A boolean value indicating whether the entity set is active (`true`) or not (`false`). + +## Examples +```lua +-- Check if the entity set `Set_Pent_Spa_Bar_Open` (casino penthouse) is active or not +local interiorID = GetInteriorAtCoords(976.6364, 70.29476, 115.1641) +local entitySet = "Set_Pent_Spa_Bar_Open" +local isInteriorSetActive = IsInteriorEntitySetActive(interiorID, entitySet) + +print("Entity Set Active: " .. isInteriorSetActive) +``` +```javascript +// Check if the entity set `Set_Pent_Spa_Bar_Open` (casino penthouse) is active or not +const interiorID = GetInteriorAtCoords(976.6364, 70.29476, 115.1641); +const entitySet = "Set_Pent_Spa_Bar_Open"; +const isInteriorSetActive = IsInteriorEntitySetActive(interiorID, entitySet); + +console.log(`Entity Set Active: ${isInteriorSetActive}`); +``` +```csharp +using static CitizenFX.Core.Native.API; + +// Check if the entity set `Set_Pent_Spa_Bar_Open` (casino penthouse) is active or not +int interiorID = GetInteriorAtCoords(976.6364, 70.29476, 115.1641); +string entitySet = "Set_Pent_Spa_Bar_Open"; +bool isInteriorSetActive = IsInteriorEntitySetActive(interiorID, entitySet); + +Debug.WriteLine($"Entity Set Active: {isInteriorSetActive}"); +``` \ No newline at end of file diff --git a/INTERIOR/N_0x9e6542f0ce8e70a3.md b/INTERIOR/N_0x9e6542f0ce8e70a3.md deleted file mode 100644 index 4cf7ad0b8..000000000 --- a/INTERIOR/N_0x9e6542f0ce8e70a3.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -ns: INTERIOR ---- -## _0x9E6542F0CE8E70A3 - -```c -// 0x9E6542F0CE8E70A3 0x5EF9C5C2 -void _0x9E6542F0CE8E70A3(BOOL toggle); -``` - -``` -DISABLE_* -``` - -## Parameters -* **toggle**: - diff --git a/INTERIOR/PinInteriorInMemory.md b/INTERIOR/PinInteriorInMemory.md index ab08a299d..0c72981c0 100644 --- a/INTERIOR/PinInteriorInMemory.md +++ b/INTERIOR/PinInteriorInMemory.md @@ -9,6 +9,33 @@ aliases: ["0x2CA429C029CCF247","_LOAD_INTERIOR"] void PIN_INTERIOR_IN_MEMORY(int interior); ``` +Instructs the interior system to load the specified interior into memory. + +``` +NativeDB Introduced: v323 +``` + ## Parameters -* **interior**: +* **interior**: The index of the interior. + +## Examples +```lua +CreateThread(function() + local interiorCoords = vector3(976.6364, 70.29476, 115.1641) + -- Coordinates of the interior + local interiorID = GetInteriorAtCoords(interiorCoords.x, interiorCoords.y, interiorCoords.z) + + -- Load the interior into memory + PinInteriorInMemory(interiorID) + + -- Wait until the interior is ready + repeat + Wait(0) + until IsInteriorReady(interiorID) + + -- Since the interior is ready, we can now teleport the player to the interior + local playerPed = PlayerPedId() + SetEntityCoords(playerPed, interiorCoords.x, interiorCoords.y, interiorCoords.z) +end) +``` \ No newline at end of file