Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update param names, doco and added example #1225

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
}
BJDubb marked this conversation as resolved.
Show resolved Hide resolved
```

## 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.
BJDubb marked this conversation as resolved.
Show resolved Hide resolved

## 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
BJDubb marked this conversation as resolved.
Show resolved Hide resolved

## 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)
BJDubb marked this conversation as resolved.
Show resolved Hide resolved
```
Loading