Skip to content

CreateMarker

Create a marker, can be an 3d text or real actual marker

Argument Data Type Needed Default Description
Id string/number - The id to manage the marker
Coords vector3 - The coordinates to create the marker
Render Distance number - The distance for the render
Interaction Distance number - The distance for the interaction
Options table/string - See the config arguments

Dont need to be called every frame, if called every frame and the marker already exist, sleep the loop for 100 ms to prevent spam


Example

Creating marker

CreateMarker("myid", vector3(-239.89, -989.42, 28.29), 5.0, 5.0, {255, 0, 0})


Creating 3d text

CreateMarker("myid", vector3(-239.89, -989.42, 29.29), 5.0, 5.0, "Press [~g~E~w~] to interact")


Creating a custom marker using a config

local config = {
    rgb = {0, 0, 255},
    type = 29,
    scale = vector3(2.0, 2.0, 3.0),
}

CreateMarker("myid", vector3(-239.89, -989.42, 28.29), 5.0, 5.0, config)

Config arguments
Child Data Type Explanation
job string/table The job that can see and interact with the marker
rgb table The rgb data ({255, 255, 255})
text string The 3d text to be shown
notify string The ButtonNotification data
type number The marker type
direction vector3 The direction of the marker
rotation vector3 The rotation of the marker
scale vector3 The scale of the marker
alpha number The alpha of the marker, from 0 to 255
animation boolean Toggle the bouncing animation
How to listen the interaction

For listen the interaction you need to use the emitter

Example

-- This create the red marker
CreateMarker("myid", vector3(-239.89, -989.42, 28.29), 5.0, 5.0, {255, 0, 0})

-- Listening the interaction
On("marker", function(id)
    if id == "myid" then
        print("Hello")
    end
end)
LSS: If i press E near the marker in the F8 console will be printed Hello


Tip

You can write {r} to generate a random id

Example

CreateMarker("marker_{r}", vector3(-239.89, -989.42, 28.29), 5.0, 5.0, {255, 0, 0})
This will be converted to "marker_51243", the number is the random id generated

To do

Adding more customization


Last update: October 31, 2022
Created: June 27, 2021