PointInRange
Example
---@type NssLibsPointInRangeApi
local pir_api = exports.nss_libs:getPointInRangeApi(GetCurrentResourceName())
---@type NssLibsPointInRangeListenerApi
local pir_listener
local radius = 10.0
local x, y, z = 0.0, 0.0, 0.0
local on_enter = function()
-- Do something when player enters the radius
print("Entered the location")
-- Ensure the player can only enter once for all time ;)
if pir_listener then
pir_listener.remove()
end
end
local on_leave = function()
-- Do something when player leaves the radius
print("Left the location")
end
-- Ignore the nearest check
pir_listener = pir_api.add(x, y, z, radius, on_enter, on_leave, pir_api.IGNORE_NEAREST_CHECK)
-- Nearest point wins (excluding points that ignore the nearest check)
pir_listener = pir_api.add(x, y, z, radius, on_enter, on_leave)TODO
Last updated
Was this helpful?