Skip to content

Commit

Permalink
Update param names, doco and added example
Browse files Browse the repository at this point in the history
  • Loading branch information
BJDubb committed Nov 8, 2024
1 parent 35b42e8 commit a1fce57
Showing 1 changed file with 41 additions and 14 deletions.
55 changes: 41 additions & 14 deletions ENTITY/IsEntityAtCoord.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

0 comments on commit a1fce57

Please sign in to comment.