First we need to create a marker.
telemarker1 = createMarker ( x, y, z, "type", size, r, g, b, a )
x: A floating point number representing the X coordinate on the map.
y: A floating point number representing the Y coordinate on the map.
z: A floating point number representing the Z coordinate on the map.
theType: The visual type of the marker to be created. Possible values:
- "checkpoint": A race checkpoint. These are very tall, but not infinite, light pillars. Checkpoints snap to ground and become invisible after going over a certain Z height.
- "ring": Doughnut shaped ring, normally used for aircraft.
- "cylinder": Small glowing ground ring. These are the glow markers you walk into to activate missions or events in single player.
- "arrow": Arrow pointing down. These are the arrows on the doors you can enter in single player, except MTA's are not animated by default.
- "corona": A glowing ball of light.
size: The diameter of the marker to be created, in meters.
r: An integer number representing the amount of red to use in the colouring of the marker (0 - 255).
g: An integer number representing the amount of green to use in the colouring of the marker (0 - 255).
b: An integer number representing the amount of blue to use in the colouring of the marker (0 - 255).
a: An integer number representing the amount of alpha to use in the colouring of the marker (0 - 255 where 0 is transparent and 255 is opaque).
Then, we need to add function:
function Teleport
setElementPosition ( source, x, y, z, warp = true )
end
addEventHandler( "onMarkerHit", telemarker1, Teleport)
x: The x coordinate of the destination.
y: The y coordinate of the destination.
z: The z coordinate of the destination.
warp: teleports players, resetting any animations they were doing. Setting this to false preserves the current animation.
Now our script needs to look like this:
telemarker1 = createMarker ( -2596.625, 579.358, 15.626, "cylinder", 2.0, 255, 0, 0, 150 )
function Teleport
setElementPosition ( source, 5540, 1020, 1240, false )
end
addEventHandler( "onMarkerHit", telemarker1, Teleport)