From a0cd5a1672ce2ce0216cc1f7cff24f3b01e043ca Mon Sep 17 00:00:00 2001 From: Niek <32094562+niekschoemaker@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:14:28 +0200 Subject: [PATCH 1/3] Update IsEntityAtCoord.md --- ENTITY/IsEntityAtCoord.md | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/ENTITY/IsEntityAtCoord.md b/ENTITY/IsEntityAtCoord.md index 3710c0542..c7c3320e2 100644 --- a/ENTITY/IsEntityAtCoord.md +++ b/ENTITY/IsEntityAtCoord.md @@ -8,21 +8,26 @@ ns: ENTITY BOOL IS_ENTITY_AT_COORD(Entity entity, float xPos, float yPos, float zPos, float xSize, float ySize, float zSize, BOOL p7, BOOL p8, int p9); ``` -``` -Checks if entity is within x/y/zSize distance of x/y/z. -Last three are unknown ints, almost always p7 = 0, p8 = 1, p9 = 0 -``` +Checks if the entity is within the given square of size xSize, ySize, zSize centered around the given coordinates. + +The sizes given are the apothem (half of side) of the square, so a size of 5 would result in a square of 10x10, not 5x5. + + +For the highlightArea, if do3dCheck is true, the marker will be drawn at the bottom of the target area. So if the square is centered on the ground with a zSize larger than 0, the marker will appear under the ground. +The marker also doesn't scale, so it is always the same size (around half a meter). +So unfortunately the marker isn't that useful as it doesn't convey the correct information about the area (the marker doesn't reflect when the player is actually in the marker or not) ## Parameters * **entity**: -* **xPos**: -* **yPos**: -* **zPos**: -* **xSize**: -* **ySize**: -* **zSize**: -* **p7**: -* **p8**: -* **p9**: +* **xPos**: The position of the square along the x-axis +* **yPos**: The position of the square along the y-axis +* **zPos**: The position of the square along the z-axis (only applicable if do3dCheck is true) +* **xSize**: The apothem of the square along the x-axis +* **ySize**: The apothem of the square along the y-axis +* **zSize**: The apothem of the square along the z-axis (only applicable if do3dCheck is true) +* **highlightArea**: Whether to draw a marker (yellow cylindrical marker at the given coords) +* **do3dCheck**: Whether to check the z-axis +* **transportMode**: Checks the transport mode the ped is using, only does something if entity is a ped. Transport modes are: 0 (any), 1 (on foot), 2 (in vehicle) ## Return value +true if the entity is within the given square area From 9c84a5c822e68f13d84e956770969ce948fb4ba6 Mon Sep 17 00:00:00 2001 From: Niek <32094562+niekschoemaker@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:19:33 +0200 Subject: [PATCH 2/3] Update IsEntityAtCoord.md Add example and description for entity parameter --- ENTITY/IsEntityAtCoord.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ENTITY/IsEntityAtCoord.md b/ENTITY/IsEntityAtCoord.md index c7c3320e2..48b657b85 100644 --- a/ENTITY/IsEntityAtCoord.md +++ b/ENTITY/IsEntityAtCoord.md @@ -18,7 +18,7 @@ The marker also doesn't scale, so it is always the same size (around half a mete So unfortunately the marker isn't that useful as it doesn't convey the correct information about the area (the marker doesn't reflect when the player is actually in the marker or not) ## Parameters -* **entity**: +* **entity**: The entity to check the position of * **xPos**: The position of the square along the x-axis * **yPos**: The position of the square along the y-axis * **zPos**: The position of the square along the z-axis (only applicable if do3dCheck is true) @@ -31,3 +31,16 @@ So unfortunately the marker isn't that useful as it doesn't convey the correct i ## Return value true if the entity is within the given square area + +## Examples +```lua +-- Simple demonstration which slides the ped along the x and y axis until the ped is outside the given area +local offset = 10 +while IsEntityAtCoord(PlayerPedId(), coords.x, coords.y, coords.z, 20.0, 20.0, 20.0, false, false, 0) do + offset += 0.1 + local targetCoords = coords + vector3(offset, offset, 0) + SetEntityCoords(PlayerPedId(), targetCoords.x, targetCoords.y, targetCoords.z) + Citizen.Wait(0) +end +print(i) -- Prints 20.1, as expected +``` From 7f27e5ebcb758bb689c67b0ca1dca7a767adbbfc Mon Sep 17 00:00:00 2001 From: Niek <32094562+niekschoemaker@users.noreply.github.com> Date: Wed, 30 Oct 2024 19:17:03 +0100 Subject: [PATCH 3/3] Update IsEntityAtCoord.md --- ENTITY/IsEntityAtCoord.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ENTITY/IsEntityAtCoord.md b/ENTITY/IsEntityAtCoord.md index 48b657b85..222bccc7b 100644 --- a/ENTITY/IsEntityAtCoord.md +++ b/ENTITY/IsEntityAtCoord.md @@ -5,7 +5,7 @@ ns: ENTITY ```c // 0x20B60995556D004F 0xD749B606 -BOOL IS_ENTITY_AT_COORD(Entity entity, float xPos, float yPos, float zPos, float xSize, float ySize, float zSize, BOOL p7, BOOL p8, int p9); +BOOL IS_ENTITY_AT_COORD(Entity entity, float xPos, float yPos, float zPos, float xSize, float ySize, float zSize, BOOL highlightArea, BOOL do3dCheck, int transportMode); ``` Checks if the entity is within the given square of size xSize, ySize, zSize centered around the given coordinates. @@ -30,7 +30,7 @@ So unfortunately the marker isn't that useful as it doesn't convey the correct i * **transportMode**: Checks the transport mode the ped is using, only does something if entity is a ped. Transport modes are: 0 (any), 1 (on foot), 2 (in vehicle) ## Return value -true if the entity is within the given square area +A boolean value which represents if the entity is within the given square area. ## Examples ```lua