Points
Points are a better way to handle player proximity events. They are more efficient than using a CreateThread
to check if a player is near a certain point.
Properties
coords
- type:
table
/vector3
- description: The coordinates of the point
- type:
distance
- type:
number
- description: The distance to draw the point at
- type:
hidden
- type:
boolean
- description: Whether the point is hidden or not
- type:
enter
- type:
function
- description: A function that is called when the player enters the point
- type:
leave
- type:
function
- description: A function that is called when the player leaves the point
- type:
inside
- type:
function
- description: A function that is called every frame when player is inside the point
- type:
Create a Point
local point = ESX.Point:new({
coords = vector3(0.0, 0.0, 0.0),
distance = 15.0,
enter = function()
print("Entered point")
end,
leave = function()
print("Left point")
end,
inside = function(point)
local distance = point.currDistance
print("Inside point, distance: " .. distance)
end
})
Delete a Point
---- [[ Create a point ]] ----#
local point = [[ Point Class ]]
point:delete()
Hide/UnHide a Point
---- [[ Create a point ]] ----
local point = [[ Point Class ]]
local hidden = true
point:toggle(hidden)