Pathfind::getSafeCoordForPed: Difference between revisions
(yay) |
mNo edit summary |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
When onGround == true outPosition is a position located on the nearest pavement.<br><br>When a safe coord could not be found the result of a function is false and outPosition == Vector3.Zero.<br><br>In the scripts these flags are used: 0, 14, 12, 16, 20, 21, 28. 0 is most commonly used, then 16. <br><br>16 works for me, 0 crashed the script.==Syntax==<syntaxhighlight lang="javascript">pathfind.getSafeCoordForPed(x, y, z, onGround | When onGround == true outPosition is a position located on the nearest pavement.<br><br>When a safe coord could not be found the result of a function is false and outPosition == Vector3.Zero.<br><br>In the scripts these flags are used: 0, 14, 12, 16, 20, 21, 28. 0 is most commonly used, then 16. <br><br>16 works for me, 0 crashed the script. | ||
==Syntax== | |||
<syntaxhighlight lang="javascript">mp.game.pathfind.getSafeCoordForPed(x, y, z, onGround, flags);</syntaxhighlight> | |||
=== Required Arguments === | |||
*'''x:''' float | |||
*'''y:''' float | |||
*'''z:''' float | |||
*'''onGround:''' Boolean | |||
*'''flags:''' int | |||
===Return value=== | |||
*'''Vector3''' | |||
==Example== | |||
<syntaxhighlight lang="javascript"> | |||
let | |||
position = mp.players.local.position | |||
; | |||
position = mp.game.pathfind.getSafeCoordForPed(position.x, position.y, position.z, true, 28); // 16 | |||
</syntaxhighlight> | |||
==See also== | |||
{{Pathfind_s_function_c}} | |||
[[Category:Clientside API]] | |||
[[Category:TODO: Example]] | |||
Latest revision as of 23:49, 21 October 2021
When onGround == true outPosition is a position located on the nearest pavement.
When a safe coord could not be found the result of a function is false and outPosition == Vector3.Zero.
In the scripts these flags are used: 0, 14, 12, 16, 20, 21, 28. 0 is most commonly used, then 16.
16 works for me, 0 crashed the script.
Syntax
mp.game.pathfind.getSafeCoordForPed(x, y, z, onGround, flags);
Required Arguments
- x: float
- y: float
- z: float
- onGround: Boolean
- flags: int
Return value
- Vector3
Example
let
position = mp.players.local.position
;
position = mp.game.pathfind.getSafeCoordForPed(position.x, position.y, position.z, true, 28); // 16