-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(natives/vehicle): update vehicle natives
- Loading branch information
Showing
4 changed files
with
104 additions
and
30 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |