SetMarkerIcon: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
 
(15 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Needs_Checking|Didn't work with:<pre>
root = getRootElement ()
addEventHandler ( "onResourceStart", root, "ResourceStart" )
function ResourceStart ( name, root )
marker1 = createMarker ( 1935.0825, -1709.9506, 151.77 )
setMarkerIcon ( marker1, "arrow" )
end</pre>
??--[[User:Ransom|Ransom]] 20:00, 10 April 2007 (CDT)}}
__NOTOC__
__NOTOC__
==Description==
{{Server client function}}
This function sets an ID number that corresponds to a particular visual style of marker.
This function allows changing the icon of a checkpoint marker.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">bool setMarkerIcon ( marker theMarker, int icon )</syntaxhighlight>
<syntaxhighlight lang="lua">
bool setMarkerIcon ( marker theMarker, string icon )
</syntaxhighlight>
{{OOP||[[Marker]]:setIcon|icon|getMarkerIcon}}


===Required Arguments===
===Required Arguments===
* '''theMarker''': A [[marker]] class referencing the specified marker.
* '''theMarker:''' The [[marker]] to change the visual style of
* '''icon''': An integer (whole number) referring to the type of icon (see below).
* '''icon:''' A string referring to the type of icon, acceptable values are:
 
**'''"none"''': No icon
==Acceptable icon values==
**'''"arrow"''': Arrow icon. Only 5 arrows can be visible at the same time.
* '''"none"''': No icon
**'''"finish"''': Finish icon (at end of race)
* '''"arrow"''': Arrow icon
* '''"finish"''': Finish (end-race) icon


==Example==
==Example==
<syntaxhighlight lang="lua">theMarker = createMarker ( 1000, 1000,1000, 0, 255, 0, 0 )  
This example creates a finish marker as you'd expect for the end of a race.
setMarkerIcon ( theMarker, "finish" )</syntaxhighlight>
<syntaxhighlight lang="lua">
local newMarker = createMarker ( 0, 0, 2, "checkpoint", 1, 255, 0, 0)  
setMarkerIcon ( newMarker, "finish" )
</syntaxhighlight>


==See Also==
==See Also==
{{Marker functions}}
{{Marker functions}}

Latest revision as of 15:44, 4 July 2024

This function allows changing the icon of a checkpoint marker.

Syntax

bool setMarkerIcon ( marker theMarker, string icon )

OOP Syntax Help! I don't understand this!

Method: Marker:setIcon(...)
Variable: .icon
Counterpart: getMarkerIcon


Required Arguments

  • theMarker: The marker to change the visual style of
  • icon: A string referring to the type of icon, acceptable values are:
    • "none": No icon
    • "arrow": Arrow icon. Only 5 arrows can be visible at the same time.
    • "finish": Finish icon (at end of race)

Example

This example creates a finish marker as you'd expect for the end of a race.

local newMarker = createMarker ( 0, 0, 2, "checkpoint", 1, 255, 0, 0) 
setMarkerIcon ( newMarker, "finish" )

See Also