createMarker | Multi Theft Auto: Wiki Skip to content

createMarker

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function creates a marker. A marker is a 3D model in the world that can highlight a particular point or area, often used to instruct players where to go to perform actions such as entering buildings.

Caution

When using type "arrow" markers, you may experience positioning issues. This is a known issue with how GTA creates these types of markers. It is recommended you keep the position at least 1 game unit above the ground to avoid issues.

Caution

"cylinder" marker type doesn't have the same size for collisions and visible textures. Note that the marker collisions are around 10-20% bigger than the visible texture.

Syntax

createMarker ( )

Code Examples

server

This example creates a marker next to the player when they type 'createmarker':

-- this function is called whenever someone types 'createmarker' in the chat:
function chatCreateMarker ( thePlayer, commandName )
if ( thePlayer ) then
local x, y, z = getElementPosition ( thePlayer ) -- get the player's position
-- create a cylindrical marker next to the player:
local theMarker = createMarker ( x + 2, y + 2, z, "cylinder", 1.5, 255, 255, 0, 170 )
if isElement ( theMarker ) then -- check if the marker was created successfully
outputChatBox ( "Marker created successfully", thePlayer, 0, 255, 0 )
else
outputChatBox ( "Failed to create marker", thePlayer, 255, 0, 0 )
end
end
end
addCommandHandler ( "createmarker", chatCreateMarker )