-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vehicle/lights): update vehicle lights natives (#1192)
* 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
1 parent
5d99608
commit 5d90f60
Showing
4 changed files
with
173 additions
and
64 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -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); | ||
``` |
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,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); | ||
``` |
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 |
---|---|---|
@@ -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); | ||
``` |
This file was deleted.
Oops, something went wrong.