CreateMarker: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 7: Line 7:


==Syntax==
==Syntax==
[[marker]] [[createMarker]] ( float x, float y, float z, [int type, int size, int r, int g, int b, int a] )
<syntaxhighlight lang="lua">
marker createMarker ( float x, float y, float z, [int type, int size, int r, int g, int b, int a] )
</syntaxhighlight>


===Required Arguments===
===Required Arguments===
Line 25: Line 27:


==Example==
==Example==
function [[onPlayerChat]] ( player, chat )
<syntaxhighlight lang="lua">
  if ( [[strtok]] ( chat, 1, 32 ) == "!createmarker" ) then
function onPlayerChat ( player, chat )
    x, y, z = [[getPlayerPosition]] ( player )
if ( strtok ( chat, 1, 32 ) == "!createmarker" ) then
    [[createMarker]] ( x + 5, y, z, 0, 1, 255, 0, 0, 255 )
x, y, z = getPlayerPosition ( player )
    [[playerPM]] ( player, "You got a red marker" )
createMarker ( x + 5, y, z, 0, 1, 255, 0, 0, 255 )
  end
playerPM ( player, "You got a red marker" )
end
end
end
</syntaxhighlight>

Revision as of 01:15, 19 May 2006

This function creates a marker and returns a handle to the created marker. If it fails, it will return false.

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.

See also createCheckpoint.

Syntax

marker createMarker ( float x, float y, float z, [int type, int size, int r, int g, int b, int a] )

Required Arguments

  • 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.
  • type: The visual type of the marker to be created. Possible values:
    • "checkpoint": Checkpoint
    • "ring": Ring (doughnut-shaped)
    • "cylinder": Cylinder
    • "arrow": Animated arrow pointing down
  • 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).

Example

function onPlayerChat ( player, chat )
	if ( strtok ( chat, 1, 32 ) == "!createmarker" ) then
		x, y, z = getPlayerPosition ( player )
		createMarker ( x + 5, y, z, 0, 1, 255, 0, 0, 255 )
		playerPM ( player, "You got a red marker" )
	end
end