SetMarkerType: Difference between revisions

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


==Example==
==Example==
This function changes all existing markers' type to the specified one (server side).
<section name="Server" class="both" show="true">
This function changes all existing markers' type to the specified one.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function changeAllMarkersType ( newMarkerType )
function changeAllMarkersType ( newMarkerType )
Line 28: Line 29:
end
end
end
end
</syntaxhighlight>
</syntaxhighlight> </section>


==See Also==
==See Also==
{{Marker functions}}
{{Marker functions}}
{{Server client function}}

Revision as of 23:13, 14 August 2007

This function changes a marker's type.

Syntax

server:

bool setMarkerType ( marker theMarker, string markerType )

client:

marker setMarkerType ( marker theMarker, string markerType )

Required Arguments

  • theMarker: A marker element referencing the specified marker.
  • markerType: A string denoting the marker type. Valid values are:
    • "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.

Returns

Returns true if the marker type was changed, false if it wasn't or marker values were invalid.

Example

Click to collapse [-]
Server

This function changes all existing markers' type to the specified one.

function changeAllMarkersType ( newMarkerType )
	-- we store a table with all markers
	local allMarkers = getElementsByType( "marker" )
	-- for each marker in it,
	for index, aMarker in ipairs(allMarkers) do
		-- set its type to the one passed to this function
		setMarkerType( aMarker, newMarkerType )
	end
end

See Also