isPositionOccupied
IS_POSITION_OCCUPIED0xADCDE75E1C60F32DThe GTA V native IS_POSITION_OCCUPIED of the MISC namespace, as LS:MP client scripts call it: the global function isPositionOccupied, in JavaScript and in Lua.
isPositionOccupied(
x: number,
y: number,
z: number,
range: number,
p4: boolean,
checkVehicles: boolean,
checkPeds: boolean,
p7: boolean,
p8: boolean,
ignoreEntity: Entity,
p10: boolean
): booleanisPositionOccupied(
x: number,
y: number,
z: number,
range: number,
p4: boolean,
checkVehicles: boolean,
checkPeds: boolean,
p7: boolean,
p8: boolean,
ignoreEntity: Entity,
p10: boolean
): booleanUsage
const result = isPositionOccupied(
x, y, z, range, p4, checkVehicles, checkPeds, p7, p8, ignoreEntity, p10
);local result = isPositionOccupied(
x, y, z, range, p4, checkVehicles, checkPeds, p7, p8, ignoreEntity, p10
)Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.
const result = isPositionOccupied(
pos, range, p4, checkVehicles, checkPeds, p7, p8, ignoreEntity, p10
);local result = isPositionOccupied(
pos, range, p4, checkVehicles, checkPeds, p7, p8, ignoreEntity, p10
)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
x | float | number | number |
y | float | number | number |
z | float | number | number |
range | float | number | number |
p4 | BOOL | boolean | boolean |
checkVehicles | BOOL | boolean | boolean |
checkPeds | BOOL | boolean | boolean |
p7 | BOOL | boolean | boolean |
p8 | BOOL | boolean | boolean |
ignoreEntity | Entity | number | integer |
p10 | BOOL | boolean | boolean |
Returns
BOOL JavaScript boolean, Lua booleanNotes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
range: The range, seems to not be very accurate during testing.p4: Unknown, when set to true it seems to always return true no matter what I try.checkVehicle: Check for any vehicles in that area.checkPeds: Check for any peds in that area.ignoreEntity: This entity will be ignored if it's in the area. Set to 0 if you don't want to exclude any entities.
The BOOL parameters that are documented have not been confirmed. They are just documented from what I've found during testing. They may not work as expected in all cases.
Returns true if there is anything in that location matching the provided parameters.
Reference
- Namespace
- Misc MISC
- In the game
BOOL IS_POSITION_OCCUPIED(float x, float y, float z, float range, BOOL p4, BOOL checkVehicles, BOOL checkPeds, BOOL p7, BOOL p8, Entity ignoreEntity, BOOL p10)- Hash
0xADCDE75E1C60F32D