SetMarkerType: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(Fix OOP)
 
(21 intermediate revisions by 10 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
==Description==
{{Server client function}}
This function sets an ID number that corresponds to a particular visual style of marker.
This function changes a marker's type. The type controls how the marker is displayed in the game. It's important that you use marker types that users are used to from the single player game. For example, checkpoints are used in races, rings are used for aircraft races, arrows are used for entering buildings etc.  


==Syntax==
==Syntax==
bool setMarkerType ( [[marker]] marker, int type)
<syntaxhighlight lang="lua">bool setMarkerType ( marker theMarker, string markerType )</syntaxhighlight>
 
{{OOP||[[Marker]]:setMarkerType|markerType|getMarkerType}}
===Required Arguments===
===Required Arguments===
* '''marker''': A [[marker]] class referencing the specified marker.
* '''theMarker''': A [[marker]] element referencing the specified marker.
* '''type''': An integer (whole number) referring to the type of marker (see below).
* '''markerType''': A string denoting the marker type. Valid values are:
{{Marker types}}


==Acceptable type values==
==Returns==
* '''0''': Checkpoint
Returns ''true'' if the marker type was changed, ''false'' if it wasn't or marker values were invalid.
* '''1''': Corona (doughnut-shaped)


==Example==
==Example==
marker = [[createMarker]] ( 1000, 1000,1000, 0, 255, 0, 0 )
This function changes all existing markers' type to the specified one.
<syntaxhighlight lang="lua">
setMarkerType ( marker, 1)
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
</syntaxhighlight>
 
==See Also==
{{Marker functions}}

Latest revision as of 10:11, 11 February 2015

This function changes a marker's type. The type controls how the marker is displayed in the game. It's important that you use marker types that users are used to from the single player game. For example, checkpoints are used in races, rings are used for aircraft races, arrows are used for entering buildings etc.

Syntax

bool setMarkerType ( marker theMarker, string markerType )

OOP Syntax Help! I don't understand this!

Method: Marker:setMarkerType(...)
Variable: .markerType
Counterpart: getMarkerType


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

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