BUILTIN Natives
Red Dead Redemption 3 Native Functions Reference
Namespace: BUILTIN
Natives in this file: 22
Generated from: RDR3natives JSON data
CEIL
| Property | Value |
|---|---|
| Native Name | CEIL |
| Hash | 0x11E019C8F43ACC8A |
| Return Type | int |
| Build | 1207 |
| Parameters | value (float) |
Description: ``` I'm guessing this rounds a float value up to the next whole number, and FLOOR rounds it down
### Usage
**Lua (Direct):**
```lua
local result = Ceil(value)
Lua (Hash):
local result = Citizen.InvokeNative(0x11E019C8F43ACC8A, value)
COS
| Property | Value |
|---|---|
| Native Name | COS |
| Hash | 0xD0FFB162F40A139C |
| Return Type | float |
| Build | 1207 |
| Parameters | value (float) |
Description: Returns the cosine of the given number.
Parameters
value(float) — The number of degrees (in degrees, not radians)
Usage
Lua (Direct):
local result = Cos(value)
Lua (Hash):
local result = Citizen.InvokeNative(0xD0FFB162F40A139C, value)
Examples
-- Get the heading
local heading = GetEntityHeading(PlayerPedId())
local cos = Cos(heading)
-- equivalent in lua
local cosLua = math.cos(heading * (math.pi / 180))
FLOOR
| Property | Value |
|---|---|
| Native Name | FLOOR |
| Hash | 0xF34EE736CF047844 |
| Return Type | int |
| Build | 1207 |
| Parameters | value (float) |
Description: Rounds a float value down to the next whole number
Usage
Lua (Direct):
local result = Floor(value)
Lua (Hash):
local result = Citizen.InvokeNative(0xF34EE736CF047844, value)
LOG10
| Property | Value |
|---|---|
| Native Name | _LOG10 |
| Hash | 0xE816E655DE37FE20 |
| Return Type | float |
| Build | 1232 |
| Parameters | value (float) |
Description: ``` NativeDB Introduced: v1604
### Usage
**Lua (Direct):**
```lua
local result = Log10(value)
Lua (Hash):
local result = Citizen.InvokeNative(0xE816E655DE37FE20, value)
POW
| Property | Value |
|---|---|
| Native Name | POW |
| Hash | 0xE3621CC40F31FE2E |
| Return Type | float |
| Build | 1207 |
| Parameters | base (float), exponent (float) |
Usage
Lua (Direct):
local result = Pow(base, exponent)
Lua (Hash):
local result = Citizen.InvokeNative(0xE3621CC40F31FE2E, base, exponent)
ROUND
| Property | Value |
|---|---|
| Native Name | ROUND |
| Hash | 0xF2DB717A73826179 |
| Return Type | int |
| Build | 1207 |
| Parameters | value (float) |
Usage
Lua (Direct):
local result = Round(value)
Lua (Hash):
local result = Citizen.InvokeNative(0xF2DB717A73826179, value)
SETTIMERA
| Property | Value |
|---|---|
| Native Name | SETTIMERA |
| Hash | 0xC1B1E9A034A63A62 |
| Return Type | void |
| Build | 1207 |
| Parameters | value (int) |
Description: Sets the value for the timer A in milliseconds
Parameters
value(int) — In milliseconds.
Usage
Lua (Direct):
Settimera(value)
Lua (Hash):
Citizen.InvokeNative(0xC1B1E9A034A63A62, value)
SETTIMERB
| Property | Value |
|---|---|
| Native Name | SETTIMERB |
| Hash | 0x5AE11BC36633DE4E |
| Return Type | void |
| Build | 1207 |
| Parameters | value (int) |
Description: Sets the value for the timer B in milliseconds
Parameters
value(int) — In milliseconds.
Usage
Lua (Direct):
Settimerb(value)
Lua (Hash):
Citizen.InvokeNative(0x5AE11BC36633DE4E, value)
SET_THIS_THREAD_PRIORITY
| Property | Value |
|---|---|
| Native Name | _SET_THREAD_PRIORITY |
| Hash | 0x42B65DEEF2EDF2A1 |
| Return Type | void |
| Build | 1207 |
| Parameters | priority (int) |
Description: THREAD_PRIO_HIGHEST = 0 THREAD_PRIO_NORMAL = 1 THREAD_PRIO_LOWEST = 2 THREAD_PRIO_MANUAL_UPDATE = 100
Usage
Lua (Direct):
SetThreadPriority(priority)
Lua (Hash):
Citizen.InvokeNative(0x42B65DEEF2EDF2A1, priority)
SHIFT_LEFT
| Property | Value |
|---|---|
| Native Name | SHIFT_LEFT |
| Hash | 0xEDD95A39E5544DE8 |
| Return Type | int |
| Build | 1207 |
| Parameters | value (int), bitShift (int) |
Description: Left bit shifts a value.
It is advised you use the << operator instead of this native. It does the same and is faster.
Usage
Lua (Direct):
local result = ShiftLeft(value, bitShift)
Lua (Hash):
local result = Citizen.InvokeNative(0xEDD95A39E5544DE8, value, bitShift)
SHIFT_RIGHT
| Property | Value |
|---|---|
| Native Name | SHIFT_RIGHT |
| Hash | 0x97EF1E5BCE9DC075 |
| Return Type | int |
| Build | 1207 |
| Parameters | value (int), bitShift (int) |
Description: Right bit shifts a value.
It is advised you use the >> operator instead of this native. It does the same and is faster.
Usage
Lua (Direct):
local result = ShiftRight(value, bitShift)
Lua (Hash):
local result = Citizen.InvokeNative(0x97EF1E5BCE9DC075, value, bitShift)
SIN
| Property | Value |
|---|---|
| Native Name | SIN |
| Hash | 0x0BADBFA3B172435F |
| Return Type | float |
| Build | 1207 |
| Parameters | value (float) |
Description: Returns the sine of the given number.
Parameters
value(float) — The number of degrees (in degrees, not radians)
Usage
Lua (Direct):
local result = Sin(value)
Lua (Hash):
local result = Citizen.InvokeNative(0x0BADBFA3B172435F, value)
Examples
-- Get the heading
local heading = GetEntityHeading(PlayerPedId())
local sin = Sin(heading)
-- equivalent in lua
local sinLua = math.sin(heading * (math.pi / 180))
SQRT
| Property | Value |
|---|---|
| Native Name | SQRT |
| Hash | 0x71D93B57D07F9804 |
| Return Type | float |
| Build | 1207 |
| Parameters | value (float) |
Usage
Lua (Direct):
local result = Sqrt(value)
Lua (Hash):
local result = Citizen.InvokeNative(0x71D93B57D07F9804, value)
TIMERA
| Property | Value |
|---|---|
| Native Name | TIMERA |
| Hash | 0x83666F9FB8FEBD4B |
| Return Type | int |
| Build | 1207 |
Description: ``` Counts up. Every 1000 is 1 real-time second. Use SETTIMERA(int value) to set the timer (e.g.: SETTIMERA(0)).
### Usage
**Lua (Direct):**
```lua
local result = Timera()
Lua (Hash):
local result = Citizen.InvokeNative(0x83666F9FB8FEBD4B)
TIMERB
| Property | Value |
|---|---|
| Native Name | TIMERB |
| Hash | 0xC9D9444186B5A374 |
| Return Type | int |
| Build | 1207 |
Usage
Lua (Direct):
local result = Timerb()
Lua (Hash):
local result = Citizen.InvokeNative(0xC9D9444186B5A374)
TIMESTEP
| Property | Value |
|---|---|
| Native Name | TIMESTEP |
| Hash | 0x0000000050597EE2 |
| Return Type | float |
| Build | 1207 |
Description: ``` Gets the current frame time.
### Usage
**Lua (Direct):**
```lua
local result = Timestep()
Lua (Hash):
local result = Citizen.InvokeNative(0x0000000050597EE2)
TO_FLOAT
| Property | Value |
|---|---|
| Native Name | TO_FLOAT |
| Hash | 0xBBDA792448DB5A89 |
| Return Type | float |
| Build | 1207 |
| Parameters | value (int) |
Usage
Lua (Direct):
local result = ToFloat(value)
Lua (Hash):
local result = Citizen.InvokeNative(0xBBDA792448DB5A89, value)
VDIST
| Property | Value |
|---|---|
| Native Name | VDIST |
| Hash | 0x2A488C176D52CCA5 |
| Return Type | float |
| Build | 1207 |
| Parameters | x1 (float), y1 (float), z1 (float), x2 (float), y2 (float), z2 (float) |
Description: Calculates the distance between two points in 3D space. For performance reasons, consider using direct mathematical calculations for distance, as they can be more efficient than calling this native function.
NativeDB Introduced: v323
Parameters
x1(float) — X coordinate of the first point.y1(float) — Y coordinate of the first point.z1(float) — Z coordinate of the first point. Represents the height or elevation at the first point.x2(float) — X coordinate of the second point.y2(float) — Y coordinate of the second point.z2(float) — Z coordinate of the second point. Represents the height or elevation at the second point.
Usage
Lua (Direct):
local result = Vdist(x1, y1, z1, x2, y2, z2)
Lua (Hash):
local result = Citizen.InvokeNative(0x2A488C176D52CCA5, x1, y1, z1, x2, y2, z2)
Examples
-- Define a set of coordinates
local coords = vector3(145.0, 200.0, 1000.0)
-- Get the player's current ped
local playerPed = PlayerPedId()
-- Get the player's current coordinates
local coordsPlayer = GetEntityCoords(playerPed, false)
-- Calculate the distance between the player and the coordinates
local distance = Vdist(coordsPlayer.x, coordsPlayer.y, coordsPlayer.z, coords.x, coords.y, coords.z)
if (distance < 10.0) then
print("You are close to the coordinates")
else
print("You are far from the coordinates")
end
// Define a set of coordinates
const coords = [145.0, 200.0, 1000.0];
// Get the player's current ped
const playerPed = PlayerPedId();
// Get the player's current coordinates
const coordsPlayer = GetEntityCoords(playerPed, false);
// Calculate the distance between the player and the coordinates
const distance = Vdist(coordsPlayer[0], coordsPlayer[1], coordsPlayer[2], coords[0], coords[1], coords[2]);
if (distance < 10.0) {
console.log("You are close to the coordinates");
} else {
console.log("You are far from the coordinates");
}
using static CitizenFX.Core.Native.API;
// Define a set of coordinates
Vector3 coords = new Vector3(145.0f, 200.0f, 1000.0f);
// Get the player's current ped
Ped playerPed = PlayerPedId();
// Get the player's current coordinates
Vector3 coordsPlayer = GetEntityCoords(playerPed, false);
// Calculate the distance between the player and the coordinates
float distance = Vdist(coordsPlayer.X, coordsPlayer.Y, coordsPlayer.Z, coords.X, coords.Y, coords.Z);
if (distance < 10.0f)
{
Debug.WriteLine("You are close to the coordinates");
}
else
{
Debug.WriteLine("You are far from the coordinates");
}
VDIST2
| Property | Value |
|---|---|
| Native Name | VDIST2 |
| Hash | 0xB7A628320EFF8E47 |
| Return Type | float |
| Build | 1207 |
| Parameters | x1 (float), y1 (float), z1 (float), x2 (float), y2 (float), z2 (float) |
Description: Calculates distance between vectors but does not perform Sqrt operations. Its way faster than VDIST, but it's not faster than direct mathematical calculations.
NativeDB Introduced: v323
Parameters
x1(float) — X coordinate of the first point.y1(float) — Y coordinate of the first point.z1(float) — Z coordinate of the first point. Represents the height or elevation at the first point.x2(float) — X coordinate of the second point.y2(float) — Y coordinate of the second point.z2(float) — Z coordinate of the second point. Represents the height or elevation at the second point.
Usage
Lua (Direct):
local result = Vdist2(x1, y1, z1, x2, y2, z2)
Lua (Hash):
local result = Citizen.InvokeNative(0xB7A628320EFF8E47, x1, y1, z1, x2, y2, z2)
VMAG
| Property | Value |
|---|---|
| Native Name | VMAG |
| Hash | 0x652D2EEEF1D3E62C |
| Return Type | float |
| Build | 1207 |
| Parameters | x (float), y (float), z (float) |
Description: ``` Calculates the magnitude of a vector.
### Usage
**Lua (Direct):**
```lua
local result = Vmag(x, y, z)
Lua (Hash):
local result = Citizen.InvokeNative(0x652D2EEEF1D3E62C, x, y, z)
VMAG2
| Property | Value |
|---|---|
| Native Name | VMAG2 |
| Hash | 0xA8CEACB4F35AE058 |
| Return Type | float |
| Build | 1207 |
| Parameters | x (float), y (float), z (float) |
Description: ``` Calculates the magnitude of a vector but does not perform Sqrt operations. (Its way faster)
### Usage
**Lua (Direct):**
```lua
local result = Vmag2(x, y, z)
Lua (Hash):
local result = Citizen.InvokeNative(0xA8CEACB4F35AE058, x, y, z)
WAIT
| Property | Value |
|---|---|
| Native Name | WAIT |
| Hash | 0x4EDE34FBADD967A6 |
| Return Type | void |
| Build | 1207 |
| Parameters | ms (int) |
Description: ``` Pauses execution of the current script, please note this behavior is only seen when called from one of the game script files(ysc). In order to wait an asi script use "static void WAIT(DWORD time);" found in main.h
### Usage
**Lua (Direct):**
```lua
Wait(ms)
Lua (Hash):
Citizen.InvokeNative(0x4EDE34FBADD967A6, ms)