From a1fce575974db1688d8617cfcc985b3a48d085c2 Mon Sep 17 00:00:00 2001 From: Beckam White Date: Sat, 9 Nov 2024 05:17:37 +1100 Subject: [PATCH 1/5] Update param names, doco and added example --- ENTITY/IsEntityAtCoord.md | 55 +++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/ENTITY/IsEntityAtCoord.md b/ENTITY/IsEntityAtCoord.md index 3710c0542..2fc3aa989 100644 --- a/ENTITY/IsEntityAtCoord.md +++ b/ENTITY/IsEntityAtCoord.md @@ -5,24 +5,51 @@ 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 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's root is located in the given area defined by a centre point and a locate size. +Specifying a non-zero transport mode will return false early if the entity does not meet the requirements of the transport mode. + +```c +enum transportMode +{ + TM_ANY, + TM_ON_FOOT, + TM_IN_VEHICLE, +} ``` ## Parameters -* **entity**: -* **xPos**: -* **yPos**: -* **zPos**: -* **xSize**: -* **ySize**: -* **zSize**: -* **p7**: -* **p8**: -* **p9**: +* **entity**: entity to check +* **xPos**: X position of point to check +* **yPos**: Y position of point to check +* **zPos**: Z position of point to check +* **xSize**: X size of area to check +* **ySize**: Y size of area to check +* **zSize**: Z size of area to check +* **highlightArea**: draws a small marker at the center of the point +* **do3dCheck**: whether or not to check the z dimension +* **transportMode**: 0 for any, 1 for on foot, 2 for in vehicle. ## Return value +* **TRUE**: if the entity is within the bounds specified and aligns with the transport mode +* **FALSE**: if the entity is not within the bounds specified or does not align with the transport mode + +## Examples +```lua +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + + local player = PlayerPedId() + local point = vec3(-3041.72, 32.72, 8.52) + local size = vec3(10.0, 10.0, 0.0) + local highlightArea = true + local do3DCheck = false + local transportMode = 0 + + local isEntityInCoords = IsEntityAtCoord(player, point, size, highlightArea, do3DCheck, transportMode) + end +end) +``` \ No newline at end of file From 35c85979306d544185e3adfd10a31d0c3e068479 Mon Sep 17 00:00:00 2001 From: Beckam White <47697544+BJDubb@users.noreply.github.com> Date: Wed, 20 Nov 2024 10:05:14 +1000 Subject: [PATCH 2/5] Update ENTITY/IsEntityAtCoord.md align enum convention with other natives Co-authored-by: Jacob Paulin <56453471+JayPaulinCodes@users.noreply.github.com> --- ENTITY/IsEntityAtCoord.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ENTITY/IsEntityAtCoord.md b/ENTITY/IsEntityAtCoord.md index 2fc3aa989..8b62d017b 100644 --- a/ENTITY/IsEntityAtCoord.md +++ b/ENTITY/IsEntityAtCoord.md @@ -12,11 +12,11 @@ Checks if the entity's root is located in the given area defined by a centre poi Specifying a non-zero transport mode will return false early if the entity does not meet the requirements of the transport mode. ```c -enum transportMode +enum eTransportMode { - TM_ANY, - TM_ON_FOOT, - TM_IN_VEHICLE, + TM_ANY = 0, + TM_ON_FOOT = 1, + TM_IN_VEHICLE = 2, } ``` From ac67c2cf0cf8d8c8dd002a80eb1800adcab41223 Mon Sep 17 00:00:00 2001 From: Beckam White <47697544+BJDubb@users.noreply.github.com> Date: Wed, 20 Nov 2024 10:05:38 +1000 Subject: [PATCH 3/5] Update ENTITY/IsEntityAtCoord.md add reference to enum Co-authored-by: Jacob Paulin <56453471+JayPaulinCodes@users.noreply.github.com> --- ENTITY/IsEntityAtCoord.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ENTITY/IsEntityAtCoord.md b/ENTITY/IsEntityAtCoord.md index 8b62d017b..d05f46ca0 100644 --- a/ENTITY/IsEntityAtCoord.md +++ b/ENTITY/IsEntityAtCoord.md @@ -30,7 +30,7 @@ enum eTransportMode * **zSize**: Z size of area to check * **highlightArea**: draws a small marker at the center of the point * **do3dCheck**: whether or not to check the z dimension -* **transportMode**: 0 for any, 1 for on foot, 2 for in vehicle. +* **transportMode**: The transport mode used for the check (See `eTransportMode` enum) ## Return value * **TRUE**: if the entity is within the bounds specified and aligns with the transport mode From cb93fe87ea98c09990786b40cf511edbebe31a25 Mon Sep 17 00:00:00 2001 From: Beckam White <47697544+BJDubb@users.noreply.github.com> Date: Wed, 20 Nov 2024 10:05:52 +1000 Subject: [PATCH 4/5] Update ENTITY/IsEntityAtCoord.md better return values formatting Co-authored-by: Jacob Paulin <56453471+JayPaulinCodes@users.noreply.github.com> --- ENTITY/IsEntityAtCoord.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ENTITY/IsEntityAtCoord.md b/ENTITY/IsEntityAtCoord.md index d05f46ca0..f1ce7a549 100644 --- a/ENTITY/IsEntityAtCoord.md +++ b/ENTITY/IsEntityAtCoord.md @@ -33,8 +33,7 @@ enum eTransportMode * **transportMode**: The transport mode used for the check (See `eTransportMode` enum) ## Return value -* **TRUE**: if the entity is within the bounds specified and aligns with the transport mode -* **FALSE**: if the entity is not within the bounds specified or does not align with the transport mode +Returns `true` if the entity is within the bounds specified and aligns with the transport mode, `false` otherwise. ## Examples ```lua From bd2331e009c3903419777117e0540a5e064dba12 Mon Sep 17 00:00:00 2001 From: Beckam White <47697544+BJDubb@users.noreply.github.com> Date: Wed, 20 Nov 2024 10:06:34 +1000 Subject: [PATCH 5/5] Update ENTITY/IsEntityAtCoord.md Co-authored-by: Jacob Paulin <56453471+JayPaulinCodes@users.noreply.github.com> --- ENTITY/IsEntityAtCoord.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ENTITY/IsEntityAtCoord.md b/ENTITY/IsEntityAtCoord.md index f1ce7a549..405a16ec4 100644 --- a/ENTITY/IsEntityAtCoord.md +++ b/ENTITY/IsEntityAtCoord.md @@ -37,13 +37,13 @@ Returns `true` if the entity is within the bounds specified and aligns with the ## Examples ```lua -Citizen.CreateThread(function() +CreateThread(function() while true do - Citizen.Wait(0) + Wait(0) local player = PlayerPedId() - local point = vec3(-3041.72, 32.72, 8.52) - local size = vec3(10.0, 10.0, 0.0) + local point = vector3(-3041.72, 32.72, 8.52) + local size = vector3(10.0, 10.0, 0.0) local highlightArea = true local do3DCheck = false local transportMode = 0