Skip to content

Commit

Permalink
feat(natives): expand example and update natives for enhanced functio… (
Browse files Browse the repository at this point in the history
#934)

* feat(natives): expand example and update natives for enhanced functionality

* Update ClearWeatherTypeNowPersistNetwork.md

Provide a usage example, remove wrongly assigned alias and rename the `milliseconds` parameter to `transitionTimeInMs`.

---------

Co-authored-by: ammonia-cfx <[email protected]>
  • Loading branch information
spacevx and 4mmonium authored Nov 22, 2023
1 parent 9ce8cd9 commit 58e12b6
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 41 deletions.
49 changes: 48 additions & 1 deletion ENTITY/DeleteEntity.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,54 @@ ns: ENTITY
void DELETE_ENTITY(Entity* entity);
```
Deletes the specified entity, and invalidates the passed handle (i.e. in/out argument).
Delete the specified entity, and invalidate the passed handle (i.e., the in/out argument).
You might want to check if the entity exists before with [DOES_ENTITY_EXIST](#_0x7239B21A38F536BA).
## Parameters
- **entity**: The entity to delete.
## Examples
```lua
-- Retrieve the vehicle the player is currently in.
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
-- Check if the vehicle exists in the game world.
if not DoesEntityExist(vehicle) then
-- If the vehicle does not exist, end the execution of the code here.
return
end
-- If the vehicle does exist, delete the vehicle entity from the game world.
DeleteEntity(vehicle)
```

```js
// Retrieve the vehicle the player is currently in.
const vehicle = GetVehiclePedIsIn(PlayerPedId(), false);

// Check if the vehicle exists in the game world.
if (!DoesEntityExist(vehicle)) {
// If the vehicle does not exist, end the execution of the code here.
return;
}

// If the vehicle does exist, delete the vehicle entity from the game world.
DeleteEntity(vehicle);
```

```cs
using static CitizenFX.Core.Native.API;

// Retrieve the vehicle the player is currently in.
Vehicle vehicle = GetVehiclePedIsIn(PlayerPedId(), false);

// Check if the vehicle exists in the game world.
if (!DoesEntityExist(vehicle))
{
// If the vehicle does not exist, end the execution of the code here.
return;
}

// If the vehicle does exist, delete the vehicle entity from the game world.
DeleteEntity(vehicle);
```
29 changes: 29 additions & 0 deletions MISC/ClearWeatherTypeNowPersistNetwork.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
ns: MISC
aliases: ["0x0CF97F497FE7D048"]
---
## CLEAR_WEATHER_TYPE_NOW_PERSIST_NETWORK

```c
// 0x0CF97F497FE7D048
void CLEAR_WEATHER_TYPE_NOW_PERSIST_NETWORK(cs_type(float) int transitionTimeInMs);
```
Clears the active weather type after a specific amount of time determined by `transitionTimeInMs`.
## Parameters
* **transitionTimeInMs**: Transition time in milliseconds.
## Examples
```lua
RegisterCommand('weathertransition', function(source, args)
-- Set the weather type to foggy so we can see the change
SetWeatherTypeNowPersist("FOGGY")
-- Clear the weather and run the transition
local transitionTimeInMs = tonumber(args[1]) or 5000
if transitionTimeInMs > 0 then
ClearWeatherTypeNowPersistNetwork(transitionTimeInMs)
end
end, false)
```

20 changes: 0 additions & 20 deletions MISC/N_0x0cf97f497fe7d048.md

This file was deleted.

20 changes: 0 additions & 20 deletions VEHICLE/GetVehicleDoorDestroyType.md

This file was deleted.

19 changes: 19 additions & 0 deletions VEHICLE/GetVehicleIndividualDoorLockStatus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
ns: VEHICLE
aliases: ["0xCA4AC3EAAE46EC7B", "_GET_VEHICLE_DOOR_DESTROY_TYPE"]
---
## GET_VEHICLE_INDIVIDUAL_DOOR_LOCK_STATUS

```c
// 0xCA4AC3EAAE46EC7B
int GET_VEHICLE_INDIVIDUAL_DOOR_LOCK_STATUS(Vehicle vehicle, int doorIndex);
```
See eDoorId declared in [`SET_VEHICLE_DOOR_SHUT`](#_0x93D9BD300D7789E5)
## Parameters
* **vehicle**:
* **doorIndex**:
## Return value
Returns vehicle door lock state previously set with [`SET_VEHICLE_INDIVIDUAL_DOORS_LOCKED`](#_0xBE70724027F85BCD)

0 comments on commit 58e12b6

Please sign in to comment.