SetMarkerColor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(fixed example)
 
(5 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
This function sets the color of the specified marker by modifying the values for red, green and blue.
{{Server client function}}
This function sets the color of the specified marker by modifying the values for red, green, blue and alpha.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">bool setMarkerColor ( marker marker, int r, int g, int b, int a )</syntaxhighlight>
<syntaxhighlight lang="lua">bool setMarkerColor ( marker theMarker, int r, int g, int b, int a )</syntaxhighlight>
 
{{OOP||[[Marker]]:setColor||getMarkerColor}}
===Required Arguments===
===Required Arguments===
*'''marker''': The [[marker]] that you wish to set the color of.
*'''theMarker:''' The [[marker]] that you wish to set the color of.
*'''r''': The amount of red in the final color (0 to 255).
*'''r:''' The amount of red in the final color (0 to 255).
*'''g''': The amount of green in the final color (0 to 255).
*'''g:''' The amount of green in the final color (0 to 255).
*'''b''': The amount of blue in the final color (0 to 255).
*'''b:''' The amount of blue in the final color (0 to 255).
*'''a''': The amount of alpha in the final color (0 to 255).
*'''a:''' The amount of alpha in the final color (0 to 255).


==Example==
==Example==
<syntaxhighlight lang="lua">newmarker = createMarker ( 1000, 1000, 1000, 1, 255, 0, 0, 255 ) --Create red marker
<syntaxhighlight lang="lua">
setMarkerColor ( newmarker, 0, 255, 0, 255 ) --Turn red marker into a green one</syntaxhighlight>
local newMarker = createMarker ( 0, 0, 2, "cylinder", 1, 255, 0, 0, 255 ) -- Create a red marker
setMarkerColor ( newMarker, 0, 255, 0, 255 )                     -- Turn the red marker into a green one
</syntaxhighlight>


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

Latest revision as of 13:01, 10 October 2023

This function sets the color of the specified marker by modifying the values for red, green, blue and alpha.

Syntax

bool setMarkerColor ( marker theMarker, int r, int g, int b, int a )

OOP Syntax Help! I don't understand this!

Method: Marker:setColor(...)
Counterpart: getMarkerColor


Required Arguments

  • theMarker: The marker that you wish to set the color of.
  • r: The amount of red in the final color (0 to 255).
  • g: The amount of green in the final color (0 to 255).
  • b: The amount of blue in the final color (0 to 255).
  • a: The amount of alpha in the final color (0 to 255).

Example

local newMarker = createMarker ( 0, 0, 2, "cylinder", 1, 255, 0, 0, 255 )  -- Create a red marker
setMarkerColor ( newMarker, 0, 255, 0, 255 )                      -- Turn the red marker into a green one

See Also