CreateMarker: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 36: | Line 36: | ||
==Example== | ==Example== | ||
''Example 1:'' This example creates a marker next to the player when they type 'createmarker': | '''Example 1:''' This example creates a marker next to the player when they type 'createmarker': | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addCommandHandler ( "createmarker", "consoleCreateMarker" ) | addCommandHandler ( "createmarker", "consoleCreateMarker" ) | ||
Line 54: | Line 54: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
''Example 2:'' Create a marker at the coordinates 0, 0, 20: | '''Example 2:''' Create a marker at the coordinates 0, 0, 20: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
createMarker ( 0, 0, 20 ) | createMarker ( 0, 0, 20 ) |
Revision as of 01:16, 22 September 2006
This article needs checking. | |
Reason(s):
|
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.
Syntax
marker createMarker ( float x, float y, float z, [string 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.
Optional arguments
- type: The visual type of the marker to be created. Possible values:
- "checkpoint": Checkpoint (Note: Currently z position is always ground-level. Only remains visible to a certain height.)
- "ring": Ring (doughnut-shaped)
- "cylinder": Cylinder (Note: Currently z position is always ground-level.)
- "arrow": Animated arrow pointing down
- "corona": A glowing area
- 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).
Returns
Returns the marker element that was created, or false if the arguments are incorrect.
Example
Example 1: This example creates a marker next to the player when they type 'createmarker':
addCommandHandler ( "createmarker", "consoleCreateMarker" ) -- this function is called whenever someone types 'createmarker' in the console: function consoleCreateMarker ( 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 ( theMarker ) then -- check if the marker was created successfully outputConsole ( "Marker created successfully", thePlayer ) else outputConsole ( "Failed to create marker", thePlayer ) end end end
Example 2: Create a marker at the coordinates 0, 0, 20:
createMarker ( 0, 0, 20 )
See Also
- createMarker
- getMarkerColor
- getMarkerCount
- getMarkerIcon
- getMarkerSize
- getMarkerTarget
- getMarkerType
- setMarkerColor
- setMarkerIcon
- setMarkerSize
- setMarkerTarget
- setMarkerType
- isElementWithinMarker