ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. isElementNear

Function

isElementNear

Server and clientElementsTrilogy Hub only

Checks whether an element is within a radius of another element or of a point. For a target element it also checks the dimension and interior.

Syntax

bool isElementNear(element element, mixed ...)

Arguments

elementelement
The element to check.
...mixed
target, radius or x, y, z, radius[, dimension, interior].

Returns

true if the element is in range; also false for an invalid element.

Example

addCommandHandler("napraw", function(player)
    if not isElementNear(player, 1024, -1024, 32, 5) then
        outputChatBox("Podejdź do warsztatu.", player)
        return
    end
    local veh = getPedOccupiedVehicle(player)
    if veh then fixVehicle(veh) end
end)

See also