Skip to content

Commit

Permalink
feat(natives/vehicle): update vehicle natives
Browse files Browse the repository at this point in the history
  • Loading branch information
spacevx committed Dec 21, 2023
1 parent 5d614f1 commit b6eb680
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 30 deletions.
15 changes: 0 additions & 15 deletions VEHICLE/N_0x0ad9e8f87ff7c16f.md

This file was deleted.

15 changes: 0 additions & 15 deletions VEHICLE/N_0x1f9fb66f3a3842d2.md

This file was deleted.

16 changes: 16 additions & 0 deletions VEHICLE/SetVehicleActAsIfHighSpeedForFragSmashing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
ns: VEHICLE
aliases: ["0x1F9FB66F3A3842D2"]
---
## SET_VEHICLE_ACT_AS_IF_HIGH_SPEED_FOR_FRAG_SMASHING

```c
// 0x1F9FB66F3A3842D2 0x4D840FC4
void SET_VEHICLE_ACT_AS_IF_HIGH_SPEED_FOR_FRAG_SMASHING(Vehicle vehicle, BOOL actHighSpeed);
```
This native is used to simulate a high-speed impact for a vehicle when it collides with a breakable object (frag). It's particularly useful in scripted sequences where a vehicle is required to break through a barrier but might not actually be moving at a sufficient speed to do so realistically. Note that this setting is temporary and will reset after one frame, so it needs to be called every frame for a lasting effect.
## Parameters
* **vehicle**: The vehicle to be affected by this setting.
* **actHighSpeed**: A boolean flag. Set to `true` to make the vehicle act as if it's at high speed for the current frame
88 changes: 88 additions & 0 deletions VEHICLE/SetVehicleInfluencesWantedLevel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
ns: VEHICLE
aliases: ["0x0AD9E8F87FF7C16F"]
---
## SET_VEHICLE_INFLUENCES_WANTED_LEVEL

```c
// 0x0AD9E8F87FF7C16F 0x04F5546C
void SET_VEHICLE_INFLUENCES_WANTED_LEVEL(Vehicle vehicle, BOOL influenceWantedLevel);
```
This native sets whether a specific vehicle influences the player's wanted level when it is involved in an incident that typically triggers a wanted response, such as being marked as a "victim" vehicle.
This is particularly useful when utilizing the wanted system from GTA, and you want to prevent a vehicle from affecting the wanted level when it is stolen. In the decompiled scripts this native is only used to disable the influence of the vehicle on the wanted level.
## Parameters
* **vehicle**: The specific vehicle to be set for influencing the wanted level.
* **influenceWantedLevel**: A boolean value. Set to `true` to make the vehicle influence the wanted level; `false` to prevent it from doing so.
## Examples
```lua
-- This example will prevent the closest vehicle from influencing the wanted level.
-- Retrieve the LocalPlayer
local playerPed = PlayerPedId()
-- Retrieve the coordinates of the player.
local playerCoords = GetEntityCoords(playerPed)
-- Retrieve the closest vehicle.
local vehicle = GetClosestVehicle(playerCoords.x, playerCoords.y, playerCoords.z, 3, 0, 70)
-- 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
-- Set the vehicle to not influence the wanted level.
SetVehicleInfluencesWantedLevel(vehicle, false)
```

```js
// This example will prevent the closest vehicle from influencing the wanted level.

// Retrieve the LocalPlayer
const playerPed = PlayerPedId();

// Retrieve the coordinates of the player.
const [playerX, playerY, playerZ] = GetEntityCoords(playerPed);

// Retrieve the closest vehicle.
const vehicle = GetClosestVehicle(playerX, playerY, playerZ, 3, 0, 70)

// 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;
}

// Set the vehicle to not influence the wanted level.
SetVehicleInfluencesWantedLevel(vehicle, false);
```

```cs
// This example will prevent the closest vehicle from influencing the wanted level.
using static CitizenFX.Core.Native.API;

// Retrieve the LocalPlayer
Ped playerPed = PlayerPedId();

// Retrive the coordinates of the player.
Vector3 playerCoords = GetEntityCoords(playerPed);

// Retrieve the closest vehicle.
Vehicle vehicle = GetClosestVehicle(playerCoords.X, playerCoords.Y, playerCoords.Z, 3, 0, 70);

// 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;
}

// Set the vehicle to not influence the wanted level.
SetVehicleInfluencesWantedLevel(vehicle, false);
```

0 comments on commit b6eb680

Please sign in to comment.