IsPositionOccupied
Docslocal retval = IsPositionOccupied(x, y, z, range, p4, checkVehicles, checkPeds, p7, p8, ignoreEntity, p10)Description
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.
Parameters
| Name | Type | Description |
|---|---|---|
x | float | X coordinate of the position to check. |
y | float | Y coordinate of the position to check. |
z | float | Z coordinate of the position to check. |
range | float | The range, seems to not be very accurate during testing. |
p4 | BOOL | Unknown, when set to true it seems to always return true no matter what I try. |
checkVehicles | BOOL | Check for any vehicles in that area. |
checkPeds | BOOL | Check for any peds in that area. |
p7 | BOOL | Unknown. |
p8 | BOOL | Unknown. |
ignoreEntity | Entity | This entity will be ignored if it's in the area. Set to 0 if you don't want to exclude any entities. |
p10 | BOOL | Unknown. |
Quick Snippet: Get Coordinatesxyz
xyzAdd this command to your client script to retrieve precise locations in-game.
-- Add this to your client.lua. Type /pos in-game to copy coords.
RegisterCommand('pos', function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local heading = GetEntityHeading(ped)
local output = string.format("vector4(%.2f, %.2f, %.2f, %.2f)", coords.x, coords.y, coords.z, heading)
print(output)
TriggerEvent('chat:addMessage', { args = { '^4[COORD]^0', output } })
end)Quick Snippet: Get EntityignoreEntity
ignoreEntityUse this to obtain an entity handle from the player's aim or crosshair.
-- Get the entity the player is aiming at
local ped = PlayerPedId()
local hit, entity = GetEntityPlayerIsFreeAimingAt(PlayerId())
if hit and entity ~= 0 then
print("Entity: " .. entity)
print("Model: " .. GetEntityModel(entity))
print("Type: " .. GetEntityType(entity)) -- 1=Ped, 2=Vehicle, 3=Object
endReturns
BOOLReturns TRUE (1) or FALSE (0).