Skip to content

Commit

Permalink
feat(vehicle/lights): update vehicle lights natives (#1192)
Browse files Browse the repository at this point in the history
* feat(vehicle/lights): update vehicle lights natives

Co-Authored-By: Dillon Skaggs <[email protected]>

* tweak: keep consistent styling for enum

---------

Co-authored-by: Dillon Skaggs <[email protected]>
  • Loading branch information
spacevx and AvarianKnight authored Sep 22, 2024
1 parent 5d99608 commit 5d90f60
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 64 deletions.
62 changes: 47 additions & 15 deletions VEHICLE/SetVehicleHasUnbreakableLights.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,47 @@
---
ns: VEHICLE
aliases: ["0x1AA8A837D2169D94","_SET_VEHICLE_LIGHTS_CAN_BE_VISIBLY_DAMAGED"]
---
## SET_VEHICLE_HAS_UNBREAKABLE_LIGHTS

```c
// 0x1AA8A837D2169D94 0x009AB49E
void SET_VEHICLE_HAS_UNBREAKABLE_LIGHTS(Vehicle vehicle, BOOL p1);
```
## Parameters
* **vehicle**:
* **p1**:
---
ns: VEHICLE
aliases: ["0x1AA8A837D2169D94","_SET_VEHICLE_LIGHTS_CAN_BE_VISIBLY_DAMAGED"]
---
## SET_VEHICLE_HAS_UNBREAKABLE_LIGHTS

```c
// 0x1AA8A837D2169D94 0x009AB49E
void SET_VEHICLE_HAS_UNBREAKABLE_LIGHTS(Vehicle vehicle, BOOL toggle);
```
Sets whether the vehicle's lights can be broken.
```
NativeDB Introduced: v323
```
## Parameters
* **vehicle**: The target vehicle.
* **toggle**: Set the lights' breakability `true` makes lights unbreakable, `false` allows them to break.
## Examples
```lua
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
if not vehicle then return end
-- Make the vehicle's lights unbreakable
SetVehicleHasUnbreakableLights(vehicle, true)
```

```js
const vehicle = GetVehiclePedIsIn(PlayerPedId(), false);
if (!vehicle) return;

// Make the vehicle's lights unbreakable
SetVehicleHasUnbreakableLights(vehicle, true);
```

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

int vehicle = GetVehiclePedIsIn(PlayerPedId(), false);
if (vehicle == 0) return;

// Make the vehicle's lights unbreakable
SetVehicleHasUnbreakableLights(vehicle, true);
```
60 changes: 60 additions & 0 deletions VEHICLE/SetVehicleHeadlightShadows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
ns: VEHICLE
aliases: ["0x1FD09E7390A74D54", "_SET_VEHICLE_LIGHTS_MODE"]
---
## SET_VEHICLE_HEADLIGHT_SHADOWS

```c
// 0x1FD09E7390A74D54
void SET_VEHICLE_HEADLIGHT_SHADOWS(Vehicle vehicle, int flag);
```
Sets the vehicle headlight shadow flags.
```
NativeDB Introduced: v323
```
```c
enum eVehicleHeadlightShadowFlags {
// Default (Lights can be toggled between off, normal and high beams)
NO_HEADLIGHT_SHADOWS = 0,
// Lights Disabled (Lights are fully disabled, cannot be toggled)
HEADLIGHTS_CAST_DYNAMIC_SHADOWS = 1,
// Always On (Lights can be toggled between normal and high beams)
HEADLIGHTS_CAST_STATIC_SHADOWS = 2,
HEADLIGHTS_CAST_FULL_SHADOWS = 3
};
```

## Parameters
* **vehicle**: The target vehicle.
* **flag**: A value from `eVehicleHeadlightShadowFlags` representing the desired headlight shadow flag.


## Examples
```lua
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
if not vehicle then return end

-- Set the vehicle headlight shadows to cast static shadows (always on)
SetVehicleHeadlightShadows(vehicle, 2)
```

```js
const vehicle = GetVehiclePedIsIn(PlayerPedId(), false);
if (!vehicle) return;

// Set the vehicle headlight shadows to cast static shadows (always on)
SetVehicleHeadlightShadows(vehicle, 2);
```

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

int vehicle = GetVehiclePedIsIn(PlayerPedId(), false);
if (vehicle == 0) return;

// Set the vehicle headlight shadows to cast static shadows (always on)
SetVehicleHeadlightShadows(vehicle, 2);
```
92 changes: 66 additions & 26 deletions VEHICLE/SetVehicleLights.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,66 @@
---
ns: VEHICLE
---
## SET_VEHICLE_LIGHTS

```c
// 0x34E710FF01247C5A 0xE8930226
void SET_VEHICLE_LIGHTS(Vehicle vehicle, int state);
```
```
set's if the vehicle has lights or not.
not an on off toggle.
p1 = 0 ;vehicle normal lights, off then lowbeams, then highbeams
p1 = 1 ;vehicle doesn't have lights, always off
p1 = 2 ;vehicle has always on lights
p1 = 3 ;or even larger like 4,5,... normal lights like =1
note1: when using =2 on day it's lowbeam,highbeam
but at night it's lowbeam,lowbeam,highbeam
note2: when using =0 it's affected by day or night for highbeams don't exist in daytime.
```
## Parameters
* **vehicle**:
* **state**:
---
ns: VEHICLE
---
## SET_VEHICLE_LIGHTS

```c
// 0x34E710FF01247C5A 0xE8930226
void SET_VEHICLE_LIGHTS(Vehicle vehicle, int state);
```
Sets the vehicle lights state. Allowing for different lighting modes.
```
NativeDB Introduced: v323
```
```c
enum eVehicleLightSetting {
// Normal light behavior. Lights cycle through off, then low beams, then high beams.
// Note: It's affected by day or night; high beams don't exist in daytime.
NO_VEHICLE_LIGHT_OVERRIDE = 0,
// Vehicle doesn't have lights, always off.
FORCE_VEHICLE_LIGHTS_OFF = 1,
// Vehicle has always-on lights.
// During day: Cycles between low beams and high beams.
// At night: Cycles between low beams, low beams, and high beams.
FORCE_VEHICLE_LIGHTS_ON = 2,
// Sets vehicle lights on. Behaves like normal lights (same as 0).
SET_VEHICLE_LIGHTS_ON = 3,
// Sets vehicle lights off. Behaves like normal lights (same as 0).
SET_VEHICLE_LIGHTS_OFF = 4
};
```


## Parameters
* **vehicle**: The target vehicle.
* **state**: A value from `eVehicleLightSetting` representing the desired light setting.


## Examples
```lua
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
if not vehicle then return end

-- Set the vehicle lights to always on
SetVehicleLights(vehicle, 2)
```

```js
const vehicle = GetVehiclePedIsIn(PlayerPedId(), false);
if (!vehicle) return;

// Set the vehicle lights to always on
SetVehicleLights(vehicle, 2);
```

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

int vehicle = GetVehiclePedIsIn(PlayerPedId(), false);
if (vehicle == 0) return;

// Set the vehicle lights to always on
SetVehicleLights(vehicle, 2);
```
23 changes: 0 additions & 23 deletions VEHICLE/SetVehicleLightsMode.md

This file was deleted.

0 comments on commit 5d90f60

Please sign in to comment.