Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(natives/vehicle): update vehicle natives - Part 1/4 #950

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 61 additions & 3 deletions PED/GetVehiclePedIsIn.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,70 @@ ns: PED
Vehicle GET_VEHICLE_PED_IS_IN(Ped ped, BOOL lastVehicle);
```

Gets the vehicle the specified Ped is in. Returns 0 if the ped is/was not in a vehicle.
If the Ped is not in a vehicle and includeLastVehicle is true, the vehicle they were last in is returned.
Retrieves the vehicle the specified ped is currently in, or the last vehicle they were in.

## Parameters
* **ped**: The target ped
* **lastVehicle**: False = CurrentVehicle, True = LastVehicle
* **lastVehicle**: A boolean value where `false` represents the current vehicle the Ped is in, and `true` represents the last vehicle the Ped was in.

## Return value
The vehicle id. Returns 0 if the ped is/was not in a vehicle.

## Examples
```lua
-- This example gets the vehicle the player is currently in and print the vehicle id.

-- Retrieve the LocalPlayer.
local playerPed = PlayerPedId()

-- Retrieve the vehicle the player is currently in.
local vehicle = GetVehiclePedIsIn(playerPed, 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

-- Print the vehicle id
print("Vehicle ID: " .. vehicle)
```

```js
// This example gets the vehicle the player is currently in and print the vehicle id.

// Retrieve the player ped.
const playerPed = PlayerPedId();

// Retrieve the vehicle the player is currently in.
const vehicle = GetVehiclePedIsIn(playerPed, 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;
}

// Print the vehicle id
console.log(`Vehicle ID: ${vehicle}`);
```

```cs
// This example gets the vehicle the player is currently in and print the vehicle id.
using static CitizenFX.Core.Native.API;

// Retrieve the player ped
Ped playerPed = PlayerPedId();

// Retrieve the vehicle the player is currently in.
Vehicle vehicle = GetVehiclePedIsIn(playerPed, 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;
}

// Print the vehicle id
Debug.WriteLine($"Vehicle ID: {vehicle}");
```
16 changes: 16 additions & 0 deletions VEHICLE/AllowAmbientVehiclesToAvoidAdverseConditions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
ns: VEHICLE
aliases: ["0xB264C4D2F2B0A78B"]
---
## ALLOW_AMBIENT_VEHICLES_TO_AVOID_ADVERSE_CONDITIONS

```c
// 0xB264C4D2F2B0A78B 0x45F72495
void ALLOW_AMBIENT_VEHICLES_TO_AVOID_ADVERSE_CONDITIONS(Vehicle vehicle);
```

This native it's a debug native. Won't do anything.

## Parameters
* **vehicle**:

9 changes: 3 additions & 6 deletions VEHICLE/GetVehicleIsMercenary.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ aliases: ["0xD4C4642CB7F50B5D"]
BOOL GET_VEHICLE_IS_MERCENARY(Vehicle vehicle);
```

```
Only used like this:
if (VEHICLE::GET_VEHICLE_IS_MERCENARY(ENTITY::GET_VEHICLE_INDEX_FROM_ENTITY_INDEX(v_3))) { sub_157e9c(g_40001._f1868, 0);
}
```
Returns whether the specified vehicle is designated as a mercenary vehicle

## Parameters
* **vehicle**:
* **vehicle**: The vehicle to check for mercenary status.

## Return value
Returns `true` if the vehicle is a mercenary vehicle, `false` otherwise.
18 changes: 0 additions & 18 deletions VEHICLE/N_0xb264c4d2f2b0a78b.md

This file was deleted.

Loading