GetMarkerType: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(21 intermediate revisions by 7 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
==Description==
{{Server client function}}
This function returns an ID number that corresponds to a particular type of marker.
This function returns a marker's type.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">int getMarkerType ( marker marker)</syntaxhighlight>
<syntaxhighlight lang="lua">string getMarkerType ( marker theMarker )</syntaxhighlight>
{{OOP||[[Marker]]:getMarkerType|markerType|setMarkerType}}
===Required Arguments===
* '''theMarker''': A [[marker]] element referencing the specified marker.


===Required Arguments===
===Returns===
* '''marker''': A [[marker]] class referencing the specified marker.
* Returns one of the following strings:
{{Marker_types}}


==Return Values==
If an invalid marker is specified, ''false'' is returned.
* '''"checkpoint"''': Checkpoint
* '''"ring"''': Ring (doughnut-shaped)
* '''"cylinder"''': Cylinder
* '''"arrow"''': Animated arrow pointing down


==Example==
==Example==
<syntaxhighlight lang="lua">marker = createMarker ( 1000, 1000,1000, 0, 255, 0, 0 )
This function creates a default marker at a given position and outputs its type.
gettype = getMarkerType (marker)
<syntaxhighlight lang="lua">
if (gettype == 0)
function createMarkerAndOutputType ( ... )
  serverChat ("Checkpoint marker.")
    -- we create the marker.
else
    local theMarker = createMarker ( ... )
  serverChat ("Corona marker.")
    -- if the marker was created.
end</syntaxhighlight>
    if isElement ( theMarker ) then
        -- then get its type.
        local markerType = getMarkerType ( theMarker )
        -- and output it.
        return outputChatBox ( "It's a " .. markerType .. " marker!" )
    end
end
 
-- Create a marker and show its type in chat.
createMarkerAndOutputType(0, 0, 2, "cylinder", 2)
</syntaxhighlight>
 
==See Also==
{{Marker functions}}

Latest revision as of 13:43, 10 October 2023

This function returns a marker's type.

Syntax

string getMarkerType ( marker theMarker )

OOP Syntax Help! I don't understand this!

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


Required Arguments

  • theMarker: A marker element referencing the specified marker.

Returns

  • Returns one of the following strings:
    • "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.

If an invalid marker is specified, false is returned.

Example

This function creates a default marker at a given position and outputs its type.

function createMarkerAndOutputType ( ... )
    -- we create the marker.
    local theMarker = createMarker ( ... )
    -- if the marker was created.
    if isElement ( theMarker ) then
        -- then get its type.
        local markerType = getMarkerType ( theMarker )
        -- and output it.
        return outputChatBox ( "It's a " .. markerType .. " marker!" )
    end
end

-- Create a marker and show its type in chat.
createMarkerAndOutputType(0, 0, 2, "cylinder", 2)

See Also