Label::color: Difference between revisions

From RAGE Multiplayer Wiki
(Leinader)
 
mNo edit summary
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
Updates the color of a created label.<br>
<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr"><div class="mw-parser-output"><div class="header" style="background-color: #00baad; color: #FFFFFF; border: 2px solid #00baad;">
<div style="margin: 10px 10px 10px 10px;"><b>Shared</b>
</div>
</div>
<p>Update the color of the selected label
</p>
<h2><span class="mw-headline" id="Syntax">Syntax</span></h2>
<pre>Number label.color
</pre>
<ul><li><b>colorR</b> - <b><span style="color:#008017">Number</span></b></li></ul>
<ul><li><b>colorG</b> - <b><span style="color:#008017">Number</span></b></li></ul>
<ul><li><b>colorB</b> - <b><span style="color:#008017">Number</span></b></li></ul>
<ul><li><b>colorAlpha</b> - <b><span style="color:#008017">Number</span></b></li></ul><br>


Number label.color<br>
<h2><span class="mw-headline" id="Examples">Examples</span><span class="mw-editsection"></span></h2>
<p>Updates the color of the label through the command /labelcolor
</p>
<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;">
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
<pre>let startLabel = mp.labels.new("Use /labelcolor to update the color of this label.", new mp.Vector3(-431.88, 1146.86, 327),
{
    los: false,
    font: 1,
    drawDistance: 100,
    color: [255, 255, 255, 255]
});


Updates the color of the label through the command /labelcolor<br>
mp.events.addCommand("labelcolor", (player, _, colorR, colorG, colorB, colorAlpha) =&gt; {
 
  startLabel.color = parseInt(colorR, colorG, colorB, colorAlpha);
mp.events.addCommand("labelcolor", (player, _, colorR, colorG, colorB, colorAlpha) => {<br>startLabel.color = parseInt(colorR, colorG, colorB, colorAlpha);<br>player.outputChatBox(`You have updated the color of the label to: ${colorR} ${colorG} ${colorB} ${colorAlpha}`);<br>});
  player.outputChatBox(`You have updated the color of the label to: ${colorR} ${colorG} ${colorB} ${colorAlpha}`);
});
</pre>

Latest revision as of 07:40, 5 September 2020

Shared

Update the color of the selected label

Syntax

Number label.color
  • colorR - Number
  • colorG - Number
  • colorB - Number
  • colorAlpha - Number

Examples

Updates the color of the label through the command /labelcolor

Server-Side
let startLabel = mp.labels.new("Use /labelcolor to update the color of this label.", new mp.Vector3(-431.88, 1146.86, 327),
{
    los: false,
    font: 1,
    drawDistance: 100,
    color: [255, 255, 255, 255]
});

mp.events.addCommand("labelcolor", (player, _, colorR, colorG, colorB, colorAlpha) => {
   startLabel.color = parseInt(colorR, colorG, colorB, colorAlpha);
   player.outputChatBox(`You have updated the color of the label to: ${colorR} ${colorG} ${colorB} ${colorAlpha}`);
});