findSpawnPointInDirection
FIND_SPAWN_POINT_IN_DIRECTION0x6874E2190B0C1972The GTA V native FIND_SPAWN_POINT_IN_DIRECTION of the MISC namespace, as LS:MP client scripts call it: the global function findSpawnPointInDirection, in JavaScript and in Lua.
findSpawnPointInDirection(
posX: number,
posY: number,
posZ: number,
fwdVecX: number,
fwdVecY: number,
fwdVecZ: number,
distance: number
): [ok: boolean, spawnPoint: { x: number, y: number, z: number }]findSpawnPointInDirection(
posX: number,
posY: number,
posZ: number,
fwdVecX: number,
fwdVecY: number,
fwdVecZ: number,
distance: number
): boolean, Vector3Usage
const [ok, spawnPoint] = findSpawnPointInDirection(
posX, posY, posZ, fwdVecX, fwdVecY, fwdVecZ, distance
);local ok, spawnPoint = findSpawnPointInDirection(
posX, posY, posZ, fwdVecX, fwdVecY, fwdVecZ, distance
)Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.
const [ok, spawnPoint] = findSpawnPointInDirection(pos, fwdVec, distance);local ok, spawnPoint = findSpawnPointInDirection(pos, fwdVec, distance)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
posX | float | number | number |
posY | float | number | number |
posZ | float | number | number |
fwdVecX | float | number | number |
fwdVecY | float | number | number |
fwdVecZ | float | number | number |
distance | float | number | number |
Returns
2 values, in this order: an array in JavaScript, multiple return values in Lua.
| # | Value | Type | JavaScript | Lua | Description |
|---|---|---|---|---|---|
| 1 | ok | BOOL | boolean | boolean | The native’s own return value. |
| 2 | spawnPoint | Vector3 | { x: number, y: number, z: number } | Vector3 | output |
Notes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
Finds a position ahead of the player by predicting the players next actions.
The positions match path finding node positions.
When roads diverge, the position may rapidly change between two or more positions. This is due to the engine not being certain of which path the player will take.
Reference
- Namespace
- Misc MISC
- In the game
BOOL FIND_SPAWN_POINT_IN_DIRECTION(float posX, float posY, float posZ, float fwdVecX, float fwdVecY, float fwdVecZ, float distance, Vector3* spawnPoint)- Hash
0x6874E2190B0C1972